Commit ba549722 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

use __regid__ instead of id on appobject classes

parent f5c69485381f
......@@ -22,7 +22,7 @@ class AnyEntity(Entity):
"""an entity instance has e_schema automagically set on the class and
instances have access to their issuing cursor
"""
id = 'Any'
__regid__ = 'Any'
__implements__ = (IBreadCrumbs, IFeed)
fetch_attrs = ('modification_date',)
......
......@@ -13,7 +13,7 @@ from cubicweb import Unauthorized
from cubicweb.entities import AnyEntity, fetch_config
class CWGroup(AnyEntity):
id = 'CWGroup'
__regid__ = 'CWGroup'
fetch_attrs, fetch_order = fetch_config(['name'])
fetch_unrelated_order = fetch_order
......@@ -22,7 +22,7 @@ class CWGroup(AnyEntity):
return self.get('name')
class CWUser(AnyEntity):
id = 'CWUser'
__regid__ = 'CWUser'
fetch_attrs, fetch_order = fetch_config(['login', 'firstname', 'surname'])
fetch_unrelated_order = fetch_order
......
......@@ -24,7 +24,7 @@ def mangle_email(address):
return '%s at %s' % (name, host.replace('.', ' dot '))
class EmailAddress(AnyEntity):
id = 'EmailAddress'
__regid__ = 'EmailAddress'
fetch_attrs, fetch_order = fetch_config(['address', 'alias'])
def dc_title(self):
......@@ -84,7 +84,7 @@ class EmailAddress(AnyEntity):
class Bookmark(AnyEntity):
"""customized class for Bookmark entities"""
id = 'Bookmark'
__regid__ = 'Bookmark'
fetch_attrs, fetch_order = fetch_config(['title', 'path'])
def actual_url(self):
......@@ -103,7 +103,7 @@ class Bookmark(AnyEntity):
class CWProperty(AnyEntity):
id = 'CWProperty'
__regid__ = 'CWProperty'
fetch_attrs, fetch_order = fetch_config(['pkey', 'value'])
rest_attr = 'pkey'
......@@ -126,7 +126,7 @@ class CWProperty(AnyEntity):
class CWCache(AnyEntity):
"""Cache"""
id = 'CWCache'
__regid__ = 'CWCache'
fetch_attrs, fetch_order = fetch_config(['name'])
def touch(self):
......
......@@ -16,7 +16,7 @@ from cubicweb.entities import AnyEntity, fetch_config
class CWEType(AnyEntity):
id = 'CWEType'
__regid__ = 'CWEType'
fetch_attrs, fetch_order = fetch_config(['name'])
def dc_title(self):
......@@ -37,7 +37,7 @@ class CWEType(AnyEntity):
class CWRType(AnyEntity):
id = 'CWRType'
__regid__ = 'CWRType'
fetch_attrs, fetch_order = fetch_config(['name'])
def dc_title(self):
......@@ -87,7 +87,7 @@ class CWRType(AnyEntity):
class CWRelation(AnyEntity):
id = 'CWRelation'
__regid__ = 'CWRelation'
fetch_attrs = fetch_config(['cardinality'])[0]
def dc_title(self):
......@@ -130,7 +130,7 @@ class CWRelation(AnyEntity):
class CWAttribute(CWRelation):
id = 'CWAttribute'
__regid__ = 'CWAttribute'
def dc_long_title(self):
card = self.cardinality
......@@ -144,7 +144,7 @@ class CWAttribute(CWRelation):
class CWConstraint(AnyEntity):
id = 'CWConstraint'
__regid__ = 'CWConstraint'
fetch_attrs, fetch_order = fetch_config(['value'])
def dc_title(self):
......@@ -164,7 +164,7 @@ class CWConstraint(AnyEntity):
class RQLExpression(AnyEntity):
id = 'RQLExpression'
__regid__ = 'RQLExpression'
fetch_attrs, fetch_order = fetch_config(['exprtype', 'mainvars', 'expression'])
def dc_title(self):
......@@ -198,7 +198,7 @@ class RQLExpression(AnyEntity):
class CWPermission(AnyEntity):
id = 'CWPermission'
__regid__ = 'CWPermission'
fetch_attrs, fetch_order = fetch_config(['name', 'label'])
def dc_title(self):
......
......@@ -19,7 +19,7 @@ from cubicweb.common.mixins import MI_REL_TRIGGERS
class WorkflowException(Exception): pass
class Workflow(AnyEntity):
id = 'Workflow'
__regid__ = 'Workflow'
@property
def initial(self):
......@@ -156,11 +156,11 @@ class BaseTransition(AnyEntity):
provides a specific may_be_fired method to check if the relation may be
fired by the logged user
"""
id = 'BaseTransition'
__regid__ = 'BaseTransition'
fetch_attrs, fetch_order = fetch_config(['name'])
def __init__(self, *args, **kwargs):
if self.id == 'BaseTransition':
if self.__regid__ == 'BaseTransition':
raise WorkflowException('should not be instantiated')
super(BaseTransition, self).__init__(*args, **kwargs)
......@@ -233,7 +233,7 @@ class BaseTransition(AnyEntity):
class Transition(BaseTransition):
"""customized class for Transition entities"""
id = 'Transition'
__regid__ = 'Transition'
def destination(self):
return self.destination_state[0]
......@@ -241,7 +241,7 @@ class Transition(BaseTransition):
class WorkflowTransition(BaseTransition):
"""customized class for WorkflowTransition entities"""
id = 'WorkflowTransition'
__regid__ = 'WorkflowTransition'
@property
def subwf(self):
......@@ -284,7 +284,7 @@ class WorkflowTransition(BaseTransition):
class SubWorkflowExitPoint(AnyEntity):
"""customized class for SubWorkflowExitPoint entities"""
id = 'SubWorkflowExitPoint'
__regid__ = 'SubWorkflowExitPoint'
@property
def subwf_state(self):
......@@ -297,7 +297,7 @@ class SubWorkflowExitPoint(AnyEntity):
class State(AnyEntity):
"""customized class for State entities"""
id = 'State'
__regid__ = 'State'
fetch_attrs, fetch_order = fetch_config(['name'])
rest_attr = 'eid'
......@@ -318,7 +318,7 @@ class State(AnyEntity):
class TrInfo(AnyEntity):
"""customized class for Transition information entities
"""
id = 'TrInfo'
__regid__ = 'TrInfo'
fetch_attrs, fetch_order = fetch_config(['creation_date', 'comment'],
pclass=None) # don't want modification_date
@property
......
......@@ -26,7 +26,7 @@ class RecipientsFinder(Component):
by default user's with their email set are notified if any, else the default
email addresses specified in the configuration are used
"""
id = 'recipients_finder'
__regid__ = 'recipients_finder'
__select__ = yes()
user_rql = ('Any X,E,A WHERE X is CWUser, X in_state S, S name "activated",'
'X primary_email E, E address A')
......@@ -59,7 +59,7 @@ class NotificationView(NotificationView):
class StatusChangeMixIn(object):
id = 'notif_status_change'
__regid__ = 'notif_status_change'
msgid_timestamp = True
message = _('status changed')
content = _("""
......@@ -89,7 +89,7 @@ class ContentAddedView(NotificationView):
override call)
"""
__abstract__ = True
id = 'notif_after_add_entity'
__regid__ = 'notif_after_add_entity'
msgid_timestamp = False
message = _('new')
content = """
......
......@@ -82,8 +82,8 @@ def filter_changes(changes):
class SupervisionEmailView(Component):
"""view implementing the email API for data changes supervision notification
"""
__regid__ = 'supervision_notif'
__select__ = none_rset()
id = 'supervision_notif'
def recipients(self):
return self.config['supervising-addrs']
......
......@@ -74,7 +74,7 @@ class SelectAction(Action):
any size entity result search it the current state is 'linksearch'
if accept match.
"""
id = 'select'
__regid__ = 'select'
__select__ = match_search_state('linksearch') & nonempty_rset() & match_searched_etype()
title = _('select')
......@@ -86,7 +86,7 @@ class SelectAction(Action):
class CancelSelectAction(Action):
id = 'cancel'
__regid__ = 'cancel'
__select__ = match_search_state('linksearch')
title = _('cancel select')
......@@ -100,7 +100,7 @@ class CancelSelectAction(Action):
class ViewAction(Action):
id = 'view'
__regid__ = 'view'
__select__ = (match_search_state('normal') &
match_user_groups('users', 'managers') &
view_is_not_default_view() &
......@@ -119,7 +119,7 @@ class ViewAction(Action):
class ModifyAction(Action):
id = 'edit'
__regid__ = 'edit'
__select__ = (match_search_state('normal') &
one_line_rset() &
(has_permission('update') | has_editable_relation('add')))
......@@ -134,7 +134,7 @@ class ModifyAction(Action):
class MultipleEditAction(Action):
id = 'muledit' # XXX get strange conflicts if id='edit'
__regid__ = 'muledit' # XXX get strange conflicts if id='edit'
__select__ = (match_search_state('normal') &
two_lines_rset() & one_etype_rset() &
has_permission('update'))
......@@ -150,7 +150,7 @@ class MultipleEditAction(Action):
# generic "more" actions #######################################################
class ManagePermissionsAction(Action):
id = 'managepermission'
__regid__ = 'managepermission'
__select__ = one_line_rset() & non_final_entity() & match_user_groups('managers')
title = _('manage permissions')
......@@ -171,7 +171,7 @@ class ManagePermissionsAction(Action):
class DeleteAction(Action):
id = 'delete'
__regid__ = 'delete'
__select__ = has_permission('delete')
title = _('delete')
......@@ -186,7 +186,7 @@ class DeleteAction(Action):
class CopyAction(Action):
id = 'copy'
__regid__ = 'copy'
__select__ = one_line_rset() & has_permission('add')
title = _('copy')
......@@ -202,7 +202,7 @@ class AddNewAction(MultipleEditAction):
"""when we're seeing more than one entity with the same type, propose to
add a new one
"""
id = 'addentity'
__regid__ = 'addentity'
__select__ = (match_search_state('normal') &
(addable_etype_empty_rset()
| (two_lines_rset() & one_etype_rset & has_add_permission()))
......@@ -227,7 +227,7 @@ class AddNewAction(MultipleEditAction):
class AddRelatedActions(Action):
"""fill 'addrelated' sub-menu of the actions box"""
id = 'addrelated'
__regid__ = 'addrelated'
__select__ = Action.__select__ & one_line_rset() & non_final_entity()
submenu = _('addrelated')
......@@ -293,7 +293,7 @@ class AddRelatedActions(Action):
# logged user actions #########################################################
class UserPreferencesAction(Action):
id = 'myprefs'
__regid__ = 'myprefs'
__select__ = authenticated_user()
title = _('user preferences')
......@@ -305,7 +305,7 @@ class UserPreferencesAction(Action):
class UserInfoAction(Action):
id = 'myinfos'
__regid__ = 'myinfos'
__select__ = authenticated_user()
title = _('personnal informations')
......@@ -317,7 +317,7 @@ class UserInfoAction(Action):
class LogoutAction(Action):
id = 'logout'
__regid__ = 'logout'
__select__ = authenticated_user()
title = _('logout')
......@@ -341,21 +341,21 @@ class ManagersAction(Action):
class SiteConfigurationAction(ManagersAction):
id = 'siteconfig'
__regid__ = 'siteconfig'
title = _('site configuration')
order = 10
class ManageAction(ManagersAction):
id = 'manage'
__regid__ = 'manage'
title = _('manage')
order = 20
class SiteInfoAction(ManagersAction):
id = 'siteinfo'
__regid__ = 'siteinfo'
__select__ = match_user_groups('users','managers')
title = _('info')
order = 30
__select__ = match_user_groups('users','managers')
from logilab.common.deprecation import class_moved
......
......@@ -19,10 +19,10 @@ class AddRelationView(EditRelationBoxTemplate):
class attributes.
"""
__registry__ = 'views'
__regid__ = 'xaddrelation'
__select__ = (match_form_params('rtype', 'target')
| match_kwargs('rtype', 'target'))
cw_property_defs = {} # don't want to inherit this from Box
id = 'xaddrelation'
expected_kwargs = form_params = ('rtype', 'target')
build_js = EditRelationBoxTemplate.build_reload_js_call
......
......@@ -29,7 +29,7 @@ VISIBLE_PROP_DEF = {
class RQLInputForm(component.Component):
"""build the rql input form, usually displayed in the header"""
id = 'rqlinput'
__regid__ = 'rqlinput'
cw_property_defs = VISIBLE_PROP_DEF
visible = False
......@@ -59,7 +59,7 @@ class RQLInputForm(component.Component):
class ApplLogo(component.Component):
"""build the instance logo, usually displayed in the header"""
id = 'logo'
__regid__ = 'logo'
cw_property_defs = VISIBLE_PROP_DEF
# don't want user to hide this component using an cwproperty
site_wide = True
......@@ -71,7 +71,7 @@ class ApplLogo(component.Component):
class ApplHelp(component.Component):
"""build the help button, usually displayed in the header"""
id = 'help'
__regid__ = 'help'
cw_property_defs = VISIBLE_PROP_DEF
def call(self):
self.w(u'<a href="%s" class="help" title="%s">&#160;</a>'
......@@ -86,7 +86,7 @@ class UserLink(component.Component):
cw_property_defs = VISIBLE_PROP_DEF
# don't want user to hide this component using an cwproperty
site_wide = True
id = 'loggeduserlink'
__regid__ = 'loggeduserlink'
def call(self):
if not self.req.cnx.anonymous_connection:
......@@ -123,7 +123,7 @@ class ApplicationMessage(component.Component):
section
"""
__select__ = yes()
id = 'applmessages'
__regid__ = 'applmessages'
# don't want user to hide this component using an cwproperty
cw_property_defs = {}
......@@ -140,7 +140,7 @@ class ApplicationMessage(component.Component):
class ApplicationName(component.Component):
"""display the instance name"""
id = 'appliname'
__regid__ = 'appliname'
cw_property_defs = VISIBLE_PROP_DEF
# don't want user to hide this component using an cwproperty
site_wide = True
......@@ -154,7 +154,7 @@ class ApplicationName(component.Component):
class SeeAlsoVComponent(component.RelatedObjectsVComponent):
"""display any entity's see also"""
id = 'seealso'
__regid__ = 'seealso'
context = 'navcontentbottom'
rtype = 'see_also'
role = 'subject'
......@@ -168,7 +168,7 @@ class EtypeRestrictionComponent(component.Component):
"""displays the list of entity types contained in the resultset
to be able to filter accordingly.
"""
id = 'etypenavigation'
__regid__ = 'etypenavigation'
__select__ = two_etypes_rset() | match_form_params('__restrtype', '__restrtypes',
'__restrrql')
cw_property_defs = VISIBLE_PROP_DEF
......@@ -216,7 +216,7 @@ class EtypeRestrictionComponent(component.Component):
self.w(u'</div>')
class PdfViewComponent(component.Component):
id = 'pdfview'
__regid__ = 'pdfview'
__select__ = yes()
context = 'header'
......
......@@ -64,7 +64,7 @@ def check_pageid(func):
class LoginController(Controller):
id = 'login'
__regid__ = 'login'
def publish(self, rset=None):
"""log in the instance"""
......@@ -77,7 +77,7 @@ class LoginController(Controller):
class LogoutController(Controller):
id = 'logout'
__regid__ = 'logout'
def publish(self, rset=None):
"""logout from the instance"""
......@@ -89,7 +89,7 @@ class ViewController(Controller):
- build result set
- select and call main template
"""
id = 'view'
__regid__ = 'view'
template = 'main-template'
def publish(self, rset=None):
......@@ -208,7 +208,7 @@ def _validate_form(req, vreg):
class FormValidatorController(Controller):
id = 'validateform'
__regid__ = 'validateform'
def response(self, domid, status, args, entity):
callback = str(self.req.form.get('__onsuccess', 'null'))
......@@ -232,7 +232,7 @@ class FormValidatorController(Controller):
class JSonController(Controller):
id = 'json'
__regid__ = 'json'
def publish(self, rset=None):
"""call js_* methods. Expected form keys:
......@@ -539,7 +539,7 @@ class JSonController(Controller):
class SendMailController(Controller):
id = 'sendmail'
__regid__ = 'sendmail'
__select__ = match_user_groups('managers', 'users')
def recipients(self):
......@@ -588,7 +588,7 @@ class SendMailController(Controller):
class MailBugReportController(SendMailController):
id = 'reportbug'
__regid__ = 'reportbug'
__select__ = yes()
def publish(self, rset=None):
......
......@@ -43,7 +43,7 @@ class LogInOutTemplate(MainTemplate):
class LogInTemplate(LogInOutTemplate):
id = 'login'
__regid__ = 'login'
title = 'log in'
def content(self, w):
......@@ -51,7 +51,7 @@ class LogInTemplate(LogInOutTemplate):
class LoggedOutTemplate(LogInOutTemplate):
id = 'loggedout'
__regid__ = 'loggedout'
title = 'logged out'
def content(self, w):
......@@ -78,7 +78,7 @@ def templatable_view(cls, req, rset, *args, **kwargs):
class NonTemplatableViewTemplate(MainTemplate):
"""main template for any non templatable views (xml, binaries, etc.)"""
id = 'main-template'
__regid__ = 'main-template'
__select__ = ~templatable_view()
def call(self, view):
......@@ -101,7 +101,7 @@ class TheMainTemplate(MainTemplate):
- call header / footer templates
"""
id = 'main-template'
__regid__ = 'main-template'
__select__ = templatable_view()
def call(self, view):
......@@ -193,7 +193,7 @@ class ErrorTemplate(TheMainTemplate):
main template. This template may be called for authentication error,
which means that req.cnx and req.user may not be set.
"""
id = 'error-template'
__regid__ = 'error-template'
def call(self):
"""display an unexpected error"""
......@@ -222,7 +222,7 @@ class ErrorTemplate(TheMainTemplate):
class SimpleMainTemplate(TheMainTemplate):
id = 'main-no-top'
__regid__ = 'main-no-top'
def template_header(self, content_type, view=None, page_title='', additional_headers=()):
page_title = page_title or view.page_title()
......@@ -273,7 +273,7 @@ if can_do_pdf_conversion():
from cubicweb.ext.xhtml2fo import ReportTransformer
class PdfMainTemplate(TheMainTemplate):
id = 'pdf-main-template'
__regid__ = 'pdf-main-template'
def call(self, view):
"""build the standard view, then when it's all done, convert xhtml to pdf
......@@ -308,7 +308,7 @@ if can_do_pdf_conversion():
class HTMLHeader(View):
"""default html headers"""
id = 'htmlheader'
__regid__ = 'htmlheader'
def call(self, **kwargs):
self.favicon()
......@@ -352,7 +352,7 @@ class HTMLHeader(View):
class HTMLPageHeader(View):
"""default html page header"""
id = 'header'
__regid__ = 'header'
main_cell_components = ('appliname', 'breadcrumbs')
def call(self, view, **kwargs):
......@@ -419,7 +419,7 @@ class HTMLPageHeader(View):
class HTMLPageFooter(View):
"""default html page footer: include logo if any, and close the HTML body
"""
id = 'footer'
__regid__ = 'footer'
def call(self, **kwargs):
req = self.req
......@@ -440,7 +440,7 @@ class HTMLContentHeader(View):
* include message component if selectable for this request
* include selectable content navigation components
"""
id = 'contentheader'
__regid__ = 'contentheader'
def call(self, view, **kwargs):
"""by default, display informal messages in content header"""
......@@ -457,7 +457,7 @@ class HTMLContentFooter(View):
"""default html page content footer: include selectable content navigation
components
"""
id = 'contentfooter'
__regid__ = 'contentfooter'
def call(self, view, **kwargs):
components = self.vreg['contentnavigation'].poss_visible_objects(
......@@ -470,7 +470,7 @@ class HTMLContentFooter(View):
class LogFormTemplate(View):
id = 'logform'
__regid__ = 'logform'
__select__ = match_kwargs('id', 'klass')
title = 'log in'
......
......@@ -30,7 +30,7 @@ from cubicweb.common.uilib import cut, printable_value
class NullView(AnyRsetView):
"""default view when no result has been found"""
id = 'null'
__regid__ = 'null'
__select__ = yes()
def call(self, **kwargs):
pass
......@@ -40,7 +40,7 @@ class NullView(AnyRsetView):
class NoResultView(View):
"""default view when no result has been found"""
__select__ = empty_rset()
id = 'noresult'
__regid__ = 'noresult'
def call(self, **kwargs):
self.w(u'<div class="searchMessage"><strong>%s</strong></div>\n'
......@@ -51,7 +51,7 @@ class FinalView(AnyRsetView):