From: Tony Mack Date: Fri, 5 Oct 2012 03:58:57 +0000 (-0400) Subject: fix bugs X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5492c569437625a30635586984e77357af77d86b;p=plcapi.git fix bugs --- diff --git a/PLC/AddressTypes.py b/PLC/AddressTypes.py index 34438716..653c2075 100644 --- a/PLC/AddressTypes.py +++ b/PLC/AddressTypes.py @@ -40,7 +40,7 @@ class AddressType(AlchemyObj): return name def sync(self, insert=False, validate=True): - AlchemyObj.sync(self, insert, validate): + AlchemyObj.sync(self, insert, validate) if insert == True or 'address_type_id' not in self: AlchemyObj.insert(self, dict(self)) else: diff --git a/PLC/PCUs.py b/PLC/PCUs.py index 985a2511..6037c16f 100644 --- a/PLC/PCUs.py +++ b/PLC/PCUs.py @@ -103,7 +103,7 @@ class PCU(AlchemyObj): self['ports'].remove(port) def sync(self, commit, validate=True): - AlchemyObj.sync(self, commit=commit, valiate=validate): + AlchemyObj.sync(self, commit=commit, valiate=validate) if 'pcu_id' not in self: AlchemyObj.insert(self, dict(self)) else: diff --git a/PLC/SiteTags.py b/PLC/SiteTags.py index 9b48e3c1..a1f2b6f8 100644 --- a/PLC/SiteTags.py +++ b/PLC/SiteTags.py @@ -5,9 +5,8 @@ from PLC.Faults import * from PLC.Parameter import Parameter from PLC.Filter import Filter from PLC.Table import Row, Table -from PLC.Storage.AlchemyObj import AlchemyObj +from PLC.Storage.AlchemyObject import AlchemyObj from PLC.TagTypes import TagType, TagTypes -from PLC.Sites import Site class SiteTag(AlchemyObj): """ @@ -46,6 +45,7 @@ class SiteTags(list): """ def __init__(self, api, site_tag_filter = None, columns = None): + from PLC.Sites import Site if not site_tag_filter: site_tags = SiteTag().select() if isinstance(site_tag_filter, (list, tuple, set, int, long)): diff --git a/PLC/SliceTags.py b/PLC/SliceTags.py index 120fde7f..b629772b 100644 --- a/PLC/SliceTags.py +++ b/PLC/SliceTags.py @@ -10,7 +10,7 @@ from PLC.Debug import profile from PLC.Timestamp import Timestamp from PLC.Storage.AlchemyObject import AlchemyObj -class SliceTags(AlchemyObj): +class SliceTag(AlchemyObj): """ Representation of a row in the slice_tags table. To use, optionally instantiate with a dict of values. Update as you would a diff --git a/PLC/TagTypes.py b/PLC/TagTypes.py index 8e7be6ee..9df501ca 100644 --- a/PLC/TagTypes.py +++ b/PLC/TagTypes.py @@ -45,7 +45,7 @@ class TagType (AlchemyObj): #remove_role = Row.remove_object(Role, 'tag_type_role') def sync(self, insert=False, validate=True): - AlchemyObj.sync(self, insert, validate): + AlchemyObj.sync(self, insert, validate) if insert == True or 'tag_type_id' not in self: AlchemyObj.insert(self, dict(self)) else: @@ -64,7 +64,7 @@ class TagTypes(list): if not tag_type_filter: tag_types = TagType().select() - else isinstance(tag_type_filter, (list, tuple, set)): + elif isinstance(tag_type_filter, (list, tuple, set)): ints = filter(lambda x: isinstance(x, (int, long)), tag_type_filter) strs = filter(lambda x: isinstance(x, StringTypes), tag_type_filter) tag_types = TagType().select(filter={'tag_type_id': ints, 'tagname': strs})