# HG changeset patch # User Aurelien Campeas # Date 1242138267 -7200 # Node ID 25a765e756c4482dc24c46bb3f029cd032cce1ff # Parent fe5266f0f88cba593ae3a67f61e6560cf3be2dfe fix self on initfunc diff -r fe5266f0f88c -r 25a765e756c4 rtags.py --- a/rtags.py Tue May 12 15:56:10 2009 +0200 +++ b/rtags.py Tue May 12 16:24:27 2009 +0200 @@ -64,7 +64,7 @@ stype, otype = eschema, tschema else: stype, otype = tschema, eschema - self._initfunc(stype, rtype, otype, role) + self._initfunc(self, stype, rtype, otype, role) # rtag declaration api #################################################### @@ -89,7 +89,7 @@ #else: stype, rtype, otype, tagged = [str(k) for k in key] if self._allowed_values is not None: - assert tag in self._allowed_values + assert tag in self._allowed_values, '%r is not an allowed tag' % tag self._tagdefs[(rtype, tagged, stype, otype)] = tag # rtag runtime api ######################################################## diff -r fe5266f0f88c -r 25a765e756c4 schemas/base.py --- a/schemas/base.py Tue May 12 15:56:10 2009 +0200 +++ b/schemas/base.py Tue May 12 16:24:27 2009 +0200 @@ -53,7 +53,7 @@ identical_to = SubjectRelation('EmailAddress') class use_email(RelationType): - """""" + """ """ permissions = { 'read': ('managers', 'users', 'guests',), 'add': ('managers', RRQLExpression('U has_update_permission S'),), diff -r fe5266f0f88c -r 25a765e756c4 web/uicfg.py --- a/web/uicfg.py Tue May 12 15:56:10 2009 +0200 +++ b/web/uicfg.py Tue May 12 16:24:27 2009 +0200 @@ -71,8 +71,8 @@ # primary view configuration ################################################## -def init_primaryview_section(self, sschema, rschema, oschema, role): - if self.get(sschema, rschema, oschema, role) is None: +def init_primaryview_section(rtag, sschema, rschema, oschema, role): + if rtag.get(sschema, rschema, oschema, role) is None: if rschema.is_final(): if rschema.meta or tschema.type in ('Password', 'Bytes'): section = 'hidden' @@ -84,7 +84,7 @@ section = 'relations' else: section = 'sideboxes' - self.tag_relation((sschema, rschema, oschema, role), section) + rtag.tag_relation((sschema, rschema, oschema, role), section) primaryview_section = RelationTags(init_primaryview_section, frozenset(('attributes', 'relations', @@ -116,17 +116,17 @@ tag.setdefault('order', self._counter) -def init_primaryview_display_ctrl(self, sschema, rschema, oschema, role): +def init_primaryview_display_ctrl(rtag, sschema, rschema, oschema, role): if role == 'subject': oschema = '*' label = rschema.type else: sschema = '*' label = '%s_%s' % (rschema, role) - displayinfo = self.get(sschema, rschema, oschema, role) + displayinfo = rtag.get(sschema, rschema, oschema, role) if displayinfo is None: displayinfo = {} - self.tag_relation((sschema, rschema, oschema, role), displayinfo) + rtag.tag_relation((sschema, rschema, oschema, role), displayinfo) displayinfo.setdefault('label', label) primaryview_display_ctrl = DisplayCtrlRelationTags(init_primaryview_display_ctrl) @@ -146,8 +146,8 @@ # relations'section (eg primary/secondary/generic/metadata/generated) -def init_autoform_section(self, sschema, rschema, oschema, role): - if self.get(sschema, rschema, oschema, role) is None: +def init_autoform_section(rtag, sschema, rschema, oschema, role): + if rtag.get(sschema, rschema, oschema, role) is None: if role == 'subject': card = rschema.rproperty(sschema, oschema, 'cardinality')[0] composed = rschema.rproperty(sschema, oschema, 'composite') == 'object' @@ -165,7 +165,7 @@ section = 'secondary' else: section = 'generic' - self.tag_relation((sschema, rschema, oschema, role), section) + rtag.tag_relation((sschema, rschema, oschema, role), section) autoform_section = RelationTags(init_autoform_section, set(('primary', 'secondary', 'generic', @@ -233,12 +233,12 @@ # boxes.EditBox configuration ################################################# # 'link' / 'create' relation tags, used to control the "add entity" submenu -def init_actionbox_appearsin_addmenu(self, sschema, rschema, oschema, role): - if self.get(sschema, rschema, oschema, role) is None: +def init_actionbox_appearsin_addmenu(rtag, sschema, rschema, oschema, role): + if rtag.get(sschema, rschema, oschema, role) is None: card = rschema.rproperty(sschema, oschema, 'cardinality')[role == 'object'] if not card in '?1' and \ rschema.rproperty(sschema, oschema, 'composite') == role: - self.tag_relation((sschema, rschema, oschema, role), True) + rtag.tag_relation((sschema, rschema, oschema, role), True) actionbox_appearsin_addmenu = RelationTagsBool(init_actionbox_appearsin_addmenu) actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False)