# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1239189321 -7200 # Node ID 22b4d300d18d22116846c40c7500df555b41f716 # Parent 824f695ab344872031acabda8c2834d30d403a13 inlineview is no more a 'category', needs specific handling diff -r 824f695ab344 -r 22b4d300d18d web/formrenderers.py --- a/web/formrenderers.py Wed Apr 08 13:14:33 2009 +0200 +++ b/web/formrenderers.py Wed Apr 08 13:15:21 2009 +0200 @@ -321,7 +321,7 @@ """create a form to edit entity's inlined relations""" entity = form.edited_entity __ = form.req.__ - for rschema, targettypes, role in form.relations_by_category('inlineview', 'add'): + for rschema, targettypes, role in form.inlined_relations(): # show inline forms only if there's one possible target type # for rschema if len(targettypes) != 1: diff -r 824f695ab344 -r 22b4d300d18d web/views/editforms.py --- a/web/views/editforms.py Wed Apr 08 13:14:33 2009 +0200 +++ b/web/views/editforms.py Wed Apr 08 13:15:21 2009 +0200 @@ -184,7 +184,7 @@ cls.rcategories.set_rtag(category, rschema, role, X, Y) @classmethod - def erelations_by_category(cls, entity, categories=None, permission=None): + def erelations_by_category(cls, entity, categories=None, permission=None, rtags=None): """return a list of (relation schema, target schemas, role) matching categories and permission """ @@ -194,7 +194,8 @@ if not isinstance(categories, (set, frozenset)): categories = frozenset(categories) eschema = entity.e_schema - rtags = cls.rcategories + if rtags is None: + rtags = cls.rcategories permsoverrides = cls.rpermissions_overrides if entity.has_eid(): eid = entity.eid @@ -307,6 +308,14 @@ return self.erelations_by_category(self.edited_entity, categories, permission) + def inlined_relations(self): + """return a list of (relation schema, target schemas, role) matching + given category(ies) and permission + """ + # we'll need an initialized varmaker if there are some inlined relation + self.initialize_varmaker() + return self.erelations_by_category(self.edited_entity, True, 'add', self.rinlined) + def srelations_by_category(self, categories=None, permission=None): """filter out result of relations_by_category(categories, permission) by removing final relations