# HG changeset patch # User Sylvain Thénault # Date 1281449100 -7200 # Node ID b0975c6f2e449063534fc6919a66177a83622dc1 # Parent 57933567146f08c3dcf52ac0caf812fec98a8992# Parent 28f49a4fe702cdc3c83edb4a1fc7566889de7a68 backport stable diff -r 57933567146f -r b0975c6f2e44 cwconfig.py --- a/cwconfig.py Tue Aug 10 08:39:06 2010 +0200 +++ b/cwconfig.py Tue Aug 10 16:05:00 2010 +0200 @@ -742,7 +742,7 @@ # XXX extrapath argument to load_module_from_file only in lgc > 0.50.2 from logilab.common.modutils import load_module_from_modpath, modpath_from_file module = load_module_from_modpath(modpath_from_file(sitefile, self.extrapath)) - self.info('%s loaded', sitefile) + self.debug('%s loaded', sitefile) return module def eproperty_definitions(self): diff -r 57933567146f -r b0975c6f2e44 entity.py --- a/entity.py Tue Aug 10 08:39:06 2010 +0200 +++ b/entity.py Tue Aug 10 16:05:00 2010 +0200 @@ -456,11 +456,15 @@ def cw_has_perm(self, action): return self.e_schema.has_perm(self._cw, action, eid=self.eid) - def view(self, __vid, __registry='views', w=None, **kwargs): # XXX cw_view + def view(self, __vid, __registry='views', w=None, initargs=None, **kwargs): # XXX cw_view """shortcut to apply a view on this entity""" + if initargs is None: + initargs = kwargs + else: + initargs.update(kwargs) view = self._cw.vreg[__registry].select(__vid, self._cw, rset=self.cw_rset, row=self.cw_row, col=self.cw_col, - **kwargs) + **initargs) return view.render(row=self.cw_row, col=self.cw_col, w=w, **kwargs) def absolute_url(self, *args, **kwargs): # XXX cw_url diff -r 57933567146f -r b0975c6f2e44 server/schemaserial.py --- a/server/schemaserial.py Tue Aug 10 08:39:06 2010 +0200 +++ b/server/schemaserial.py Tue Aug 10 16:05:00 2010 +0200 @@ -152,6 +152,8 @@ for etype, stype in session.execute( 'Any XN, ETN WHERE X is CWEType, X name XN, X specializes ET, ET name ETN', build_descr=False): + etype = ETYPE_NAME_MAP.get(etype, etype) + stype = ETYPE_NAME_MAP.get(stype, stype) schema.eschema(etype)._specialized_type = stype schema.eschema(stype)._specialized_by.append(etype) for eid, rtype, desc, sym, il, ftc in session.execute( diff -r 57933567146f -r b0975c6f2e44 web/request.py --- a/web/request.py Tue Aug 10 08:39:06 2010 +0200 +++ b/web/request.py Tue Aug 10 16:05:00 2010 +0200 @@ -27,6 +27,7 @@ from datetime import date from urlparse import urlsplit from itertools import count +from warnings import warn from rql.utils import rqlvar_maker @@ -383,7 +384,6 @@ try: ret = func(req, *args) except TypeError: - from warnings import warn warn('[3.2] user callback should now take request as argument') ret = func(*args) self.unregister_callback(self.pageid, cbname) diff -r 57933567146f -r b0975c6f2e44 web/views/primary.py --- a/web/views/primary.py Tue Aug 10 08:39:06 2010 +0200 +++ b/web/views/primary.py Tue Aug 10 16:05:00 2010 +0200 @@ -131,7 +131,8 @@ for rschema, _, role, dispctrl in self._section_def(entity, 'attributes'): vid = dispctrl.get('vid', 'reledit') if rschema.final or vid == 'reledit' or dispctrl.get('rtypevid'): - value = entity.view(vid, rtype=rschema.type, role=role) + value = entity.view(vid, rtype=rschema.type, role=role, + initargs={'dispctrl': dispctrl}) else: rset = self._relation_rset(entity, rschema, role, dispctrl) if rset: @@ -159,6 +160,16 @@ def render_entity_relations(self, entity): for rschema, tschemas, role, dispctrl in self._section_def(entity, 'relations'): + if rschema.final: + self.w(u'
') + label = self._rel_label(entity, rschema, role, dispctrl) + if label: + self.w(u'

%s

' % label) + vid = dispctrl.get('vid', 'reledit') + entity.view(vid, rtype=rschema.type, role=role, w=self.w, + initargs={'dispctrl': dispctrl}) + self.w(u'
') + continue rset = self._relation_rset(entity, rschema, role, dispctrl) if rset: if support_args(self._render_relation, 'label'): diff -r 57933567146f -r b0975c6f2e44 web/views/pyviews.py --- a/web/views/pyviews.py Tue Aug 10 08:39:06 2010 +0200 +++ b/web/views/pyviews.py Tue Aug 10 16:05:00 2010 +0200 @@ -15,14 +15,14 @@ # # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . -"""Views to display bare python values - +"""Basic views for python values (eg without any result set) """ __docformat__ = "restructuredtext en" from cubicweb.view import View from cubicweb.selectors import match_kwargs + class PyValTableView(View): __regid__ = 'pyvaltable' __select__ = match_kwargs('pyvalue') diff -r 57933567146f -r b0975c6f2e44 web/views/schema.py --- a/web/views/schema.py Tue Aug 10 08:39:06 2010 +0200 +++ b/web/views/schema.py Tue Aug 10 16:05:00 2010 +0200 @@ -113,7 +113,7 @@ perms = {} for rdef in rschema.rdefs.itervalues(): rdef_perms = [] - for action in ('read', 'add', 'delete'): + for action in rdef.ACTIONS: groups = sorted(rdef.get_groups(action)) exprs = sorted(e.expression for e in rdef.get_rqlexprs(action)) rdef_perms.append( (action, (tuple(groups), tuple(exprs))) ) diff -r 57933567146f -r b0975c6f2e44 web/views/tabs.py --- a/web/views/tabs.py Tue Aug 10 08:39:06 2010 +0200 +++ b/web/views/tabs.py Tue Aug 10 16:05:00 2010 +0200 @@ -55,18 +55,20 @@ urlparams['rql'] = uilib.rql_for_eid(eid) elif rset: urlparams['rql'] = rset.printable_rql() + if tabid is None: + tabid = uilib.domid(vid) w(u'
' % ( - tabid or vid, xml_escape(self._cw.build_url('json', **urlparams)))) + tabid, xml_escape(self._cw.build_url('json', **urlparams)))) if show_spinbox: w(u'%s' - % (tabid or vid, self._cw._('(loading ...)'))) + % (tabid, self._cw._('(loading ...)'))) else: - w(u'
' % (tabid or vid)) + w(u'
' % tabid) w(u'' - % (tabid or vid, xml_escape(self._cw.build_url(**urlparams)), xml_escape('%s (%s)') % - (tabid or vid, self._cw._('follow this link if javascript is deactivated')))) + % (tabid, xml_escape(self._cw.build_url(**urlparams)), xml_escape('%s (%s)') % + (tabid, self._cw._('follow this link if javascript is deactivated')))) w(u'
') - self._prepare_bindings(tabid or vid, reloadable) + self._prepare_bindings(tabid, reloadable) def forceview(self, vid): """trigger an event that will force immediate loading of the view @@ -91,15 +93,16 @@ cookiename = self.cookie_name activetab = cookies.get(cookiename) if activetab is None: - cookies[cookiename] = default + domid = uilib.domid(default) + cookies[cookiename] = domid self._cw.set_cookie(cookies, cookiename) - return default + return domid return activetab.value def prune_tabs(self, tabs, default_tab): selected_tabs = [] may_be_active_tab = self.active_tab(default_tab) - active_tab = default_tab + active_tab = uilib.domid(default_tab) viewsvreg = self._cw.vreg['views'] for tab in tabs: try: @@ -109,13 +112,14 @@ tabid, tabkwargs = tab, {} tabkwargs.setdefault('rset', self.cw_rset) vid = tabkwargs.get('vid', tabid) + domid = uilib.domid(tabid) try: viewsvreg.select(vid, self._cw, **tabkwargs) - selected_tabs.append((tabid, tabkwargs)) except NoSelectableObject: continue - if tabid == may_be_active_tab: - active_tab = tabid + selected_tabs.append((tabid, domid, tabkwargs)) + if domid == may_be_active_tab: + active_tab = domid return selected_tabs, active_tab def render_tabs(self, tabs, default, entity=None): @@ -135,21 +139,21 @@ w(u'
' % uid) w(u'') w(u'
') - for tabid, tabkwargs in tabs: - w(u'
' % tabid) - tabkwargs.setdefault('tabid', tabid) + for tabid, domid, tabkwargs in tabs: + w(u'
' % domid) + tabkwargs.setdefault('tabid', domid) tabkwargs.setdefault('vid', tabid) tabkwargs.setdefault('rset', self.cw_rset) self.lazyview(**tabkwargs) @@ -159,9 +163,9 @@ # XXX make work history: true self._cw.add_onload(u""" jQuery('#entity-tabs-%(eeid)s > ul').tabs( { selected: %(tabindex)s }); - set_tab('%(vid)s', '%(cookiename)s'); + set_tab('%(domid)s', '%(cookiename)s'); """ % {'tabindex' : active_tab_idx, - 'vid' : active_tab, + 'domid' : active_tab, 'eeid' : (entity and entity.eid or uid), 'cookiename' : self.cookie_name})