equal
deleted
inserted
replaced
15 from cubicweb import NotAnEntity |
15 from cubicweb import NotAnEntity |
16 from cubicweb.selectors import yes, non_final_entity, nonempty_rset, none_rset |
16 from cubicweb.selectors import yes, non_final_entity, nonempty_rset, none_rset |
17 from cubicweb.selectors import require_group_compat, accepts_compat |
17 from cubicweb.selectors import require_group_compat, accepts_compat |
18 from cubicweb.appobject import AppRsetObject |
18 from cubicweb.appobject import AppRsetObject |
19 from cubicweb.utils import UStringIO, HTMLStream |
19 from cubicweb.utils import UStringIO, HTMLStream |
20 from cubicweb.vregistry import yes_registerer |
|
21 from cubicweb.common.registerers import accepts_registerer, priority_registerer, yes_registerer |
|
22 |
20 |
23 _ = unicode |
21 _ = unicode |
24 |
22 |
25 |
23 |
26 # robots control |
24 # robots control |
91 At instantiation time, the standard `req`, `rset`, and `cursor` |
89 At instantiation time, the standard `req`, `rset`, and `cursor` |
92 attributes are added and the `w` attribute will be set at rendering |
90 attributes are added and the `w` attribute will be set at rendering |
93 time to a write function to use. |
91 time to a write function to use. |
94 """ |
92 """ |
95 __registry__ = 'views' |
93 __registry__ = 'views' |
96 __registerer__ = priority_registerer |
|
97 registered = require_group_compat(AppRsetObject.registered) |
94 registered = require_group_compat(AppRsetObject.registered) |
98 |
95 |
99 templatable = True |
96 templatable = True |
100 need_navigation = True |
97 need_navigation = True |
101 # content_type = 'application/xhtml+xml' # text/xhtml' |
98 # content_type = 'application/xhtml+xml' # text/xhtml' |
318 |
315 |
319 # concrete views base classes ################################################# |
316 # concrete views base classes ################################################# |
320 |
317 |
321 class EntityView(View): |
318 class EntityView(View): |
322 """base class for views applying on an entity (i.e. uniform result set)""" |
319 """base class for views applying on an entity (i.e. uniform result set)""" |
323 __registerer__ = accepts_registerer |
|
324 __select__ = non_final_entity() |
320 __select__ = non_final_entity() |
325 registered = accepts_compat(View.registered) |
321 registered = accepts_compat(View.registered) |
326 |
322 |
327 category = 'entityview' |
323 category = 'entityview' |
328 |
324 |
329 |
325 |
330 class StartupView(View): |
326 class StartupView(View): |
331 """base class for views which doesn't need a particular result set to be |
327 """base class for views which doesn't need a particular result set to be |
332 displayed (so they can always be displayed !) |
328 displayed (so they can always be displayed !) |
333 """ |
329 """ |
334 __registerer__ = priority_registerer |
|
335 __select__ = none_rset() |
330 __select__ = none_rset() |
336 registered = require_group_compat(View.registered) |
331 registered = require_group_compat(View.registered) |
337 |
332 |
338 category = 'startupview' |
333 category = 'startupview' |
339 |
334 |
481 |
476 |
482 |
477 |
483 class Component(ReloadableMixIn, View): |
478 class Component(ReloadableMixIn, View): |
484 """base class for components""" |
479 """base class for components""" |
485 __registry__ = 'components' |
480 __registry__ = 'components' |
486 __registerer__ = yes_registerer |
|
487 __select__ = yes() |
481 __select__ = yes() |
488 property_defs = { |
482 property_defs = { |
489 _('visible'): dict(type='Boolean', default=True, |
483 _('visible'): dict(type='Boolean', default=True, |
490 help=_('display the component or not')), |
484 help=_('display the component or not')), |
491 } |
485 } |