+# $Id$
+# $URL$
from types import StringTypes
import string
'node_ids': Parameter([int], "List of site node identifiers"),
'peer_id': Parameter(int, "Peer to which this site belongs", nullok = True),
'peer_site_id': Parameter(int, "Foreign site identifier at peer", nullok = True),
+ 'site_tag_ids' : Parameter ([int], "List of tags attached to this site"),
'ext_consortium_id': Parameter(int, "external consortium id", nullok = True)
}
related_fields = {
'addresses': [Mixed(Parameter(int, "Address identifer"),
Filter(Address.fields))]
}
- # for Cache
- class_key = 'login_base'
- foreign_fields = ['abbreviated_name', 'name', 'is_public', 'latitude', 'longitude',
- 'url', 'max_slices', 'max_slivers',
- ]
- # forget about these ones, they are read-only anyway
- # handling them causes Cache to re-sync all over again
- # 'last_updated', 'date_created'
- foreign_xrefs = []
+ view_tags_name = "view_site_tags"
+ # tags are used by the Add/Get/Update methods to expose tags
+ # this is initialized here and updated by the accessors factory
+ tags = { }
def validate_name(self, name):
if not len(name):
def __init__(self, api, site_filter = None, columns = None):
Table.__init__(self, api, Site, columns)
-
- sql = "SELECT %s FROM view_sites WHERE deleted IS False" % \
- ", ".join(self.columns)
+
+ view = "view_sites"
+ for tagname in self.tag_columns:
+ view= "%s left join %s using (%s)"%(view,Site.tagvalue_view_name(tagname),
+ Site.primary_key)
+
+ sql = "SELECT %s FROM %s WHERE deleted IS False" % \
+ (", ".join(self.columns.keys()+self.tag_columns.keys()),view)
if site_filter is not None:
if isinstance(site_filter, (list, tuple, set)):