# HG changeset patch # User Adrien Di Mascio # Date 1253692465 -7200 # Node ID fb261afd49cdf5fc31e1e2cac88e48a832309a5b # Parent 405f393bcac00f3ed90167db07f6c12a99d1ba34# Parent c6aff16e5aedf01a2313c513e4c3b77ad7318c93 merge diff -r 405f393bcac0 -r fb261afd49cd appobject.py --- a/appobject.py Wed Sep 23 09:54:01 2009 +0200 +++ b/appobject.py Wed Sep 23 09:54:25 2009 +0200 @@ -209,7 +209,7 @@ :__registry__: name of the registry for this object (string like 'views', 'templates'...) - :__id__: + :__regid__: object's identifier in the registry (string like 'main', 'primary', 'folder_box') :__select__: @@ -240,7 +240,7 @@ are interested in, else None """ __registry__ = None - __id__ = None + __regid__ = None __select__ = yes() @classmethod diff -r 405f393bcac0 -r fb261afd49cd common/mail.py --- a/common/mail.py Wed Sep 23 09:54:01 2009 +0200 +++ b/common/mail.py Wed Sep 23 09:54:25 2009 +0200 @@ -210,7 +210,13 @@ """return a list of either 2-uple (email, language) or user entity to who this email should be sent """ - finder = self.vreg['components'].select('recipients_finder', self.req, + # use super_session when available, we don't want to consider security + # when selecting recipients_finder + try: + req = self.req.super_session + except AttributeError: + req = self.req + finder = self.vreg['components'].select('recipients_finder', req, rset=self.rset, row=self.row or 0, col=self.col or 0) diff -r 405f393bcac0 -r fb261afd49cd cwvreg.py --- a/cwvreg.py Wed Sep 23 09:54:01 2009 +0200 +++ b/cwvreg.py Wed Sep 23 09:54:25 2009 +0200 @@ -161,11 +161,11 @@ objects = self['Any'] assert len(objects) == 1, objects cls = objects[0] - # make a copy event if cls.__id__ == etype, else we may have pb for + # make a copy event if cls.__regid__ == etype, else we may have pb for # client application using multiple connections to different # repositories (eg shingouz) cls = dump_class(cls, etype) - cls.__id__ = etype + cls.__regid__ = etype cls.__initialize__(self.schema) return cls diff -r 405f393bcac0 -r fb261afd49cd entities/__init__.py --- a/entities/__init__.py Wed Sep 23 09:54:01 2009 +0200 +++ b/entities/__init__.py Wed Sep 23 09:54:25 2009 +0200 @@ -22,7 +22,7 @@ """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',) diff -r 405f393bcac0 -r fb261afd49cd entities/authobjs.py --- a/entities/authobjs.py Wed Sep 23 09:54:01 2009 +0200 +++ b/entities/authobjs.py Wed Sep 23 09:54:25 2009 +0200 @@ -13,7 +13,7 @@ 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 @@ 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 @@ -59,12 +59,13 @@ try: # properties stored on the user aren't correctly typed # (e.g. all values are unicode string) - return self.vreg.typed_value(key, self.properties[key]) + return self._cw.vreg.typed_value(key, self.properties[key]) except KeyError: pass except ValueError: - self.warning('incorrect value for eproperty %s of user %s', key, self.login) - return self.vreg.property_value(key) + self.warning('incorrect value for eproperty %s of user %s', + key, self.login) + return self._cw.vreg.property_value(key) def matching_groups(self, groups): """return the number of the given group(s) in which the user is @@ -91,12 +92,12 @@ return self.groups == frozenset(('guests', )) def owns(self, eid): - if hasattr(self.req, 'unsafe_execute'): + if hasattr(self._cw, 'unsafe_execute'): # use unsafe_execute on the repository side, in case # session's user doesn't have access to CWUser - execute = self.req.unsafe_execute + execute = self._cw.unsafe_execute else: - execute = self.req.execute + execute = self._cw.execute try: return execute('Any X WHERE X eid %(x)s, X owned_by U, U eid %(u)s', {'x': eid, 'u': self.eid}, 'x') @@ -114,7 +115,7 @@ kwargs['x'] = contexteid cachekey = 'x' try: - return self.req.execute(rql, kwargs, cachekey) + return self._cw.execute(rql, kwargs, cachekey) except Unauthorized: return False @@ -124,7 +125,7 @@ """construct a name using firstname / surname or login if not defined""" if self.firstname and self.surname: - return self.req._('%(firstname)s %(surname)s') % { + return self._cw._('%(firstname)s %(surname)s') % { 'firstname': self.firstname, 'surname' : self.surname} if self.firstname: return self.firstname diff -r 405f393bcac0 -r fb261afd49cd entities/lib.py --- a/entities/lib.py Wed Sep 23 09:54:01 2009 +0200 +++ b/entities/lib.py Wed Sep 23 09:54:25 2009 +0200 @@ -24,7 +24,7 @@ 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 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 CWProperty(AnyEntity): - id = 'CWProperty' + __regid__ = 'CWProperty' fetch_attrs, fetch_order = fetch_config(['pkey', 'value']) rest_attr = 'pkey' @@ -126,7 +126,7 @@ class CWCache(AnyEntity): """Cache""" - id = 'CWCache' + __regid__ = 'CWCache' fetch_attrs, fetch_order = fetch_config(['name']) def touch(self): diff -r 405f393bcac0 -r fb261afd49cd entities/schemaobjs.py --- a/entities/schemaobjs.py Wed Sep 23 09:54:01 2009 +0200 +++ b/entities/schemaobjs.py Wed Sep 23 09:54:25 2009 +0200 @@ -16,7 +16,7 @@ class CWEType(AnyEntity): - id = 'CWEType' + __regid__ = 'CWEType' fetch_attrs, fetch_order = fetch_config(['name']) def dc_title(self): @@ -37,7 +37,7 @@ class CWRType(AnyEntity): - id = 'CWRType' + __regid__ = 'CWRType' fetch_attrs, fetch_order = fetch_config(['name']) def dc_title(self): @@ -87,7 +87,7 @@ class CWRelation(AnyEntity): - id = 'CWRelation' + __regid__ = 'CWRelation' fetch_attrs = fetch_config(['cardinality'])[0] def dc_title(self): @@ -130,7 +130,7 @@ class CWAttribute(CWRelation): - id = 'CWAttribute' + __regid__ = 'CWAttribute' def dc_long_title(self): card = self.cardinality @@ -144,7 +144,7 @@ class CWConstraint(AnyEntity): - id = 'CWConstraint' + __regid__ = 'CWConstraint' fetch_attrs, fetch_order = fetch_config(['value']) def dc_title(self): @@ -164,7 +164,7 @@ 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 CWPermission(AnyEntity): - id = 'CWPermission' + __regid__ = 'CWPermission' fetch_attrs, fetch_order = fetch_config(['name', 'label']) def dc_title(self): diff -r 405f393bcac0 -r fb261afd49cd entities/wfobjs.py --- a/entities/wfobjs.py Wed Sep 23 09:54:01 2009 +0200 +++ b/entities/wfobjs.py Wed Sep 23 09:54:25 2009 +0200 @@ -19,7 +19,7 @@ class WorkflowException(Exception): pass class Workflow(AnyEntity): - id = 'Workflow' + __regid__ = 'Workflow' @property def initial(self): @@ -156,11 +156,11 @@ 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 Transition(BaseTransition): """customized class for Transition entities""" - id = 'Transition' + __regid__ = 'Transition' def destination(self): return self.destination_state[0] @@ -241,7 +241,7 @@ class WorkflowTransition(BaseTransition): """customized class for WorkflowTransition entities""" - id = 'WorkflowTransition' + __regid__ = 'WorkflowTransition' @property def subwf(self): @@ -284,7 +284,7 @@ class SubWorkflowExitPoint(AnyEntity): """customized class for SubWorkflowExitPoint entities""" - id = 'SubWorkflowExitPoint' + __regid__ = 'SubWorkflowExitPoint' @property def subwf_state(self): @@ -297,7 +297,7 @@ 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 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 diff -r 405f393bcac0 -r fb261afd49cd entity.py --- a/entity.py Wed Sep 23 09:54:01 2009 +0200 +++ b/entity.py Wed Sep 23 09:54:25 2009 +0200 @@ -78,7 +78,7 @@ """initialize a specific entity class by adding descriptors to access entity type's attributes and relations """ - etype = cls.__id__ + etype = cls.__regid__ assert etype != 'Any', etype cls.e_schema = eschema = schema.eschema(etype) for rschema, _ in eschema.attribute_definitions(): @@ -109,7 +109,7 @@ """return a rql to fetch all entities of the class type""" restrictions = restriction or [] if settype: - restrictions.append('%s is %s' % (mainvar, cls.__id__)) + restrictions.append('%s is %s' % (mainvar, cls.__regid__)) if fetchattrs is None: fetchattrs = cls.fetch_attrs selection = [mainvar] @@ -142,7 +142,7 @@ rschema = eschema.subject_relation(attr) except KeyError: cls.warning('skipping fetch_attr %s defined in %s (not found in schema)', - attr, cls.__id__) + attr, cls.__regid__) continue if not user.matching_groups(rschema.get_groups('read')): continue @@ -166,7 +166,7 @@ # later information here, systematically add it. restrictions[-1] += '?' # XXX user.req.vreg iiiirk - destcls = user.req.vreg['etypes'].etype_class(desttype) + destcls = user._cw.vreg['etypes'].etype_class(desttype) destcls._fetch_restrictions(var, varmaker, destcls.fetch_attrs, selection, orderby, restrictions, user, ordermethod, visited=visited) @@ -247,24 +247,24 @@ @cached def metainformation(self): - res = dict(zip(('type', 'source', 'extid'), self.req.describe(self.eid))) - res['source'] = self.req.source_defs()[res['source']] + res = dict(zip(('type', 'source', 'extid'), self._cw.describe(self.eid))) + res['source'] = self._cw.source_defs()[res['source']] return res def clear_local_perm_cache(self, action): for rqlexpr in self.e_schema.get_rqlexprs(action): - self.req.local_perm_cache.pop((rqlexpr.eid, (('x', self.eid),)), None) + self._cw.local_perm_cache.pop((rqlexpr.eid, (('x', self.eid),)), None) def check_perm(self, action): - self.e_schema.check_perm(self.req, action, self.eid) + self.e_schema.check_perm(self._cw, action, self.eid) def has_perm(self, action): - return self.e_schema.has_perm(self.req, action, self.eid) + return self.e_schema.has_perm(self._cw, action, self.eid) def view(self, vid, __registry='views', **kwargs): """shortcut to apply a view on this entity""" - return self.vreg[__registry].render(vid, self.req, rset=self.rset, - row=self.row, col=self.col, **kwargs) + return self._cw.vreg[__registry].render( + vid, self._cw, rset=self.rset, row=self.row, col=self.col, **kwargs) def absolute_url(self, *args, **kwargs): """return an absolute url to view this entity""" @@ -278,18 +278,18 @@ # in linksearch mode, we don't want external urls else selecting # the object for use in the relation is tricky # XXX search_state is web specific - if getattr(self.req, 'search_state', ('normal',))[0] == 'normal': + if getattr(self._cw, 'search_state', ('normal',))[0] == 'normal': kwargs['base_url'] = self.metainformation()['source'].get('base-url') if method in (None, 'view'): try: kwargs['_restpath'] = self.rest_path(kwargs.get('base_url')) except TypeError: warn('%s: rest_path() now take use_ext_eid argument, ' - 'please update' % self.__id__, DeprecationWarning) + 'please update' % self.__regid__, DeprecationWarning) kwargs['_restpath'] = self.rest_path() else: kwargs['rql'] = 'Any X WHERE X eid %s' % self.eid - return self.req.build_url(method, **kwargs) + return self._cw.build_url(method, **kwargs) def rest_path(self, use_ext_eid=False): """returns a REST-like (relative) path for this entity""" @@ -305,7 +305,7 @@ # make sure url is not ambiguous rql = 'Any COUNT(X) WHERE X is %s, X %s %%(value)s' % ( etype, mainattr) - nbresults = self.req.execute(rql, {'value' : value})[0][0] + nbresults = self._cw.execute(rql, {'value' : value})[0][0] if nbresults != 1: # ambiguity? mainattr = 'eid' path += '/eid' @@ -314,13 +314,13 @@ value = self.metainformation()['extid'] else: value = self.eid - return '%s/%s' % (path, self.req.url_quote(value)) + return '%s/%s' % (path, self._cw.url_quote(value)) def attr_metadata(self, attr, metadata): """return a metadata for an attribute (None if unspecified)""" value = getattr(self, '%s_%s' % (attr, metadata), None) if value is None and metadata == 'encoding': - value = self.vreg.property_value('ui.encoding') + value = self._cw.vreg.property_value('ui.encoding') return value def printable_value(self, attr, value=_marker, attrtype=None, @@ -342,11 +342,11 @@ # internalinalized *and* formatted string such as schema # description... if props.get('internationalizable'): - value = self.req._(value) + value = self._cw._(value) attrformat = self.attr_metadata(attr, 'format') if attrformat: return self.mtc_transform(value, attrformat, format, - self.req.encoding) + self._cw.encoding) elif attrtype == 'Bytes': attrformat = self.attr_metadata(attr, 'format') if attrformat: @@ -354,7 +354,7 @@ return self.mtc_transform(value.getvalue(), attrformat, format, encoding) return u'' - value = printable_value(self.req, attrtype, value, props, + value = printable_value(self._cw, attrtype, value, props, displaytime=displaytime) if format == 'text/html': value = xml_escape(value) @@ -365,7 +365,7 @@ trdata = TransformData(data, format, encoding, appobject=self) data = _engine.convert(trdata, target_format).decode() if format == 'text/html': - data = soup2xhtml(data, self.req.encoding) + data = soup2xhtml(data, self._cw.encoding) return data # entity cloning ########################################################## @@ -377,7 +377,7 @@ Overrides this if you want another behaviour """ assert self.has_eid() - execute = self.req.execute + execute = self._cw.execute for rschema in self.e_schema.subject_relations(): if rschema.is_final() or rschema.meta: continue @@ -421,8 +421,8 @@ def as_rset(self): """returns a resultset containing `self` information""" rset = ResultSet([(self.eid,)], 'Any X WHERE X eid %(x)s', - {'x': self.eid}, [(self.__id__,)]) - return self.req.decorate_rset(rset) + {'x': self.eid}, [(self.__regid__,)]) + return self._cw.decorate_rset(rset) def to_complete_relations(self): """by default complete final relations to when calling .complete()""" @@ -434,7 +434,7 @@ # outer join correctly in this case continue if rschema.inlined: - matching_groups = self.req.user.matching_groups + matching_groups = self._cw.user.matching_groups if matching_groups(rschema.get_groups('read')) and \ all(matching_groups(es.get_groups('read')) for es in rschema.objects(self.e_schema)): @@ -449,7 +449,7 @@ if attr == 'eid': continue # password retreival is blocked at the repository server level - if not self.req.user.matching_groups(rschema.get_groups('read')) \ + if not self._cw.user.matching_groups(rschema.get_groups('read')) \ or attrschema.type == 'Password': self[attr] = None continue @@ -509,7 +509,7 @@ # if some outer join are included to fetch inlined relations rql = 'Any %s,%s %s' % (V, ','.join(var for attr, var in selected), ','.join(rql)) - execute = getattr(self.req, 'unsafe_execute', self.req.execute) + execute = getattr(self._cw, 'unsafe_execute', self._cw.execute) rset = execute(rql, {'x': self.eid}, 'x', build_descr=False)[0] # handle attributes for i in xrange(1, lastattr): @@ -520,9 +520,9 @@ value = rset[i] if value is None: rrset = ResultSet([], rql, {'x': self.eid}) - self.req.decorate_rset(rrset) + self._cw.decorate_rset(rrset) else: - rrset = self.req.eid_rset(value) + rrset = self._cw.eid_rset(value) self.set_related_cache(rtype, role, rrset) def get_value(self, name): @@ -540,7 +540,7 @@ rql = "Any A WHERE X eid %%(x)s, X %s A" % name # XXX should we really use unsafe_execute here? I think so (syt), # see #344874 - execute = getattr(self.req, 'unsafe_execute', self.req.execute) + execute = getattr(self._cw, 'unsafe_execute', self._cw.execute) try: rset = execute(rql, {'x': self.eid}, 'x') except Unauthorized: @@ -555,7 +555,7 @@ name, self.eid) if self.e_schema.destination(name) == 'String': # XXX (syt) imo emtpy string is better - self[name] = value = self.req._('unaccessible') + self[name] = value = self._cw._('unaccessible') else: self[name] = value = None return value @@ -575,13 +575,13 @@ rql = self.related_rql(rtype, role) # XXX should we really use unsafe_execute here? I think so (syt), # see #344874 - execute = getattr(self.req, 'unsafe_execute', self.req.execute) + execute = getattr(self._cw, 'unsafe_execute', self._cw.execute) rset = execute(rql, {'x': self.eid}, 'x') self.set_related_cache(rtype, role, rset) return self.related(rtype, role, limit, entities) def related_rql(self, rtype, role='subject', targettypes=None): - rschema = self.req.vreg.schema[rtype] + rschema = self._cw.vreg.schema[rtype] if role == 'subject': if targettypes is None: targettypes = rschema.objects(self.e_schema) @@ -595,14 +595,14 @@ if len(targettypes) > 1: fetchattrs_list = [] for ttype in targettypes: - etypecls = self.vreg['etypes'].etype_class(ttype) + etypecls = self._cw.vreg['etypes'].etype_class(ttype) fetchattrs_list.append(set(etypecls.fetch_attrs)) fetchattrs = reduce(set.intersection, fetchattrs_list) - rql = etypecls.fetch_rql(self.req.user, [restriction], fetchattrs, + rql = etypecls.fetch_rql(self._cw.user, [restriction], fetchattrs, settype=False) else: - etypecls = self.vreg['etypes'].etype_class(targettypes[0]) - rql = etypecls.fetch_rql(self.req.user, [restriction], settype=False) + etypecls = self._cw.vreg['etypes'].etype_class(targettypes[0]) + rql = etypecls.fetch_rql(self._cw.user, [restriction], settype=False) # optimisation: remove ORDERBY if cardinality is 1 or ? (though # greater_card return 1 for those both cases) if card == '1': @@ -626,7 +626,7 @@ """ ordermethod = ordermethod or 'fetch_unrelated_order' if isinstance(rtype, basestring): - rtype = self.req.vreg.schema.rschema(rtype) + rtype = self._cw.vreg.schema.rschema(rtype) if role == 'subject': evar, searchedvar = 'S', 'O' subjtype, objtype = self.e_schema, targettype @@ -645,7 +645,7 @@ args = {} securitycheck_args = {} insertsecurity = (rtype.has_local_role('add') and not - rtype.has_perm(self.req, 'add', **securitycheck_args)) + rtype.has_perm(self._cw, 'add', **securitycheck_args)) constraints = rtype.rproperty(subjtype, objtype, 'constraints') if vocabconstraints: # RQLConstraint is a subclass for RQLVocabularyConstraint, so they @@ -655,8 +655,8 @@ else: restriction += [cstr.restriction for cstr in constraints if isinstance(cstr, RQLConstraint)] - etypecls = self.vreg['etypes'].etype_class(targettype) - rql = etypecls.fetch_rql(self.req.user, restriction, + etypecls = self._cw.vreg['etypes'].etype_class(targettype) + rql = etypecls.fetch_rql(self._cw.user, restriction, mainvar=searchedvar, ordermethod=ordermethod) # ensure we have an order defined if not ' ORDERBY ' in rql: @@ -664,8 +664,8 @@ rql = '%s ORDERBY %s WHERE %s' % (before, searchedvar, after) if insertsecurity: rqlexprs = rtype.get_rqlexprs('add') - rewriter = RQLRewriter(self.req) - rqlst = self.req.vreg.parse(self.req, rql, args) + rewriter = RQLRewriter(self._cw) + rqlst = self._cw.vreg.parse(self._cw, rql, args) for select in rqlst.children: rewriter.rewrite(select, [((searchedvar, searchedvar), rqlexprs)], select.solutions, args) @@ -680,11 +680,11 @@ try: rql, args = self.unrelated_rql(rtype, targettype, role, ordermethod) except Unauthorized: - return self.req.empty_rset() + return self._cw.empty_rset() if limit is not None: before, after = rql.split(' WHERE ', 1) rql = '%s LIMIT %s WHERE %s' % (before, limit, after) - return self.req.execute(rql, args, tuple(args)) + return self._cw.execute(rql, args, tuple(args)) # relations cache handling ################################################ @@ -709,7 +709,7 @@ """set cached values for the given relation""" if rset: related = list(rset.entities(col)) - rschema = self.req.vreg.schema.rschema(rtype) + rschema = self._cw.vreg.schema.rschema(rtype) if role == 'subject': rcard = rschema.rproperty(self.e_schema, related[0].e_schema, 'cardinality')[1] @@ -752,15 +752,15 @@ # and now update the database kwargs['x'] = self.eid if _cw_unsafe: - self.req.unsafe_execute( + self._cw.unsafe_execute( 'SET %s WHERE X eid %%(x)s' % ','.join(relations), kwargs, 'x') else: - self.req.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations), + self._cw.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations), kwargs, 'x') def delete(self): assert self.has_eid(), self.eid - self.req.execute('DELETE %s X WHERE X eid %%(x)s' % self.e_schema, + self._cw.execute('DELETE %s X WHERE X eid %%(x)s' % self.e_schema, {'x': self.eid}) # server side utilities ################################################### @@ -779,10 +779,10 @@ """ # necessary since eid is handled specifically and yams require it to be # in the dictionary - if self.req is None: + if self._cw is None: _ = unicode else: - _ = self.req._ + _ = self._cw._ self.e_schema.check(self, creation=creation, _=_) def fti_containers(self, _done=None): @@ -840,20 +840,6 @@ words += entity.get_words() return words - @deprecated('[3.2] see new form api') - def vocabulary(self, rtype, role='subject', limit=None): - """vocabulary functions must return a list of couples - (label, eid) that will typically be used to fill the - edition view's combobox. - - If `eid` is None in one of these couples, it should be - interpreted as a separator in case vocabulary results are grouped - """ - from logilab.common.testlib import mock_object - form = self.vreg.select('forms', 'edition', self.req, entity=self) - field = mock_object(name=rtype, role=role) - return form.form_field_vocabulary(field, limit) - # attribute and relation descriptors ########################################## diff -r 405f393bcac0 -r fb261afd49cd hooks/bookmark.py --- a/hooks/bookmark.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/bookmark.py Wed Sep 23 09:54:25 2009 +0200 @@ -21,7 +21,7 @@ class DelBookmarkedByHook(hook.Hook): """ensure user logins are stripped""" - __id__ = 'autodelbookmark' + __regid__ = 'autodelbookmark' __select__ = hook.Hook.__select__ & entity_implements('bookmarked_by',) category = 'bookmark' events = ('after_delete_relation',) diff -r 405f393bcac0 -r fb261afd49cd hooks/email.py --- a/hooks/email.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/email.py Wed Sep 23 09:54:25 2009 +0200 @@ -43,7 +43,7 @@ class SetPrimaryEmailHook(hook.Hook): """notify when a bug or story or version has its state modified""" - __id__ = 'setprimaryemail' + __regid__ = 'setprimaryemail' __select__ = hook.Hook.__select__ & hook.match_rtype('use_email') category = 'email' events = ('after_add_relation',) @@ -56,7 +56,7 @@ class SetUseEmailHook(hook.Hook): """notify when a bug or story or version has its state modified""" - __id__ = 'setprimaryemail' + __regid__ = 'setprimaryemail' __select__ = hook.Hook.__select__ & hook.match_rtype('primary_email') category = 'email' events = ('after_add_relation',) diff -r 405f393bcac0 -r fb261afd49cd hooks/integrity.py --- a/hooks/integrity.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/integrity.py Wed Sep 23 09:54:25 2009 +0200 @@ -65,7 +65,7 @@ class CheckCardinalityHook(IntegrityHook): """check cardinalities are satisfied""" - __id__ = 'checkcard' + __regid__ = 'checkcard' events = ('after_add_entity', 'before_delete_relation') def __call__(self): @@ -144,7 +144,7 @@ this is delayed to a precommit time operation since other relation which will make constraint satisfied may be added later. """ - __id__ = 'checkconstraint' + __regid__ = 'checkconstraint' events = ('after_add_relation',) def __call__(self): @@ -156,7 +156,7 @@ class CheckUniqueHook(IntegrityHook): - __id__ = 'checkunique' + __regid__ = 'checkunique' events = ('before_add_entity', 'before_update_entity') def __call__(self): @@ -194,7 +194,7 @@ class DeleteCompositeOrphanHook(IntegrityHook): """delete the composed of a composite relation when this relation is deleted """ - __id__ = 'deletecomposite' + __regid__ = 'deletecomposite' events = ('before_delete_relation',) def __call__(self): @@ -211,7 +211,7 @@ class DontRemoveOwnersGroupHook(IntegrityHook): """delete the composed of a composite relation when this relation is deleted """ - __id__ = 'checkownersgroup' + __regid__ = 'checkownersgroup' __select__ = IntegrityHook.__select__ & entity_implements('CWGroup') events = ('before_delete_entity', 'before_update_entity') @@ -228,7 +228,7 @@ class TidyHtmlFields(IntegrityHook): """tidy HTML in rich text strings""" - __id__ = 'htmltidy' + __regid__ = 'htmltidy' events = ('before_add_entity', 'before_update_entity') def __call__(self): @@ -247,7 +247,7 @@ class StripCWUserLoginHook(IntegrityHook): """ensure user logins are stripped""" - __id__ = 'stripuserlogin' + __regid__ = 'stripuserlogin' __select__ = IntegrityHook.__select__ & entity_implements('CWUser') events = ('before_add_entity', 'before_update_entity',) diff -r 405f393bcac0 -r fb261afd49cd hooks/metadata.py --- a/hooks/metadata.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/metadata.py Wed Sep 23 09:54:25 2009 +0200 @@ -37,7 +37,7 @@ this is a conveniency hook, you shouldn't have to disable it """ - __id__ = 'metaattrsinit' + __regid__ = 'metaattrsinit' events = ('before_add_entity',) def __call__(self): @@ -51,7 +51,7 @@ class UpdateMetaAttrsHook(MetaDataHook): """update an entity -> set modification date""" - __id__ = 'metaattrsupdate' + __regid__ = 'metaattrsupdate' events = ('before_update_entity',) def __call__(self): @@ -71,7 +71,7 @@ class SetIsHook(MetaDataHook): """create a new entity -> set is relation""" - __id__ = 'setis' + __regid__ = 'setis' events = ('after_add_entity',) def __call__(self): @@ -92,7 +92,7 @@ class SetOwnershipHook(MetaDataHook): """create a new entity -> set owner and creator metadata""" - __id__ = 'setowner' + __regid__ = 'setowner' events = ('after_add_entity',) def __call__(self): @@ -114,7 +114,7 @@ """when adding composite relation, the composed should have the same owners has the composite """ - __id__ = 'synccompositeowner' + __regid__ = 'synccompositeowner' events = ('after_add_relation',) def __call__(self): @@ -131,7 +131,7 @@ class FixUserOwnershipHook(MetaDataHook): """when a user has been created, add owned_by relation on itself""" - __id__ = 'fixuserowner' + __regid__ = 'fixuserowner' __select__ = MetaDataHook.__select__ & entity_implements('CWUser') events = ('after_add_entity',) @@ -142,7 +142,7 @@ class UpdateFTIHook(MetaDataHook): """sync fulltext index when relevant relation is added / removed """ - __id__ = 'updateftirel' + __regid__ = 'updateftirel' events = ('after_add_relation', 'after_delete_relation') def __call__(self): diff -r 405f393bcac0 -r fb261afd49cd hooks/notification.py --- a/hooks/notification.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/notification.py Wed Sep 23 09:54:25 2009 +0200 @@ -36,7 +36,7 @@ class StatusChangeHook(NotificationHook): """notify when a workflowable entity has its state modified""" - __id__ = 'notifystatuschange' + __regid__ = 'notifystatuschange' __select__ = NotificationHook.__select__ & entity_implements('TrInfo') events = ('after_add_entity',) @@ -59,7 +59,7 @@ class RelationChangeHook(NotificationHook): - __id__ = 'notifyrelationchange' + __regid__ = 'notifyrelationchange' events = ('before_add_relation', 'after_add_relation', 'before_delete_relation', 'after_delete_relation') @@ -79,7 +79,7 @@ """if a notification view is defined for the event, send notification email defined by the view """ - __id__ = 'notifyentitychange' + __regid__ = 'notifyentitychange' events = ('after_add_entity', 'after_update_entity') def __call__(self): @@ -93,7 +93,7 @@ # supervising ################################################################## class SomethingChangedHook(NotificationHook): - __id__ = 'supervising' + __regid__ = 'supervising' events = ('before_add_relation', 'before_delete_relation', 'after_add_entity', 'before_update_entity') @@ -124,7 +124,7 @@ class EntityDeleteHook(SomethingChangedHook): - __id__ = 'supervisingentitydel' + __regid__ = 'supervisingentitydel' events = ('before_delete_entity',) def _call(self): diff -r 405f393bcac0 -r fb261afd49cd hooks/security.py --- a/hooks/security.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/security.py Wed Sep 23 09:54:25 2009 +0200 @@ -56,7 +56,7 @@ class AfterAddEntitySecurityHook(SecurityHook): - __id__ = 'securityafteraddentity' + __regid__ = 'securityafteraddentity' events = ('after_add_entity',) def __call__(self): @@ -64,7 +64,7 @@ class AfterUpdateEntitySecurityHook(SecurityHook): - __id__ = 'securityafterupdateentity' + __regid__ = 'securityafterupdateentity' events = ('after_update_entity',) def __call__(self): @@ -78,7 +78,7 @@ class BeforeDelEntitySecurityHook(SecurityHook): - __id__ = 'securitybeforedelentity' + __regid__ = 'securitybeforedelentity' events = ('before_delete_entity',) def __call__(self): @@ -86,7 +86,7 @@ class BeforeAddRelationSecurityHook(SecurityHook): - __id__ = 'securitybeforeaddrelation' + __regid__ = 'securitybeforeaddrelation' events = ('before_add_relation',) def __call__(self): @@ -99,7 +99,7 @@ class AfterAddRelationSecurityHook(SecurityHook): - __id__ = 'securityafteraddrelation' + __regid__ = 'securityafteraddrelation' events = ('after_add_relation',) def __call__(self): @@ -118,7 +118,7 @@ class BeforeDelRelationSecurityHook(SecurityHook): - __id__ = 'securitybeforedelrelation' + __regid__ = 'securitybeforedelrelation' events = ('before_delete_relation',) def __call__(self): diff -r 405f393bcac0 -r fb261afd49cd hooks/syncschema.py --- a/hooks/syncschema.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/syncschema.py Wed Sep 23 09:54:25 2009 +0200 @@ -763,7 +763,7 @@ * cascade to delete related CWAttribute and CWRelation entities * instantiate an operation to delete the entity type on commit """ - __id__ = 'syncdelcwetype' + __regid__ = 'syncdelcwetype' __select__ = SyncSchemaHook.__select__ & entity_implements('CWEType') events = ('before_delete_entity',) @@ -779,7 +779,7 @@ class AfterDelCWETypeHook(DelCWETypeHook): - __id__ = 'wfcleanup' + __regid__ = 'wfcleanup' events = ('after_delete_entity',) def __call__(self): @@ -796,7 +796,7 @@ * register an operation to add the entity type to the instance's schema on commit """ - __id__ = 'syncaddcwetype' + __regid__ = 'syncaddcwetype' events = ('before_add_entity',) def __call__(self): @@ -840,7 +840,7 @@ class BeforeUpdateCWETypeHook(DelCWETypeHook): """check name change, handle final""" - __id__ = 'syncupdatecwetype' + __regid__ = 'syncupdatecwetype' events = ('before_update_entity',) def __call__(self): @@ -864,7 +864,7 @@ * cascade to delete related CWAttribute and CWRelation entities * instantiate an operation to delete the relation type on commit """ - __id__ = 'syncdelcwrtype' + __regid__ = 'syncdelcwrtype' __select__ = SyncSchemaHook.__select__ & entity_implements('CWRType') events = ('before_delete_entity',) @@ -887,7 +887,7 @@ We don't know yet this point if a table is necessary """ - __id__ = 'syncaddcwrtype' + __regid__ = 'syncaddcwrtype' events = ('after_add_entity',) def __call__(self): @@ -903,7 +903,7 @@ class BeforeUpdateCWRTypeHook(DelCWRTypeHook): """check name change, handle final""" - __id__ = 'checkupdatecwrtype' + __regid__ = 'checkupdatecwrtype' events = ('before_update_entity',) def __call__(self): @@ -911,7 +911,7 @@ class AfterUpdateCWRTypeHook(DelCWRTypeHook): - __id__ = 'syncupdatecwrtype' + __regid__ = 'syncupdatecwrtype' events = ('after_update_entity',) def __call__(self): @@ -938,7 +938,7 @@ * instantiate an operation to delete the relation definition on commit * delete the associated relation type when necessary """ - __id__ = 'syncdelrelationtype' + __regid__ = 'syncdelrelationtype' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('relation_type') events = ('after_delete_relation',) @@ -985,7 +985,7 @@ # CWAttribute / CWRelation hooks ############################################### class AfterAddCWAttributeHook(SyncSchemaHook): - __id__ = 'syncaddcwattribute' + __regid__ = 'syncaddcwattribute' __select__ = SyncSchemaHook.__select__ & entity_implements('CWAttribute') events = ('after_add_entity',) @@ -994,7 +994,7 @@ class AfterAddCWRelationHook(AfterAddCWAttributeHook): - __id__ = 'syncaddcwrelation' + __regid__ = 'syncaddcwrelation' __select__ = SyncSchemaHook.__select__ & entity_implements('CWRelation') def __call__(self): @@ -1002,7 +1002,7 @@ class AfterUpdateCWRDefHook(SyncSchemaHook): - __id__ = 'syncaddcwattribute' + __regid__ = 'syncaddcwattribute' __select__ = SyncSchemaHook.__select__ & entity_implements('CWAttribute', 'CWRelation') events = ('after_update_entity',) @@ -1032,7 +1032,7 @@ # constraints synchronization hooks ############################################ class AfterAddCWConstraintHook(SyncSchemaHook): - __id__ = 'syncaddcwconstraint' + __regid__ = 'syncaddcwconstraint' __select__ = SyncSchemaHook.__select__ & entity_implements('CWConstraint') events = ('after_add_entity', 'after_update_entity') @@ -1042,7 +1042,7 @@ class AfterAddConstrainedByHook(SyncSchemaHook): - __id__ = 'syncdelconstrainedby' + __regid__ = 'syncdelconstrainedby' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('constrainted_by') events = ('after_add_relation',) @@ -1052,7 +1052,7 @@ class BeforeDeleteConstrainedByHook(AfterAddConstrainedByHook): - __id__ = 'syncdelconstrainedby' + __regid__ = 'syncdelconstrainedby' events = ('before_delete_relation',) def __call__(self): @@ -1077,7 +1077,7 @@ class AfterAddPermissionHook(SyncSchemaHook): """added entity/relation *_permission, need to update schema""" - __id__ = 'syncaddperm' + __regid__ = 'syncaddperm' __select__ = SyncSchemaHook.__select__ & hook.match_rtype( 'read_permission', 'add_permission', 'delete_permission', 'update_permission') @@ -1097,7 +1097,7 @@ skip the operation if the related type is being deleted """ - __id__ = 'syncdelperm' + __regid__ = 'syncdelperm' events = ('before_delete_relation',) def __call__(self): @@ -1115,7 +1115,7 @@ class AfterAddSpecializesHook(SyncSchemaHook): - __id__ = 'syncaddspecializes' + __regid__ = 'syncaddspecializes' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('specializes') events = ('after_add_relation',) @@ -1125,7 +1125,7 @@ class AfterAddSpecializesHook(SyncSchemaHook): - __id__ = 'syncdelspecializes' + __regid__ = 'syncdelspecializes' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('specializes') events = ('after_delete_relation',) diff -r 405f393bcac0 -r fb261afd49cd hooks/syncsession.py --- a/hooks/syncsession.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/syncsession.py Wed Sep 23 09:54:25 2009 +0200 @@ -65,7 +65,7 @@ class SyncInGroupHook(SyncSessionHook): - __id__ = 'syncingroup' + __regid__ = 'syncingroup' __select__ = SyncSessionHook.__select__ & hook.match_rtype('in_group') events = ('after_delete_relation', 'after_add_relation') @@ -93,7 +93,7 @@ class CloseDeletedUserSessionsHook(SyncSessionHook): - __id__ = 'closession' + __regid__ = 'closession' __select__ = SyncSessionHook.__select__ & entity_implements('CWUser') events = ('after_delete_entity',) @@ -137,7 +137,7 @@ class AddCWPropertyHook(SyncSessionHook): - __id__ = 'addcwprop' + __regid__ = 'addcwprop' __select__ = SyncSessionHook.__select__ & entity_implements('CWProperty') events = ('after_add_entity',) @@ -159,7 +159,7 @@ class UpdateCWPropertyHook(AddCWPropertyHook): - __id__ = 'updatecwprop' + __regid__ = 'updatecwprop' events = ('after_update_entity',) def __call__(self): @@ -186,7 +186,7 @@ class DeleteCWPropertyHook(AddCWPropertyHook): - __id__ = 'delcwprop' + __regid__ = 'delcwprop' events = ('before_delete_entity',) def __call__(self): @@ -201,7 +201,7 @@ class AddForUserRelationHook(SyncSessionHook): - __id__ = 'addcwpropforuser' + __regid__ = 'addcwpropforuser' __select__ = SyncSessionHook.__select__ & hook.match_rtype('for_user') events = ('after_add_relation',) @@ -221,7 +221,7 @@ class DelForUserRelationHook(AddForUserRelationHook): - __id__ = 'delcwpropforuser' + __regid__ = 'delcwpropforuser' events = ('after_delete_relation',) def __call__(self): diff -r 405f393bcac0 -r fb261afd49cd hooks/workflow.py --- a/hooks/workflow.py Wed Sep 23 09:54:01 2009 +0200 +++ b/hooks/workflow.py Wed Sep 23 09:54:25 2009 +0200 @@ -101,7 +101,7 @@ class SetInitialStateHook(WorkflowHook): - __id__ = 'wfsetinitial' + __regid__ = 'wfsetinitial' __select__ = WorkflowHook.__select__ & entity_implements(IWorkflowable) events = ('after_add_entity',) @@ -111,7 +111,7 @@ class PrepareStateChangeHook(WorkflowHook): """record previous state information""" - __id__ = 'cwdelstate' + __regid__ = 'cwdelstate' __select__ = WorkflowHook.__select__ & hook.match_rtype('in_state') events = ('before_delete_relation',) @@ -125,7 +125,7 @@ * wf_info_for inlined relation is set * by_transition or to_state (managers only) inlined relation is set """ - __id__ = 'wffiretransition' + __regid__ = 'wffiretransition' __select__ = WorkflowHook.__select__ & entity_implements('TrInfo') events = ('before_add_entity',) @@ -210,7 +210,7 @@ class FiredTransitionHook(WorkflowHook): """change related entity state""" - __id__ = 'wffiretransition' + __regid__ = 'wffiretransition' __select__ = WorkflowHook.__select__ & entity_implements('TrInfo') events = ('after_add_entity',) @@ -247,7 +247,7 @@ class CheckInStateChangeAllowed(WorkflowHook): """check state apply, in case of direct in_state change using unsafe_execute """ - __id__ = 'wfcheckinstate' + __regid__ = 'wfcheckinstate' __select__ = WorkflowHook.__select__ & hook.match_rtype('in_state') events = ('before_add_relation',) @@ -276,7 +276,7 @@ class SetModificationDateOnStateChange(WorkflowHook): """update entity's modification date after changing its state""" - __id__ = 'wfsyncmdate' + __regid__ = 'wfsyncmdate' __select__ = WorkflowHook.__select__ & hook.match_rtype('in_state') events = ('after_add_relation',) @@ -296,7 +296,7 @@ class CheckWorkflowTransitionExitPoint(WorkflowHook): """check that there is no multiple exits from the same state""" - __id__ = 'wfcheckwftrexit' + __regid__ = 'wfcheckwftrexit' __select__ = WorkflowHook.__select__ & hook.match_rtype('subworkflow_exit') events = ('after_add_relation',) @@ -305,7 +305,7 @@ class SetCustomWorkflow(WorkflowHook): - __id__ = 'wfsetcustom' + __regid__ = 'wfsetcustom' __select__ = WorkflowHook.__select__ & hook.match_rtype('custom_workflow') events = ('after_add_relation',) @@ -314,7 +314,7 @@ class DelCustomWorkflow(SetCustomWorkflow): - __id__ = 'wfdelcustom' + __regid__ = 'wfdelcustom' events = ('after_delete_relation',) def __call__(self): @@ -326,7 +326,7 @@ class DelWorkflowHook(WorkflowHook): - __id__ = 'wfdel' + __regid__ = 'wfdel' __select__ = WorkflowHook.__select__ & entity_implements('Workflow') events = ('after_delete_entity',) diff -r 405f393bcac0 -r fb261afd49cd rset.py --- a/rset.py Wed Sep 23 09:54:01 2009 +0200 +++ b/rset.py Wed Sep 23 09:54:25 2009 +0200 @@ -322,7 +322,7 @@ # we also have to fix/remove from the request entity cache entities # which get a wrong rset reference by this limit call for entity in self.req.cached_entities(): - if entity.rset is self: + if entity.cw_rset is self: if offset <= entity.row < stop: entity.row = entity.row - offset else: @@ -425,7 +425,7 @@ except KeyError: pass else: - if entity.rset is None: + if entity.cw_rset is None: # entity has no rset set, this means entity has been created by # the querier (req is a repository session) and so jas no rset # info. Add it. diff -r 405f393bcac0 -r fb261afd49cd selectors.py --- a/selectors.py Wed Sep 23 09:54:01 2009 +0200 +++ b/selectors.py Wed Sep 23 09:54:25 2009 +0200 @@ -637,7 +637,7 @@ proximity so the most specific object'll be selected """ def score_entity(self, entity): - return self.score_interfaces(entity.req, entity, entity.__class__) + return self.score_interfaces(entity._cw, entity, entity.__class__) class relation_possible(EClassSelector): @@ -742,9 +742,9 @@ def score_entity(self, entity): rschema = entity.schema.rschema(self.rtype) if self.role == 'subject': - if not rschema.has_perm(entity.req, 'add', fromeid=entity.eid): + if not rschema.has_perm(entity._cw, 'add', fromeid=entity.eid): return 0 - elif not rschema.has_perm(entity.req, 'add', toeid=entity.eid): + elif not rschema.has_perm(entity._cw, 'add', toeid=entity.eid): return 0 return 1 @@ -795,7 +795,7 @@ def score_entity(self, entity): relpossel = relation_possible(self.rtype, self.role, self.target_etype) - if not relpossel.score_class(entity.__class__, entity.req): + if not relpossel.score_class(entity.__class__, entity._cw): return 0 rset = entity.related(self.rtype, self.role) if self.target_etype: diff -r 405f393bcac0 -r fb261afd49cd server/checkintegrity.py --- a/server/checkintegrity.py Wed Sep 23 09:54:01 2009 +0200 +++ b/server/checkintegrity.py Wed Sep 23 09:54:25 2009 +0200 @@ -211,8 +211,8 @@ if not has_eid(cursor, eid, eids): bad_related_msg(rschema, 'object', eid, fix) if fix: - sql = 'UPDATE %s SET %s = NULL WHERE %seid=%s;' % ( - table, column, SQL_PREFIX, eid) + sql = 'UPDATE %s SET %s=NULL WHERE %s=%s;' % ( + table, column, column, eid) session.system_sql(sql) continue cursor = session.system_sql('SELECT eid_from FROM %s_relation;' % rschema) diff -r 405f393bcac0 -r fb261afd49cd server/hook.py --- a/server/hook.py Wed Sep 23 09:54:01 2009 +0200 +++ b/server/hook.py Wed Sep 23 09:54:25 2009 +0200 @@ -138,15 +138,17 @@ enabled = True @classproperty - def __id__(cls): - warn('[3.6] %s: please specify an id for your hook' % cls) + def __regid__(cls): + warn('[3.6] %s.%s: please specify an id for your hook' + % (cls.__module__, cls.__name__), DeprecationWarning) return str(id(cls)) @classmethod def __registered__(cls, vreg): super(Hook, cls).__registered__(vreg) if getattr(cls, 'accepts', None): - warn('[3.6] %s: accepts is deprecated, define proper __select__' % cls) + warn('[3.6] %s.%s: accepts is deprecated, define proper __select__' + % (cls.__module__, cls.__name__), DeprecationWarning) rtypes = [] for ertype in cls.accepts: if ertype.islower(): @@ -167,8 +169,9 @@ def __call__(self): if hasattr(self, 'call'): - warn('[3.6] %s: call is deprecated, implements __call__' % self.__class__, - DeprecationWarning) + cls = self.__class__ + warn('[3.6] %s.%s: call is deprecated, implements __call__' + % (cls.__module__, cls.__name__), DeprecationWarning) if self.event.endswith('_relation'): self.call(self._cw, self.eidfrom, self.rtype, self.eidto) elif 'delete' in self.event: diff -r 405f393bcac0 -r fb261afd49cd server/repository.py --- a/server/repository.py Wed Sep 23 09:54:01 2009 +0200 +++ b/server/repository.py Wed Sep 23 09:54:25 2009 +0200 @@ -54,7 +54,8 @@ remove inserted eid from repository type/source cache """ try: - self.repo.clear_caches(self.session.transaction_data['pendingeids']) + self.session.repo.clear_caches( + self.session.transaction_data['pendingeids']) except KeyError: pass @@ -63,7 +64,8 @@ remove inserted eid from repository type/source cache """ try: - self.repo.clear_caches(self.session.transaction_data['neweids']) + self.session.repo.clear_caches( + self.session.transaction_data['neweids']) except KeyError: pass @@ -536,7 +538,7 @@ finally: session.close() session = Session(user, self, cnxprops) - user._cw = user.rset.req = session + user._cw = user.cw_rset.req = session user.clear_related_cache() self._sessions[session.id] = session self.info('opened %s', session) diff -r 405f393bcac0 -r fb261afd49cd server/session.py --- a/server/session.py Wed Sep 23 09:54:01 2009 +0200 +++ b/server/session.py Wed Sep 23 09:54:25 2009 +0200 @@ -163,7 +163,7 @@ rset.description = list(rset.description) rset.description.append([self.describe(targeteid)[0]]) targetentity = self.entity_from_eid(targeteid) - if targetentity.rset is None: + if targetentity.cw_rset is None: targetentity.cw_rset = rset targetentity.cw_row = rset.rowcount targetentity.cw_col = 0 diff -r 405f393bcac0 -r fb261afd49cd sobjects/notification.py --- a/sobjects/notification.py Wed Sep 23 09:54:01 2009 +0200 +++ b/sobjects/notification.py Wed Sep 23 09:54:25 2009 +0200 @@ -26,7 +26,7 @@ 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 StatusChangeMixIn(object): - id = 'notif_status_change' + __regid__ = 'notif_status_change' msgid_timestamp = True message = _('status changed') content = _(""" @@ -89,7 +89,7 @@ override call) """ __abstract__ = True - id = 'notif_after_add_entity' + __regid__ = 'notif_after_add_entity' msgid_timestamp = False message = _('new') content = """ diff -r 405f393bcac0 -r fb261afd49cd sobjects/supervising.py --- a/sobjects/supervising.py Wed Sep 23 09:54:01 2009 +0200 +++ b/sobjects/supervising.py Wed Sep 23 09:54:25 2009 +0200 @@ -82,8 +82,8 @@ 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'] diff -r 405f393bcac0 -r fb261afd49cd utils.py --- a/utils.py Wed Sep 23 09:54:01 2009 +0200 +++ b/utils.py Wed Sep 23 09:54:25 2009 +0200 @@ -20,8 +20,6 @@ from calendar import monthrange import decimal -import simplejson - # initialize random seed from current time seed() try: @@ -364,24 +362,25 @@ return True try: - # may not be there is cubicweb-web not there - from simplejson import JSONEncoder, dumps + # may not be there if cubicweb-web not installed + from simplejson import dumps, JSONEncoder except ImportError: pass else: + class CubicWebJsonEncoder(JSONEncoder): """define a simplejson encoder to be able to encode yams std types""" def default(self, obj): - if isinstance(obj, datetime): + if isinstance(obj, pydatetime.datetime): return obj.strftime('%Y/%m/%d %H:%M:%S') - elif isinstance(obj, date): + elif isinstance(obj, pydatetime.date): return obj.strftime('%Y/%m/%d') elif isinstance(obj, pydatetime.time): return obj.strftime('%H:%M:%S') elif isinstance(obj, decimal.Decimal): return float(obj) try: - return simplejson.JSONEncoder.default(self, obj) + return JSONEncoder.default(self, obj) except TypeError: # we never ever want to fail because of an unknown type, # just return None in those cases. diff -r 405f393bcac0 -r fb261afd49cd vregistry.py --- a/vregistry.py Wed Sep 23 09:54:01 2009 +0200 +++ b/vregistry.py Wed Sep 23 09:54:25 2009 +0200 @@ -61,11 +61,12 @@ def class_regid(cls): """returns a unique identifier for an appobject class""" if 'id' in cls.__dict__: - warn('%s: id is deprecated, use __id__') - cls.__id__ = cls.id + warn('%s.%s: id is deprecated, use __regid__' + % (cls.__module__, cls.__name__), DeprecationWarning) + cls.__regid__ = cls.id if hasattr(cls, 'id'): return cls.id - return cls.__id__ + return cls.__regid__ class Registry(dict): diff -r 405f393bcac0 -r fb261afd49cd web/views/actions.py --- a/web/views/actions.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/actions.py Wed Sep 23 09:54:25 2009 +0200 @@ -74,7 +74,7 @@ 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 CancelSelectAction(Action): - id = 'cancel' + __regid__ = 'cancel' __select__ = match_search_state('linksearch') title = _('cancel select') @@ -100,7 +100,7 @@ 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 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 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 @@ # 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 DeleteAction(Action): - id = 'delete' + __regid__ = 'delete' __select__ = has_permission('delete') title = _('delete') @@ -186,7 +186,7 @@ class CopyAction(Action): - id = 'copy' + __regid__ = 'copy' __select__ = one_line_rset() & has_permission('add') title = _('copy') @@ -202,7 +202,7 @@ """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 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 @@ # logged user actions ######################################################### class UserPreferencesAction(Action): - id = 'myprefs' + __regid__ = 'myprefs' __select__ = authenticated_user() title = _('user preferences') @@ -305,7 +305,7 @@ class UserInfoAction(Action): - id = 'myinfos' + __regid__ = 'myinfos' __select__ = authenticated_user() title = _('personnal informations') @@ -317,7 +317,7 @@ class LogoutAction(Action): - id = 'logout' + __regid__ = 'logout' __select__ = authenticated_user() title = _('logout') @@ -341,21 +341,21 @@ 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 diff -r 405f393bcac0 -r fb261afd49cd web/views/ajaxedit.py --- a/web/views/ajaxedit.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/ajaxedit.py Wed Sep 23 09:54:25 2009 +0200 @@ -19,10 +19,10 @@ 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 diff -r 405f393bcac0 -r fb261afd49cd web/views/basecomponents.py --- a/web/views/basecomponents.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/basecomponents.py Wed Sep 23 09:54:25 2009 +0200 @@ -29,7 +29,7 @@ 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 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 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' ' @@ -86,7 +86,7 @@ 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 @@ 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 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 SeeAlsoVComponent(component.RelatedObjectsVComponent): """display any entity's see also""" - id = 'seealso' + __regid__ = 'seealso' context = 'navcontentbottom' rtype = 'see_also' role = 'subject' @@ -168,7 +168,7 @@ """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 @@ self.w(u'') class PdfViewComponent(component.Component): - id = 'pdfview' + __regid__ = 'pdfview' __select__ = yes() context = 'header' diff -r 405f393bcac0 -r fb261afd49cd web/views/basecontrollers.py --- a/web/views/basecontrollers.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/basecontrollers.py Wed Sep 23 09:54:25 2009 +0200 @@ -64,7 +64,7 @@ class LoginController(Controller): - id = 'login' + __regid__ = 'login' def publish(self, rset=None): """log in the instance""" @@ -77,7 +77,7 @@ class LogoutController(Controller): - id = 'logout' + __regid__ = 'logout' def publish(self, rset=None): """logout from the instance""" @@ -89,7 +89,7 @@ - build result set - select and call main template """ - id = 'view' + __regid__ = 'view' template = 'main-template' def publish(self, rset=None): @@ -208,7 +208,7 @@ 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 JSonController(Controller): - id = 'json' + __regid__ = 'json' def publish(self, rset=None): """call js_* methods. Expected form keys: @@ -539,7 +539,7 @@ class SendMailController(Controller): - id = 'sendmail' + __regid__ = 'sendmail' __select__ = match_user_groups('managers', 'users') def recipients(self): @@ -588,7 +588,7 @@ class MailBugReportController(SendMailController): - id = 'reportbug' + __regid__ = 'reportbug' __select__ = yes() def publish(self, rset=None): diff -r 405f393bcac0 -r fb261afd49cd web/views/basetemplates.py --- a/web/views/basetemplates.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/basetemplates.py Wed Sep 23 09:54:25 2009 +0200 @@ -43,7 +43,7 @@ class LogInTemplate(LogInOutTemplate): - id = 'login' + __regid__ = 'login' title = 'log in' def content(self, w): @@ -51,7 +51,7 @@ class LoggedOutTemplate(LogInOutTemplate): - id = 'loggedout' + __regid__ = 'loggedout' title = 'logged out' def content(self, w): @@ -78,7 +78,7 @@ 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 @@ - call header / footer templates """ - id = 'main-template' + __regid__ = 'main-template' __select__ = templatable_view() def call(self, view): @@ -193,7 +193,7 @@ 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 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 @@ 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 @@ class HTMLHeader(View): """default html headers""" - id = 'htmlheader' + __regid__ = 'htmlheader' def call(self, **kwargs): self.favicon() @@ -352,7 +352,7 @@ 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 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 @@ * 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 @@ """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 LogFormTemplate(View): - id = 'logform' + __regid__ = 'logform' __select__ = match_kwargs('id', 'klass') title = 'log in' diff -r 405f393bcac0 -r fb261afd49cd web/views/baseviews.py --- a/web/views/baseviews.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/baseviews.py Wed Sep 23 09:54:25 2009 +0200 @@ -30,7 +30,7 @@ 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 NoResultView(View): """default view when no result has been found""" __select__ = empty_rset() - id = 'noresult' + __regid__ = 'noresult' def call(self, **kwargs): self.w(u'
%s
\n' @@ -51,7 +51,7 @@ """display values without any transformation (i.e. get a number for entities) """ - id = 'final' + __regid__ = 'final' # record generated i18n catalog messages _('%d years') _('%d months') @@ -112,7 +112,7 @@ # XXX deprecated class SecondaryView(EntityView): - id = 'secondary' + __regid__ = 'secondary' title = _('secondary') def cell_call(self, row, col): @@ -125,7 +125,7 @@ class OneLineView(EntityView): - id = 'oneline' + __regid__ = 'oneline' title = _('oneline') def cell_call(self, row, col): @@ -139,7 +139,7 @@ class TextView(EntityView): """the simplest text view for an entity""" - id = 'text' + __regid__ = 'text' title = _('text') content_type = 'text/plain' @@ -166,7 +166,7 @@ class MetaDataView(EntityView): """paragraph view of some metadata""" - id = 'metadata' + __regid__ = 'metadata' show_eid = True def cell_call(self, row, col): @@ -191,7 +191,7 @@ class InContextTextView(TextView): - id = 'textincontext' + __regid__ = 'textincontext' title = None # not listed as a possible view def cell_call(self, row, col): entity = self.rset.get_entity(row, col) @@ -199,7 +199,7 @@ class OutOfContextTextView(InContextTextView): - id = 'textoutofcontext' + __regid__ = 'textoutofcontext' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) @@ -207,7 +207,7 @@ class InContextView(EntityView): - id = 'incontext' + __regid__ = 'incontext' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) @@ -220,7 +220,7 @@ class OutOfContextView(EntityView): - id = 'outofcontext' + __regid__ = 'outofcontext' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) @@ -235,7 +235,7 @@ # list views ################################################################## class ListView(EntityView): - id = 'list' + __regid__ = 'list' title = _('list') item_vid = 'listitem' @@ -269,7 +269,7 @@ class ListItemView(EntityView): - id = 'listitem' + __regid__ = 'listitem' @property def redirect_vid(self): @@ -290,13 +290,13 @@ class SimpleListView(ListItemView): """list without bullets""" - id = 'simplelist' + __regid__ = 'simplelist' redirect_vid = 'incontext' class AdaptedListView(EntityView): """list of entities of the same type""" - id = 'adaptedlist' + __regid__ = 'adaptedlist' __select__ = EntityView.__select__ & one_etype_rset() item_vid = 'adaptedlistitem' @@ -316,11 +316,11 @@ class AdaptedListItemView(ListItemView): - id = 'adaptedlistitem' + __regid__ = 'adaptedlistitem' class CSVView(SimpleListView): - id = 'csv' + __regid__ = 'csv' redirect_vid = 'incontext' def call(self, **kwargs): @@ -332,7 +332,7 @@ class TreeItemView(ListItemView): - id = 'treeitem' + __regid__ = 'treeitem' def cell_call(self, row, col): self.wview('incontext', self.rset, row=row, col=col) @@ -344,7 +344,7 @@ XXX: finish me (fixed line width, fixed number of lines, CSS, etc.) """ - id = 'tsearch' + __regid__ = 'tsearch' def cell_call(self, row, col, **kwargs): entity = self.complete_entity(row, col) @@ -374,7 +374,7 @@ class TooltipView(EntityView): """A entity view used in a tooltip""" - id = 'tooltip' + __regid__ = 'tooltip' def cell_call(self, row, col): self.wview('oneline', self.rset, row=row, col=col) diff -r 405f393bcac0 -r fb261afd49cd web/views/boxes.py --- a/web/views/boxes.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/boxes.py Wed Sep 23 09:54:25 2009 +0200 @@ -33,7 +33,7 @@ box with all actions impacting the entity displayed: edit, copy, delete change state, add related entities """ - id = 'edit_box' + __regid__ = 'edit_box' __select__ = BoxTemplate.__select__ & non_final_entity() title = _('actions') @@ -106,7 +106,7 @@ class SearchBox(BoxTemplate): """display a box with a simple search form""" - id = 'search_box' + __regid__ = 'search_box' visible = True # enabled by default title = _('search') @@ -139,7 +139,7 @@ class PossibleViewsBox(BoxTemplate): """display a box containing links to all possible views""" - id = 'possible_views_box' + __regid__ = 'possible_views_box' __select__ = BoxTemplate.__select__ & match_user_groups('users', 'managers') visible = False @@ -162,7 +162,7 @@ class StartupViewsBox(BoxTemplate): """display a box containing links to all startup views""" - id = 'startup_views_box' + __regid__ = 'startup_views_box' visible = False # disabled by default title = _('startup views') order = 70 @@ -181,7 +181,7 @@ class SideBoxView(EntityView): """helper view class to display some entities in a sidebox""" - id = 'sidebox' + __regid__ = 'sidebox' def call(self, boxclass='sideBox', title=u''): """display a list of entities by calling their view""" diff -r 405f393bcac0 -r fb261afd49cd web/views/calendar.py --- a/web/views/calendar.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/calendar.py Wed Sep 23 09:54:25 2009 +0200 @@ -44,7 +44,7 @@ content_type = 'text/calendar' title = _('iCalendar') templatable = False - id = 'ical' + __regid__ = 'ical' def call(self): ical = iCalendar() @@ -71,7 +71,7 @@ Does apply to ICalendarable compatible entities """ - id = 'hcal' + __regid__ = 'hcal' __select__ = implements(ICalendarable) need_navigation = False title = _('hCalendar') @@ -94,7 +94,7 @@ class CalendarItemView(EntityView): - id = 'calendaritem' + __regid__ = 'calendaritem' def cell_call(self, row, col, dates=False): task = self.complete_entity(row) @@ -106,7 +106,7 @@ self.w('
to %s'%self.format_date(task.stop)) class CalendarLargeItemView(CalendarItemView): - id = 'calendarlargeitem' + __regid__ = 'calendarlargeitem' class _TaskEntry(object): @@ -129,7 +129,7 @@ class OneMonthCal(EntityView): """At some point, this view will probably replace ampm calendars""" - id = 'onemonthcal' + __regid__ = 'onemonthcal' __select__ = implements(ICalendarable) need_navigation = False title = _('one month') @@ -320,7 +320,7 @@ class OneWeekCal(EntityView): """At some point, this view will probably replace ampm calendars""" - id = 'oneweekcal' + __regid__ = 'oneweekcal' __select__ = implements(ICalendarable) need_navigation = False title = _('one week') diff -r 405f393bcac0 -r fb261afd49cd web/views/csvexport.py --- a/web/views/csvexport.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/csvexport.py Wed Sep 23 09:54:25 2009 +0200 @@ -33,7 +33,7 @@ class CSVRsetView(CSVMixIn, AnyRsetView): """dumps raw result set in CSV""" - id = 'csvexport' + __regid__ = 'csvexport' title = _('csv export') def call(self): @@ -64,7 +64,7 @@ resultset. ('table' here only means empty lines separation between table contents) """ - id = 'ecsvexport' + __regid__ = 'ecsvexport' title = _('csv entities export') def call(self): diff -r 405f393bcac0 -r fb261afd49cd web/views/cwproperties.py --- a/web/views/cwproperties.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/cwproperties.py Wed Sep 23 09:54:25 2009 +0200 @@ -65,7 +65,7 @@ class SystemCWPropertiesForm(FormViewMixIn, StartupView): """site-wide properties edition form""" - id = 'systempropertiesform' + __regid__ = 'systempropertiesform' __select__ = none_rset() & match_user_groups('managers') title = _('site configuration') @@ -227,7 +227,7 @@ class CWPropertiesForm(SystemCWPropertiesForm): """user's preferences properties edition form""" - id = 'propertiesform' + __regid__ = 'propertiesform' __select__ = ( (none_rset() & match_user_groups('users','managers')) | (one_line_rset() & match_user_groups('users') & is_user_prefs()) @@ -360,7 +360,7 @@ class CWPropertiesFormRenderer(formrenderers.FormRenderer): """specific renderer for properties""" - id = 'cwproperties' + __regid__ = 'cwproperties' def open_form(self, form, values): err = '
' diff -r 405f393bcac0 -r fb261afd49cd web/views/cwuser.py --- a/web/views/cwuser.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/cwuser.py Wed Sep 23 09:54:25 2009 +0200 @@ -17,7 +17,7 @@ uicfg.primaryview_section.tag_attribute(('CWUser', 'login'), 'hidden') class UserPreferencesEntityAction(action.Action): - id = 'prefs' + __regid__ = 'prefs' __select__ = (one_line_rset() & implements('CWUser') & match_user_groups('owners', 'managers')) @@ -30,7 +30,7 @@ class FoafView(EntityView): - id = 'foaf' + __regid__ = 'foaf' __select__ = implements('CWUser') title = _('foaf') diff -r 405f393bcac0 -r fb261afd49cd web/views/debug.py --- a/web/views/debug.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/debug.py Wed Sep 23 09:54:25 2009 +0200 @@ -26,7 +26,7 @@ class DebugView(StartupView): - id = 'debug' + __regid__ = 'debug' __select__ = none_rset() & match_user_groups('managers') title = _('server debug information') @@ -60,3 +60,27 @@ w(u'') else: w(u'

no web sessions found

') + + +class RegistryView(StartupView): + __regid__ = 'registry' + __select__ = StartupView.__select__ & match_user_groups('managers') + title = _('registry') + + def call(self, **kwargs): + """The default view representing the instance's management""" + self.w(u'

%s

' % _("Registry's content")) + keys = sorted(self.vreg) + self.w(u'

%s

\n' % ' - '.join('%s' + % (key, key) for key in keys)) + for key in keys: + self.w(u'

%s

' % (key,key)) + items = self.vreg[key].items() + if items: + self.w(u'') + for key, value in sorted(items): + self.w(u'' + % (key, xml_escape(repr(value)))) + self.w(u'
%s%s
\n') + else: + self.w(u'

Empty

\n') diff -r 405f393bcac0 -r fb261afd49cd web/views/editcontroller.py --- a/web/views/editcontroller.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/editcontroller.py Wed Sep 23 09:54:25 2009 +0200 @@ -49,7 +49,7 @@ return rql class EditController(ViewController): - id = 'edit' + __regid__ = 'edit' def publish(self, rset=None): """edit / create / copy / delete entity / relations""" diff -r 405f393bcac0 -r fb261afd49cd web/views/editforms.py --- a/web/views/editforms.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/editforms.py Wed Sep 23 09:54:25 2009 +0200 @@ -45,7 +45,7 @@ class DeleteConfForm(forms.CompositeForm): - id = 'deleteconf' + __regid__ = 'deleteconf' __select__ = non_final_entity() domid = 'deleteconf' @@ -70,7 +70,7 @@ class DeleteConfFormView(FormViewMixIn, EntityView): """form used to confirm deletion of some entities""" - id = 'deleteconf' + __regid__ = 'deleteconf' title = _('delete') # don't use navigation, all entities asked to be deleted should be displayed # else we will only delete the displayed page @@ -101,7 +101,7 @@ (double-click on the field to see an appropriate edition widget). """ - id = 'doreledit' + __regid__ = 'doreledit' __select__ = non_final_entity() & match_kwargs('rtype') # FIXME editableField class could be toggleable from userprefs @@ -262,7 +262,7 @@ """same as ClickAndEditFormView but checking if the view *should* be applied by checking uicfg configuration and composite relation property. """ - id = 'reledit' + __regid__ = 'reledit' def should_edit_relation(self, entity, rschema, role, rvid): eschema = entity.e_schema @@ -282,7 +282,7 @@ class EditionFormView(FormViewMixIn, EntityView): """display primary entity edition form""" - id = 'edition' + __regid__ = 'edition' # add yes() so it takes precedence over deprecated views in baseforms, # though not baseforms based customized view __select__ = one_line_rset() & non_final_entity() & yes() @@ -319,7 +319,7 @@ class CreationFormView(EditionFormView): """display primary entity creation form""" - id = 'creation' + __regid__ = 'creation' __select__ = specified_etype_implements('Any') & yes() title = _('creation') @@ -369,7 +369,7 @@ """display primary entity creation form initialized with values from another entity """ - id = 'copy' + __regid__ = 'copy' warning_message = _('Please note that this is only a shallow copy') def render_form(self, entity): @@ -405,7 +405,7 @@ class TableEditForm(forms.CompositeForm): - id = 'muledit' + __regid__ = 'muledit' domid = 'entityForm' onsubmit = "return validateForm('%s', null);" % domid form_buttons = [SubmitButton(_('validate modifications on selected items')), @@ -425,7 +425,7 @@ class TableEditFormView(FormViewMixIn, EntityView): - id = 'muledit' + __regid__ = 'muledit' __select__ = EntityView.__select__ & yes() title = _('multiple edit') @@ -439,7 +439,7 @@ class InlineEntityEditionFormView(FormViewMixIn, EntityView): - id = 'inline-edition' + __regid__ = 'inline-edition' __select__ = non_final_entity() & match_kwargs('peid', 'rtype') removejs = "removeInlinedEntity('%s', '%s', '%s')" @@ -500,7 +500,7 @@ class InlineEntityCreationFormView(InlineEntityEditionFormView): - id = 'inline-creation' + __regid__ = 'inline-creation' __select__ = (match_kwargs('peid', 'rtype') & specified_etype_implements('Any')) removejs = "removeInlineForm('%s', '%s', '%s')" diff -r 405f393bcac0 -r fb261afd49cd web/views/editviews.py --- a/web/views/editviews.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/editviews.py Wed Sep 23 09:54:25 2009 +0200 @@ -27,7 +27,7 @@ """view called by the edition view when the user asks to search for something to link to the edited eid """ - id = 'search-associate' + __regid__ = 'search-associate' __select__ = (one_line_rset() & match_search_state('linksearch') & non_final_entity()) @@ -58,7 +58,7 @@ class OutOfContextSearch(EntityView): - id = 'outofcontext-search' + __regid__ = 'outofcontext-search' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) erset = entity.as_rset() @@ -74,7 +74,7 @@ class UnrelatedDivs(EntityView): - id = 'unrelateddivs' + __regid__ = 'unrelateddivs' __select__ = match_form_params('relation') def cell_call(self, row, col): @@ -184,7 +184,7 @@ THIS IS A TEXT VIEW. DO NOT HTML_ESCAPE """ - id = 'combobox' + __regid__ = 'combobox' title = None def cell_call(self, row, col): @@ -196,7 +196,7 @@ class EditableFinalView(FinalView): """same as FinalView but enables inplace-edition when possible""" - id = 'editable-final' + __regid__ = 'editable-final' def cell_call(self, row, col, props=None): entity, rtype = self.rset.related_entity(row, col) diff -r 405f393bcac0 -r fb261afd49cd web/views/emailaddress.py --- a/web/views/emailaddress.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/emailaddress.py Wed Sep 23 09:54:25 2009 +0200 @@ -55,7 +55,7 @@ class EmailAddressShortPrimaryView(EmailAddressPrimaryView): __select__ = implements('EmailAddress') - id = 'shortprimary' + __regid__ = 'shortprimary' title = None # hidden view def render_entity_attributes(self, entity): @@ -85,7 +85,7 @@ """A one line view that builds a user clickable URL for an email with 'mailto:'""" - id = 'mailto' + __regid__ = 'mailto' __select__ = implements('EmailAddress') def cell_call(self, row, col, **kwargs): diff -r 405f393bcac0 -r fb261afd49cd web/views/embedding.py --- a/web/views/embedding.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/embedding.py Wed Sep 23 09:54:25 2009 +0200 @@ -29,7 +29,7 @@ class ExternalTemplate(basetemplates.TheMainTemplate): """template embeding an external web pages into CubicWeb web interface """ - id = 'external' + __regid__ = 'external' def call(self, body): # XXX fallback to HTML 4 mode when embeding ? @@ -44,7 +44,7 @@ class EmbedController(Controller): - id = 'embed' + __regid__ = 'embed' template = 'external' def publish(self, rset=None): @@ -92,7 +92,7 @@ """display an 'embed' link on entity implementing `embeded_url` method if the returned url match embeding configuration """ - id = 'embed' + __regid__ = 'embed' __select__ = (one_line_rset() & match_search_state('normal') & implements(IEmbedable) & score_entity(entity_has_embedable_url)) diff -r 405f393bcac0 -r fb261afd49cd web/views/error.py --- a/web/views/error.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/error.py Wed Sep 23 09:54:25 2009 +0200 @@ -11,7 +11,7 @@ from cubicweb.view import StartupView class FourOhFour(StartupView): - id = '404' + __regid__ = '404' def call(self): _ = self.req._ @@ -19,7 +19,7 @@ class ErrorOccured(StartupView): - id = '500' + __regid__ = '500' def call(self): _ = self.req._ diff -r 405f393bcac0 -r fb261afd49cd web/views/facets.py --- a/web/views/facets.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/facets.py Wed Sep 23 09:54:25 2009 +0200 @@ -29,7 +29,7 @@ class FilterBox(BoxTemplate): """filter results of a query""" - id = 'filter_box' + __regid__ = 'filter_box' __select__ = (((non_final_entity() & two_lines_rset()) | contextview_selector() ) & match_context_prop()) @@ -125,23 +125,23 @@ # facets ###################################################################### class CreatedByFacet(RelationFacet): - id = 'created_by-facet' + __regid__ = 'created_by-facet' rtype = 'created_by' target_attr = 'login' class InGroupFacet(RelationFacet): - id = 'in_group-facet' + __regid__ = 'in_group-facet' rtype = 'in_group' target_attr = 'name' class InStateFacet(RelationFacet): - id = 'in_state-facet' + __regid__ = 'in_state-facet' rtype = 'in_state' target_attr = 'name' # inherit from RelationFacet to benefit from its possible_values implementation class ETypeFacet(RelationFacet): - id = 'etype-facet' + __regid__ = 'etype-facet' __select__ = yes() order = 1 rtype = 'is' @@ -182,7 +182,7 @@ class HasTextFacet(AbstractFacet): __select__ = relation_possible('has_text', 'subject') & match_context_prop() - id = 'has_text-facet' + __regid__ = 'has_text-facet' rtype = 'has_text' role = 'subject' order = 0 diff -r 405f393bcac0 -r fb261afd49cd web/views/formrenderers.py --- a/web/views/formrenderers.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/formrenderers.py Wed Sep 23 09:54:25 2009 +0200 @@ -39,7 +39,7 @@ +---------+ """ __registry__ = 'formrenderers' - id = 'default' + __regid__ = 'default' _options = ('display_fields', 'display_label', 'display_help', 'display_progress_div', 'table_class', 'button_bar_class', @@ -244,7 +244,7 @@ """use form_renderer_id = 'base' if you want base FormRenderer layout even when selected for an entity """ - id = 'base' + __regid__ = 'base' class EntityBaseFormRenderer(BaseFormRenderer): @@ -271,7 +271,7 @@ | field1 input | field2 input | buttons +--------------+--------------+---------+ """ - id = 'htable' + __regid__ = 'htable' display_help = False def _render_fields(self, fields, w, form): @@ -308,7 +308,7 @@ class EntityCompositeFormRenderer(FormRenderer): """specific renderer for multiple entities edition form (muledit)""" - id = 'composite' + __regid__ = 'composite' _main_display_fields = None @@ -368,7 +368,7 @@ class EntityFormRenderer(EntityBaseFormRenderer): """specific renderer for entity edition form (edition)""" - id = 'default' + __regid__ = 'default' # needs some additional points in some case (XXX explain cases) __select__ = EntityBaseFormRenderer.__select__ & yes() @@ -528,7 +528,7 @@ """specific renderer for entity inlined edition form (inline-[creation|edition]) """ - id = 'inline' + __regid__ = 'inline' def render(self, form, values): form.add_media() diff -r 405f393bcac0 -r fb261afd49cd web/views/forms.py --- a/web/views/forms.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/forms.py Wed Sep 23 09:54:25 2009 +0200 @@ -54,7 +54,7 @@ * `fieldsets_in_order`: fieldset name sequence, to control order """ - id = 'base' + __regid__ = 'base' is_subform = False internal_fields = ('__errorurl',) + NAV_FORM_PARAMETERS @@ -291,7 +291,7 @@ class EntityFieldsForm(FieldsForm): - id = 'base' + __regid__ = 'base' __select__ = (match_kwargs('entity') | (one_line_rset() & non_final_entity())) @@ -557,7 +557,7 @@ class CompositeForm(FieldsForm): """form composed of sub-forms""" - id = 'composite' + __regid__ = 'composite' form_renderer_id = id def __init__(self, *args, **kwargs): @@ -572,7 +572,7 @@ class CompositeEntityForm(EntityFieldsForm): """form composed of sub-forms""" - id = 'composite' + __regid__ = 'composite' form_renderer_id = id def __init__(self, *args, **kwargs): diff -r 405f393bcac0 -r fb261afd49cd web/views/ibreadcrumbs.py --- a/web/views/ibreadcrumbs.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/ibreadcrumbs.py Wed Sep 23 09:54:25 2009 +0200 @@ -20,7 +20,7 @@ class BreadCrumbEntityVComponent(Component): - id = 'breadcrumbs' + __regid__ = 'breadcrumbs' __select__ = one_line_rset() & implements(IBreadCrumbs) property_defs = { @@ -94,7 +94,7 @@ class BreadCrumbView(EntityView): - id = 'breadcrumbs' + __regid__ = 'breadcrumbs' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) @@ -105,7 +105,7 @@ class BreadCrumbTextView(EntityView): - id = 'breadcrumbtext' + __regid__ = 'breadcrumbtext' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) diff -r 405f393bcac0 -r fb261afd49cd web/views/idownloadable.py --- a/web/views/idownloadable.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/idownloadable.py Wed Sep 23 09:54:25 2009 +0200 @@ -42,7 +42,7 @@ class DownloadBox(EntityBoxTemplate): - id = 'download_box' + __regid__ = 'download_box' # no download box for images # XXX primary_view selector ? __select__ = (one_line_rset() & implements(IDownloadable) & @@ -58,7 +58,7 @@ """this view is replacing the deprecated 'download' controller and allow downloading of entities providing the necessary interface """ - id = 'download' + __regid__ = 'download' __select__ = one_line_rset() & implements(IDownloadable) templatable = False @@ -85,7 +85,7 @@ class DownloadLinkView(EntityView): """view displaying a link to download the file""" - id = 'downloadlink' + __regid__ = 'downloadlink' __select__ = implements(IDownloadable) title = None # should not be listed in possible views @@ -132,7 +132,7 @@ class ImageView(EntityView): - id = 'image' + __regid__ = 'image' __select__ = implements(IDownloadable) & score_entity(is_image) title = _('image') diff -r 405f393bcac0 -r fb261afd49cd web/views/igeocodable.py --- a/web/views/igeocodable.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/igeocodable.py Wed Sep 23 09:54:25 2009 +0200 @@ -14,13 +14,13 @@ from cubicweb.selectors import implements class GeocodingJsonView(EntityView): - id = 'geocoding-json' + __regid__ = 'geocoding-json' + __select__ = implements(IGeocodable) + binary = True templatable = False content_type = 'application/json' - __select__ = implements(IGeocodable) - def call(self): # remove entities that don't define latitude and longitude self.rset = self.rset.filtered_rset(lambda e: e.latitude and e.longitude) @@ -57,8 +57,7 @@ class GoogleMapBubbleView(EntityView): - id = 'gmap-bubble' - + __regid__ = 'gmap-bubble' __select__ = implements(IGeocodable) def cell_call(self, row, col): @@ -68,9 +67,9 @@ class GoogleMapsView(EntityView): - id = 'gmap-view' + __regid__ = 'gmap-view' + __select__ = implements(IGeocodable) - __select__ = implements(IGeocodable) need_navigation = False def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None): @@ -91,7 +90,7 @@ class GoogeMapsLegend(EntityView): - id = 'gmap-legend' + __regid__ = 'gmap-legend' def call(self): self.w(u'
    ') diff -r 405f393bcac0 -r fb261afd49cd web/views/iprogress.py --- a/web/views/iprogress.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/iprogress.py Wed Sep 23 09:54:25 2009 +0200 @@ -34,7 +34,7 @@ header_for_COLNAME methods allow to customize header's label """ - id = 'progress_table_view' + __regid__ = 'progress_table_view' title = _('task progression') __select__ = implements(IMileStone) @@ -165,7 +165,7 @@ """this views redirects to ``progress_table_view`` but removes the ``project`` column """ - id = 'ic_progress_table_view' + __regid__ = 'ic_progress_table_view' def call(self, columns=None): view = self.vreg['views'].select('progress_table_view', self.req, @@ -180,7 +180,7 @@ class ProgressBarView(EntityView): """displays a progress bar""" - id = 'progressbar' + __regid__ = 'progressbar' title = _('progress bar') __select__ = implements(IProgress) diff -r 405f393bcac0 -r fb261afd49cd web/views/isioc.py --- a/web/views/isioc.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/isioc.py Wed Sep 23 09:54:25 2009 +0200 @@ -14,7 +14,7 @@ from cubicweb.interfaces import ISiocItem, ISiocContainer class SIOCView(EntityView): - id = 'sioc' + __regid__ = 'sioc' __select__ = EntityView.__select__ & implements(ISiocItem, ISiocContainer) title = _('sioc') templatable = False @@ -38,7 +38,7 @@ self.wview('sioc_element', self.rset, row=row, col=col) class SIOCContainerView(EntityView): - id = 'sioc_element' + __regid__ = 'sioc_element' __select__ = EntityView.__select__ & implements(ISiocContainer) templatable = False content_type = 'text/xml' @@ -59,7 +59,7 @@ class SIOCItemView(EntityView): - id = 'sioc_element' + __regid__ = 'sioc_element' __select__ = EntityView.__select__ & implements(ISiocItem) templatable = False content_type = 'text/xml' diff -r 405f393bcac0 -r fb261afd49cd web/views/magicsearch.py --- a/web/views/magicsearch.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/magicsearch.py Wed Sep 23 09:54:25 2009 +0200 @@ -15,7 +15,7 @@ from rql import RQLSyntaxError, BadRQLQuery, parse from rql.nodes import Relation -from cubicweb import Unauthorized +from cubicweb import Unauthorized, typed_eid from cubicweb.view import Component LOGGER = getLogger('cubicweb.magicsearch') @@ -135,7 +135,7 @@ class BaseQueryProcessor(Component): __abstract__ = True - id = 'magicsearch_processor' + __regid__ = 'magicsearch_processor' # set something if you want explicit component search facility for the # component name = None @@ -239,7 +239,7 @@ """ # if this is an integer, then directly go to eid try: - eid = int(word) + eid = typed_eid(word) return 'Any X WHERE X eid %(x)s', {'x': eid}, 'x' except ValueError: etype = self._get_entity_type(word) diff -r 405f393bcac0 -r fb261afd49cd web/views/management.py --- a/web/views/management.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/management.py Wed Sep 23 09:54:25 2009 +0200 @@ -67,7 +67,7 @@ class SecurityManagementView(EntityView, SecurityViewMixIn): """display security information for a given entity""" - id = 'security' + __regid__ = 'security' __select__ = EntityView.__select__ & authenticated_user() title = _('security') @@ -191,7 +191,7 @@ class ErrorView(AnyRsetView): """default view when no result has been found""" __select__ = yes() - id = 'error' + __regid__ = 'error' def page_title(self): """returns a title according to the result set - used for the @@ -274,7 +274,7 @@ class ProcessInformationView(StartupView): - id = 'info' + __regid__ = 'info' __select__ = none_rset() & match_user_groups('users', 'managers') title = _('server information') diff -r 405f393bcac0 -r fb261afd49cd web/views/massmailing.py --- a/web/views/massmailing.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/massmailing.py Wed Sep 23 09:54:25 2009 +0200 @@ -22,7 +22,7 @@ class SendEmailAction(Action): - id = 'sendemail' + __regid__ = 'sendemail' # XXX should check email is set as well __select__ = implements(IEmailable) & match_user_groups('managers', 'users') @@ -38,7 +38,7 @@ class MassMailingForm(forms.FieldsForm): - id = 'massmailing' + __regid__ = 'massmailing' sender = StringField(widget=TextInput({'disabled': 'disabled'}), label=_('From:')) recipient = StringField(widget=CheckBox(), label=_('Recipients:')) @@ -82,7 +82,7 @@ class MassMailingFormRenderer(formrenderers.FormRenderer): - id = 'massmailing' + __regid__ = 'massmailing' button_bar_class = u'toolbar' def _render_fields(self, fields, w, form): @@ -118,7 +118,7 @@ pass class MassMailingFormView(FormViewMixIn, EntityView): - id = 'massmailing' + __regid__ = 'massmailing' __select__ = implements(IEmailable) & match_user_groups('managers', 'users') def call(self): diff -r 405f393bcac0 -r fb261afd49cd web/views/navigation.py --- a/web/views/navigation.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/navigation.py Wed Sep 23 09:54:25 2009 +0200 @@ -177,7 +177,7 @@ View.paginate = paginate class NextPrevNavigationComponent(EntityVComponent): - id = 'prevnext' + __regid__ = 'prevnext' # register msg not generated since no entity implements IPrevNext in cubicweb # itself title = _('contentnavigation_prevnext') diff -r 405f393bcac0 -r fb261afd49cd web/views/old_calendar.py --- a/web/views/old_calendar.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/old_calendar.py Wed Sep 23 09:54:25 2009 +0200 @@ -162,7 +162,7 @@ class YearCalendarView(_CalendarView): - id = 'calendaryear' + __regid__ = 'calendaryear' title = _('calendar (year)') def call(self, year=None, month=None): @@ -181,7 +181,7 @@ """this view renders three semesters as three rows of six columns, one column per month """ - id = 'calendarsemester' + __regid__ = 'calendarsemester' title = _('calendar (semester)') def call(self, year=None, month=None): @@ -229,7 +229,7 @@ class MonthCalendarView(_CalendarView): """this view renders a 3x1 calendars' table""" - id = 'calendarmonth' + __regid__ = 'calendarmonth' title = _('calendar (month)') def call(self, year=None, month=None): @@ -246,7 +246,7 @@ class WeekCalendarView(_CalendarView): """this view renders a calendar for week events""" - id = 'calendarweek' + __regid__ = 'calendarweek' title = _('calendar (week)') def call(self, year=None, week=None): @@ -303,7 +303,7 @@ class AMPMYearCalendarView(YearCalendarView): - id = 'ampmcalendaryear' + __regid__ = 'ampmcalendaryear' title = _('am/pm calendar (year)') def build_calendar(self, schedule, first_day): @@ -357,7 +357,7 @@ class AMPMSemesterCalendarView(SemesterCalendarView): """this view renders a 3x1 calendars' table""" - id = 'ampmcalendarsemester' + __regid__ = 'ampmcalendarsemester' title = _('am/pm calendar (semester)') def build_calendars(self, schedule, begin, end): @@ -394,7 +394,7 @@ class AMPMMonthCalendarView(MonthCalendarView): """this view renders a 3x1 calendars' table""" - id = 'ampmcalendarmonth' + __regid__ = 'ampmcalendarmonth' title = _('am/pm calendar (month)') def build_calendar(self, schedule, first_day): @@ -450,7 +450,7 @@ class AMPMWeekCalendarView(WeekCalendarView): """this view renders a 3x1 calendars' table""" - id = 'ampmcalendarweek' + __regid__ = 'ampmcalendarweek' title = _('am/pm calendar (week)') def build_calendar(self, schedule, weeks): diff -r 405f393bcac0 -r fb261afd49cd web/views/owl.py --- a/web/views/owl.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/owl.py Wed Sep 23 09:54:25 2009 +0200 @@ -58,7 +58,7 @@ class OWLView(StartupView): """This view export in owl format schema database. It is the TBOX""" - id = 'owl' + __regid__ = 'owl' title = _('owl') templatable = False content_type = 'application/xml' # 'text/xml' @@ -145,7 +145,7 @@ class OWLABOXView(EntityView): '''This view represents a part of the ABOX for a given entity.''' - id = 'owlabox' + __regid__ = 'owlabox' title = _('owlabox') templatable = False content_type = 'application/xml' # 'text/xml' @@ -162,7 +162,7 @@ class OWLABOXItemView(EntityView): '''This view represents a part of the ABOX for a given entity.''' - id = 'owlaboxitem' + __regid__ = 'owlaboxitem' templatable = False content_type = 'application/xml' # 'text/xml' @@ -201,7 +201,7 @@ class DownloadOWLSchemaAction(Action): - id = 'download_as_owl' + __regid__ = 'download_as_owl' __select__ = none_rset() & match_view('schema') category = 'mainactions' diff -r 405f393bcac0 -r fb261afd49cd web/views/primary.py --- a/web/views/primary.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/primary.py Wed Sep 23 09:54:25 2009 +0200 @@ -20,7 +20,7 @@ class PrimaryView(EntityView): """the full view of an non final entity""" - id = 'primary' + __regid__ = 'primary' title = _('primary') show_attr_label = True show_rel_label = True @@ -204,7 +204,7 @@ class RelatedView(EntityView): - id = 'autolimited' + __regid__ = 'autolimited' def call(self, title=None, **kwargs): # if not too many entities, show them all in a list maxrelated = self.req.property_value('navigation.related-limit') diff -r 405f393bcac0 -r fb261afd49cd web/views/pyviews.py --- a/web/views/pyviews.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/pyviews.py Wed Sep 23 09:54:25 2009 +0200 @@ -11,7 +11,7 @@ from cubicweb.selectors import match_kwargs class PyValTableView(View): - id = 'pyvaltable' + __regid__ = 'pyvaltable' __select__ = match_kwargs('pyvalue') def call(self, pyvalue, headers=None): @@ -32,7 +32,7 @@ class PyValListView(View): - id = 'pyvallist' + __regid__ = 'pyvallist' __select__ = match_kwargs('pyvalue') def call(self, pyvalue): diff -r 405f393bcac0 -r fb261afd49cd web/views/schema.py --- a/web/views/schema.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/schema.py Wed Sep 23 09:54:25 2009 +0200 @@ -37,7 +37,7 @@ # global schema view ########################################################### class SchemaView(tabs.TabsMixin, StartupView): - id = 'schema' + __regid__ = 'schema' title = _('instance schema') tabs = [_('schema-text'), _('schema-image')] default_tab = 'schema-text' @@ -51,7 +51,7 @@ class SchemaTabImageView(StartupView): - id = 'schema-image' + __regid__ = 'schema-image' def call(self): self.w(_(u'
    This schema of the data model excludes the ' @@ -64,7 +64,7 @@ class SchemaTabTextView(StartupView): - id = 'schema-text' + __regid__ = 'schema-text' def call(self): rset = self.req.execute('Any X ORDERBY N WHERE X is CWEType, X name N, ' @@ -73,7 +73,7 @@ class ManagerSchemaPermissionsView(StartupView, management.SecurityViewMixIn): - id = 'schema-security' + __regid__ = 'schema-security' __select__ = StartupView.__select__ & match_user_groups('managers') def call(self, display_relations=True): @@ -173,7 +173,7 @@ class SchemaUreportsView(StartupView): - id = 'schema-block' + __regid__ = 'schema-block' def call(self): viewer = SchemaViewer(self.req) @@ -224,7 +224,7 @@ class CWETypeSTextView(EntityView): - id = 'cwetype-schema-text' + __regid__ = 'cwetype-schema-text' __select__ = EntityView.__select__ & implements('CWEType') def cell_call(self, row, col): @@ -260,7 +260,7 @@ class CWETypeSImageView(EntityView): - id = 'cwetype-schema-image' + __regid__ = 'cwetype-schema-image' __select__ = EntityView.__select__ & implements('CWEType') def cell_call(self, row, col): @@ -272,7 +272,7 @@ class CWETypeSPermView(EntityView): - id = 'cwetype-schema-permissions' + __regid__ = 'cwetype-schema-permissions' __select__ = EntityView.__select__ & implements('CWEType') def cell_call(self, row, col): @@ -300,7 +300,7 @@ class CWETypeSWorkflowView(EntityView): - id = 'cwetype-workflow' + __regid__ = 'cwetype-workflow' __select__ = (EntityView.__select__ & implements('CWEType') & has_related_entities('workflow_of', 'object')) @@ -372,7 +372,7 @@ class SchemaImageView(TmpFileViewMixin, StartupView): - id = 'schemagraph' + __regid__ = 'schemagraph' content_type = 'image/png' def _generate(self, tmpfile): @@ -384,7 +384,7 @@ class CWETypeSchemaImageView(TmpFileViewMixin, EntityView): - id = 'schemagraph' + __regid__ = 'schemagraph' __select__ = implements('CWEType') content_type = 'image/png' @@ -411,12 +411,12 @@ # misc: facets, actions ######################################################## class CWFinalFacet(facet.AttributeFacet): - id = 'cwfinal-facet' + __regid__ = 'cwfinal-facet' __select__ = facet.AttributeFacet.__select__ & implements('CWEType', 'CWRType') rtype = 'final' class ViewSchemaAction(action.Action): - id = 'schema' + __regid__ = 'schema' __select__ = yes() title = _("site schema") diff -r 405f393bcac0 -r fb261afd49cd web/views/sparql.py --- a/web/views/sparql.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/sparql.py Wed Sep 23 09:54:25 2009 +0200 @@ -23,7 +23,7 @@ Sparql2rqlTranslator = None class SparqlForm(forms.FieldsForm): - id = 'sparql' + __regid__ = 'sparql' sparql = formfields.StringField(help=_('type here a sparql query')) resultvid = formfields.StringField(choices=((_('table'), 'table'), (_('sparql xml'), 'sparqlxml')), @@ -36,7 +36,7 @@ class SparqlFormView(form.FormViewMixIn, StartupView): - id = 'sparql' + __regid__ = 'sparql' def call(self): form = self.vreg.select('forms', 'sparql', self.req) self.w(form.form_render()) @@ -81,7 +81,7 @@ class SparqlResultXmlView(AnyRsetView): """The spec can be found here: http://www.w3.org/TR/rdf-sparql-XMLres/ """ - id = 'sparqlxml' + __regid__ = 'sparqlxml' content_type = 'application/sparql-results+xml' templatable = False diff -r 405f393bcac0 -r fb261afd49cd web/views/startup.py --- a/web/views/startup.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/startup.py Wed Sep 23 09:54:25 2009 +0200 @@ -18,7 +18,7 @@ from cubicweb.web import ajax_replace_url, uicfg, httpcache class ManageView(StartupView): - id = 'manage' + __regid__ = 'manage' title = _('manage') http_cache_manager = httpcache.EtagHTTPCacheManager @@ -140,31 +140,9 @@ class IndexView(ManageView): - id = 'index' + __regid__ = 'index' title = _('view_index') def display_folders(self): return 'Folder' in self.schema and self.req.execute('Any COUNT(X) WHERE X is Folder')[0][0] - -class RegistryView(StartupView): - id = 'registry' - title = _('registry') - __select__ = StartupView.__select__ & match_user_groups('managers') - - def call(self, **kwargs): - """The default view representing the instance's management""" - self.w(u'

    %s

    ' % _("Registry's content")) - keys = sorted(self.vreg) - self.w(u'

    %s

    \n' % ' - '.join('%s' % (key, key) for key in keys)) - for key in keys: - self.w(u'

    %s

    ' % (key,key)) - items = self.vreg[key].items() - if items: - self.w(u'') - for key, value in sorted(items): - self.w(u'' % (key, xml_escape(repr(value)))) - self.w(u'
    %s%s
    \n') - else: - self.w(u'

    Empty

    \n') - diff -r 405f393bcac0 -r fb261afd49cd web/views/tableview.py --- a/web/views/tableview.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/tableview.py Wed Sep 23 09:54:25 2009 +0200 @@ -22,7 +22,7 @@ from cubicweb.web.facet import prepare_facets_rqlst, filter_hiddens class TableView(AnyRsetView): - id = 'table' + __regid__ = 'table' title = _('table') finalview = 'final' @@ -247,16 +247,15 @@ class EditableTableView(TableView): - id = 'editable-table' + __regid__ = 'editable-table' finalview = 'editable-final' title = _('editable-table') class CellView(EntityView): + __regid__ = 'cell' __select__ = nonempty_rset() - id = 'cell' - def cell_call(self, row, col, cellvid=None): """ :param row, col: indexes locating the cell value in view's result set @@ -287,7 +286,7 @@ * the actual query (`actualrql` form parameter) whose results will be displayed with default restrictions set """ - id = 'initialtable' + __regid__ = 'initialtable' __select__ = nonempty_rset() & match_form_params('actualrql') # should not be displayed in possible view since it expects some specific # parameters @@ -325,5 +324,5 @@ class EditableInitialTableTableView(InitialTableView): - id = 'editable-initialtable' + __regid__ = 'editable-initialtable' finalview = 'editable-final' diff -r 405f393bcac0 -r fb261afd49cd web/views/timeline.py --- a/web/views/timeline.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/timeline.py Wed Sep 23 09:54:25 2009 +0200 @@ -24,7 +24,7 @@ NOTE: work in progress (image_url, bubbleUrl and so on should be properties of entity classes or subviews) """ - id = 'timeline-json' + __regid__ = 'timeline-json' binary = True templatable = False content_type = 'application/json' @@ -102,7 +102,7 @@ class TimelineView(TimelineViewMixIn, EntityView): """builds a cubicweb timeline widget node""" - id = 'timeline' + __regid__ = 'timeline' title = _('timeline') __select__ = implements(ICalendarable) need_navigation = False @@ -117,7 +117,7 @@ """similar to `TimelineView` but loads data from a static JSON file instead of one after a RQL query. """ - id = 'static-timeline' + __regid__ = 'static-timeline' def call(self, loadurl, tlunit=None, wdgclass=None): self.widget_class = wdgclass or self.widget_class diff -r 405f393bcac0 -r fb261afd49cd web/views/timetable.py --- a/web/views/timetable.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/timetable.py Wed Sep 23 09:54:25 2009 +0200 @@ -24,7 +24,7 @@ MIN_COLS = 3 # minimum number of task columns for a single user class TimeTableView(AnyRsetView): - id = 'timetable' + __regid__ = 'timetable' title = _('timetable') __select__ = implements(ITimetableViews) need_navigation = False diff -r 405f393bcac0 -r fb261afd49cd web/views/treeview.py --- a/web/views/treeview.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/treeview.py Wed Sep 23 09:54:25 2009 +0200 @@ -20,7 +20,7 @@ return str('%s-treestate' % treeid) class TreeView(EntityView): - id = 'treeview' + __regid__ = 'treeview' itemvid = 'treeitemview' subvid = 'oneline' css_classes = 'treeview widget' @@ -74,7 +74,7 @@ class FileTreeView(TreeView): """specific version of the treeview to display file trees """ - id = 'filetree' + __regid__ = 'filetree' css_classes = 'treeview widget filetree' title = _('file tree view') @@ -88,7 +88,7 @@ This view adds an enclosing with some specific CSS classes around the oneline view. This is needed by the jquery treeview plugin. """ - id = 'filetree-oneline' + __regid__ = 'filetree-oneline' def cell_call(self, row, col): entity = self.rset.get_entity(row, col) @@ -101,7 +101,7 @@ class DefaultTreeViewItemView(EntityView): """default treeitem view for entities which don't implement ITree""" - id = 'treeitemview' + __regid__ = 'treeitemview' def cell_call(self, row, col, vid='oneline', parentvid='treeview', treeid=None): assert treeid is not None @@ -118,9 +118,9 @@ (each item should be expandable if it's not a tree leaf) """ - id = 'treeitemview' + __regid__ = 'treeitemview' + __select__ = EntityView.__select__ & implements(ITree) default_branch_state_is_open = False - __select__ = EntityView.__select__ & implements(ITree) def open_state(self, eeid, treeid): cookies = self.req.get_cookie() diff -r 405f393bcac0 -r fb261afd49cd web/views/urlpublishing.py --- a/web/views/urlpublishing.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/urlpublishing.py Wed Sep 23 09:54:25 2009 +0200 @@ -49,7 +49,7 @@ lower priority. The first evaluator returning a result or raising something else than `PathDontMatch` will stop the handlers chain. """ - id = 'urlpublisher' + __regid__ = 'urlpublisher' vreg = None # XXX necessary until property for deprecation warning is on appobject def __init__(self, vreg, default_method='view'): @@ -101,7 +101,7 @@ class URLPathEvaluator(component.Component): __abstract__ = True - id = 'urlpathevaluator' + __regid__ = 'urlpathevaluator' vreg = None # XXX necessary until property for deprecation warning is on appobject def __init__(self, urlpublisher): diff -r 405f393bcac0 -r fb261afd49cd web/views/urlrewrite.py --- a/web/views/urlrewrite.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/urlrewrite.py Wed Sep 23 09:54:25 2009 +0200 @@ -67,7 +67,7 @@ If the input uri is a regexp, group substitution is allowed """ - id = 'simple' + __regid__ = 'simple' rules = [ ('/_', dict(vid='manage')), @@ -179,7 +179,7 @@ """Here, the rules dict maps regexps or plain strings to callbacks that will be called with (input, uri, req, schema) """ - id = 'schemabased' + __regid__ = 'schemabased' rules = [ # rgxp : callback (rgx('/search/(.+)'), build_rset(rql=r'Any X WHERE X has_text %(text)s', diff -r 405f393bcac0 -r fb261afd49cd web/views/wdoc.py --- a/web/views/wdoc.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/wdoc.py Wed Sep 23 09:54:25 2009 +0200 @@ -87,7 +87,7 @@ class InlineHelpView(StartupView): __select__ = match_form_params('fid') - id = 'wdoc' + __regid__ = 'wdoc' title = _('site documentation') def call(self): @@ -163,7 +163,7 @@ class InlineHelpImageView(StartupView): - id = 'wdocimages' + __regid__ = 'wdocimages' __select__ = match_form_params('fid') binary = True templatable = False @@ -183,7 +183,7 @@ class ChangeLogView(StartupView): - id = 'changelog' + __regid__ = 'changelog' title = _('What\'s new?') maxentries = 25 diff -r 405f393bcac0 -r fb261afd49cd web/views/workflow.py --- a/web/views/workflow.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/workflow.py Wed Sep 23 09:54:25 2009 +0200 @@ -42,7 +42,7 @@ # IWorkflowable views ######################################################### class ChangeStateForm(forms.CompositeEntityForm): - id = 'changestate' + __regid__ = 'changestate' form_renderer_id = 'base' # don't want EntityFormRenderer form_buttons = [fwdgs.SubmitButton(stdmsgs.YES), @@ -50,7 +50,7 @@ class ChangeStateFormView(form.FormViewMixIn, view.EntityView): - id = 'statuschange' + __regid__ = 'statuschange' title = _('status change') __select__ = (one_line_rset() & implements(IWorkflowable) & match_form_params('treid')) @@ -88,7 +88,7 @@ class WFHistoryView(EntityView): - id = 'wfhistory' + __regid__ = 'wfhistory' __select__ = relation_possible('wf_info_for', role='object') title = _('Workflow history') @@ -121,7 +121,7 @@ class WFHistoryVComponent(component.EntityVComponent): """display the workflow history for entities supporting it""" - id = 'wfhistory' + __regid__ = 'wfhistory' __select__ = WFHistoryView.__select__ & component.EntityVComponent.__select__ context = 'navcontentbottom' title = _('Workflow history') @@ -134,7 +134,7 @@ class WorkflowActions(action.Action): """fill 'workflow' sub-menu of the actions box""" - id = 'workflow' + __regid__ = 'workflow' __select__ = (action.Action.__select__ & one_line_rset() & relation_possible('in_state')) @@ -166,7 +166,7 @@ # workflow entity types views ################################################## class CellView(view.EntityView): - id = 'cell' + __regid__ = 'cell' __select__ = implements('TrInfo') def cell_call(self, row, col, cellvid=None): @@ -175,7 +175,7 @@ class StateInContextView(view.EntityView): """convenience trick, State's incontext view should not be clickable""" - id = 'incontext' + __regid__ = 'incontext' __select__ = implements('State') def cell_call(self, row, col): @@ -250,9 +250,9 @@ class WorkflowImageView(TmpFileViewMixin, view.EntityView): - id = 'wfgraph' + __regid__ = 'wfgraph' + __select__ = implements('Workflow') content_type = 'image/png' - __select__ = implements('Workflow') def _generate(self, tmpfile): """display schema information for an entity""" diff -r 405f393bcac0 -r fb261afd49cd web/views/xbel.py --- a/web/views/xbel.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/xbel.py Wed Sep 23 09:54:25 2009 +0200 @@ -16,7 +16,7 @@ class XbelView(XMLView): - id = 'xbel' + __regid__ = 'xbel' title = _('xbel') templatable = False content_type = 'text/xml' #application/xbel+xml @@ -38,7 +38,7 @@ class XbelItemView(EntityView): - id = 'xbelitem' + __regid__ = 'xbelitem' def cell_call(self, row, col): entity = self.complete_entity(row, col) diff -r 405f393bcac0 -r fb261afd49cd web/views/xmlrss.py --- a/web/views/xmlrss.py Wed Sep 23 09:54:01 2009 +0200 +++ b/web/views/xmlrss.py Wed Sep 23 09:54:25 2009 +0200 @@ -22,7 +22,7 @@ class XMLView(EntityView): """xml view for entities""" - id = 'xml' + __regid__ = 'xml' title = _('xml') templatable = False content_type = 'text/xml' @@ -42,7 +42,7 @@ class XMLItemView(EntityView): - id = 'xmlitem' + __regid__ = 'xmlitem' def cell_call(self, row, col): """ element as an item for an xml feed """ @@ -67,7 +67,7 @@ class XMLRsetView(AnyRsetView): """dumps raw rset as xml""" - id = 'rsetxml' + __regid__ = 'rsetxml' title = _('xml export') templatable = False content_type = 'text/xml' @@ -105,7 +105,7 @@ # RSS stuff ################################################################### class RSSFeedURL(Component): - id = 'rss_feed_url' + __regid__ = 'rss_feed_url' __select__ = non_final_entity() def feed_url(self): @@ -113,7 +113,7 @@ class RSSEntityFeedURL(Component): - id = 'rss_feed_url' + __regid__ = 'rss_feed_url' __select__ = non_final_entity() & one_line_rset() def feed_url(self): @@ -122,7 +122,7 @@ class RSSIconBox(box.BoxTemplate): """just display the RSS icon on uniform result set""" - id = 'rss' + __regid__ = 'rss' __select__ = (box.BoxTemplate.__select__ & appobject_selectable('components', 'rss_feed_url')) @@ -142,7 +142,7 @@ class RSSView(XMLView): - id = 'rss' + __regid__ = 'rss' title = _('rss') templatable = False content_type = 'text/xml' @@ -178,7 +178,7 @@ class RSSItemView(EntityView): - id = 'rssitem' + __regid__ = 'rssitem' date_format = '%%Y-%%m-%%dT%%H:%%M%+03i:00' % (timezone / 3600) add_div_section = False