63 # registry content |
63 # registry content |
64 for appobjects in self.itervalues(): |
64 for appobjects in self.itervalues(): |
65 for appobject in appobjects: |
65 for appobject in appobjects: |
66 appobject.vreg_initialization_completed() |
66 appobject.vreg_initialization_completed() |
67 |
67 |
68 def render(self, __oid, req, __fallback_oid=None, rset=None, **kwargs): |
68 def render(self, __oid, req, __fallback_oid=None, rset=None, initargs=None, |
69 """select object, or fallback object if specified and the first one |
69 **kwargs): |
70 isn't selectable, then render it |
70 """Select object with the given id (`__oid`) then render it. If the |
71 """ |
71 object isn't selectable, try to select fallback object if |
72 try: |
72 `__fallback_oid` is specified. |
73 obj = self.select(__oid, req, rset=rset, **kwargs) |
73 |
|
74 If specified `initargs` is expected to be a dictionnary containing |
|
75 arguments that should be given to selection (hence to object's __init__ |
|
76 as well), but not to render(). Other arbitrary keyword arguments will be |
|
77 given to selection *and* to render(), and so should be handled by |
|
78 object's call or cell_call method.. |
|
79 """ |
|
80 if initargs is None: |
|
81 initargs = kwargs |
|
82 else: |
|
83 initargs.update(kwargsargs) |
|
84 try: |
|
85 obj = self.select(__oid, req, rset=rset, **initargs) |
74 except NoSelectableObject: |
86 except NoSelectableObject: |
75 if __fallback_oid is None: |
87 if __fallback_oid is None: |
76 raise |
88 raise |
77 obj = self.select(__fallback_oid, req, rset=rset, **kwargs) |
89 obj = self.select(__fallback_oid, req, rset=rset, **initargs) |
78 return obj.render(**kwargs) |
90 return obj.render(**kwargs) |
79 |
91 |
80 def select_vobject(self, oid, *args, **kwargs): |
92 def select_vobject(self, oid, *args, **kwargs): |
81 selected = self.select_object(oid, *args, **kwargs) |
93 selected = self.select_object(oid, *args, **kwargs) |
82 if selected and selected.propval('visible'): |
94 if selected and selected.propval('visible'): |