backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 27 Jul 2010 12:37:27 +0200
changeset 6020 6f3b4f20ee9f
parent 6015 ee76e8e72776 (current diff)
parent 6019 373a313ee9ec (diff)
child 6026 0211cfb76071
backport stable
web/views/debug.py
--- a/cwvreg.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/cwvreg.py	Tue Jul 27 12:37:27 2010 +0200
@@ -616,7 +616,7 @@
                                    or iface
                                    for iface in ifaces)
                 if not ('Any' in ifaces or ifaces & implemented_interfaces):
-                    self.debug('kicking appobject %s (no implemented '
+                    self.debug('unregister %s (no implemented '
                                'interface among %s)', obj, ifaces)
                     self.unregister(obj)
             # since 3.9: remove appobjects which depending on other, unexistant
@@ -625,14 +625,14 @@
                 try:
                     registry = self[regname]
                 except RegistryNotFound:
-                    self.debug('kicking %s (no registry %s)', obj, regname)
+                    self.debug('unregister %s (no registry %s)', obj, regname)
                     self.unregister(obj)
                     continue
                 for regid in regids:
                     if registry.get(regid):
                         break
                 else:
-                    self.debug('kicking %s (no %s object in registry %s)',
+                    self.debug('unregister %s (no %s object in registry %s)',
                                obj, ' or '.join(regids), regname)
                     self.unregister(obj)
         super(CubicWebVRegistry, self).initialization_completed()
--- a/schema.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/schema.py	Tue Jul 27 12:37:27 2010 +0200
@@ -15,9 +15,8 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""classes to define schemas for CubicWeb
+"""classes to define schemas for CubicWeb"""
 
-"""
 __docformat__ = "restructuredtext en"
 _ = unicode
 
--- a/server/sources/native.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/server/sources/native.py	Tue Jul 27 12:37:27 2010 +0200
@@ -1449,7 +1449,7 @@
         two queries are needed since passwords are stored crypted, so we have
         to fetch the salt first
         """
-        args = {'login': login, 'pwd' : password}
+        args = {'login': login, 'pwd' : None}
         if password is not None:
             rset = self.source.syntax_tree_search(session, self._passwd_rqlst, args)
             try:
--- a/vregistry.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/vregistry.py	Tue Jul 27 12:37:27 2010 +0200
@@ -372,7 +372,7 @@
         for registryname in class_registries(obj, registryname):
             registry = self.setdefault(registryname)
             registry.register(obj, oid=oid, clear=clear)
-            self.debug('registered appobject %s in registry %s with id %s',
+            self.debug('register %s in %s[\'%s\']',
                        vname, registryname, oid or class_regid(obj))
         self._loadedmods.setdefault(obj.__module__, {})[classid(obj)] = obj
 
--- a/web/box.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/web/box.py	Tue Jul 27 12:37:27 2010 +0200
@@ -165,7 +165,8 @@
         role = get_role(self)
         self.w(u'<div class="sideBox">')
         self.wview('sidebox', entity.related(self.rtype, role, limit=limit),
-                   title=display_name(self._cw, self.rtype, role))
+                   title=display_name(self._cw, self.rtype, role,
+                                      context=entity.__regid__))
         self.w(u'</div>')
 
 
@@ -180,7 +181,8 @@
     def cell_call(self, row, col, view=None, **kwargs):
         self._cw.add_js('cubicweb.ajax.js')
         entity = self.cw_rset.get_entity(row, col)
-        box = SideBoxWidget(display_name(self._cw, self.rtype), self.__regid__)
+        title = display_name(self._cw, self.rtype, get_role(self), context=entity.__regid__)
+        box = SideBoxWidget(title, self.__regid__)
         related = self.related_boxitems(entity)
         unrelated = self.unrelated_boxitems(entity)
         box.extend(related)
@@ -292,7 +294,7 @@
         divid = domid(self.__regid__) + unicode(entity.eid)
         w(u'<div class="sideBox" id="%s%s">' % (domid(self.__regid__), entity.eid))
         w(u'<div class="sideBoxTitle"><span>%s</span></div>' %
-               rdef.rtype.display_name(req, self.role))
+               rdef.rtype.display_name(req, self.role, context=entity.__regid__))
         w(u'<div class="sideBox"><div class="sideBoxBody">')
         if related:
             w(u'<table>')
--- a/web/views/autoform.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/web/views/autoform.py	Tue Jul 27 12:37:27 2010 +0200
@@ -443,7 +443,8 @@
         for rschema, role, related in field.relations_table(form):
             # already linked entities
             if related:
-                w(u'<tr><th class="labelCol">%s</th>' % rschema.display_name(req, role))
+                label = rschema.display_name(req, role, context=form.edited_entity.__regid__)
+                w(u'<tr><th class="labelCol">%s</th>' % label)
                 w(u'<td>')
                 w(u'<ul>')
                 for viewparams in related:
--- a/web/views/debug.py	Tue Jul 27 09:06:55 2010 +0200
+++ b/web/views/debug.py	Tue Jul 27 12:37:27 2010 +0200
@@ -89,7 +89,7 @@
                    % (element, xml_escape(unicode(stats[element])),
                       element.endswith('percent') and '%' or '' ))
         w(u'</table>')
-        if req.cnx._cnxtype == 'inmemory':
+        if req.cnx._cnxtype == 'inmemory' and req.user.is_in_group('managers'):
             w(u'<h3>%s</h3>' % _('opened sessions'))
             sessions = repo._sessions.values()
             if sessions:
@@ -112,26 +112,27 @@
         w(u'<tr><th align="left">%s</th><td>%s</td></tr>' % (
             _('data directory url'), req.datadir_url))
         w(u'</table>')
-        from cubicweb.web.application import SESSION_MANAGER
-        sessions = SESSION_MANAGER.current_sessions()
-        w(u'<h3>%s</h3>' % _('opened web sessions'))
-        if sessions:
-            w(u'<ul>')
-            for session in sessions:
-                try:
-                    last_usage_time = session.cnx.check()
-                except BadConnectionId:
-                    w(u'<li>%s (INVALID)</li>' % session.sessionid)
-                    continue
-                w(u'<li>%s (%s: %s)<br/>' % (
-                    session.sessionid,
-                    _('last usage'),
-                    strftime(dtformat, localtime(last_usage_time))))
-                dict_to_html(w, session.data)
-                w(u'</li>')
-            w(u'</ul>')
-        else:
-            w(u'<p>%s</p>' % _('no web sessions found'))
+        if req.user.is_in_group('managers'):
+            from cubicweb.web.application import SESSION_MANAGER
+            sessions = SESSION_MANAGER.current_sessions()
+            w(u'<h3>%s</h3>' % _('opened web sessions'))
+            if sessions:
+                w(u'<ul>')
+                for session in sessions:
+                    try:
+                        last_usage_time = session.cnx.check()
+                    except BadConnectionId:
+                        w(u'<li>%s (INVALID)</li>' % session.sessionid)
+                        continue
+                    w(u'<li>%s (%s: %s)<br/>' % (
+                        session.sessionid,
+                        _('last usage'),
+                        strftime(dtformat, localtime(last_usage_time))))
+                    dict_to_html(w, session.data)
+                    w(u'</li>')
+                w(u'</ul>')
+            else:
+                w(u'<p>%s</p>' % _('no web sessions found'))