# HG changeset patch # User Aurelien Campeas # Date 1247756455 -7200 # Node ID ea1defea9636019bac9b6ff9ec4bf72f08e613ed # Parent b246d5cee44e20401891b92ed4fd7dc8e1db4143 [views] fix some crashers (schema still does not render properly, might be yams side) diff -r b246d5cee44e -r ea1defea9636 web/views/schema.py --- a/web/views/schema.py Thu Jul 16 17:00:19 2009 +0200 +++ b/web/views/schema.py Thu Jul 16 17:00:55 2009 +0200 @@ -27,7 +27,7 @@ def skip_types(req): if int(req.form.get('skipmeta', True)): - return schema.SKIP_TYPES + return SKIP_TYPES return () class ViewSchemaAction(action.Action): @@ -191,15 +191,15 @@ class RestrictedSchemaVisitorMixIn(object): def __init__(self, req, *args, **kwargs): + self.req = req super(RestrictedSchemaVisitorMixIn, self).__init__(*args, **kwargs) - self.req = req - def should_display_schema(self, schema): - return (super(RestrictedSchemaVisitorMixIn, self).should_display_schema(schema) + def should_display_schema(self, rschema): + return (super(RestrictedSchemaVisitorMixIn, self).should_display_schema(rschema) and rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')) - def should_display_attr(self, schema): - return (super(RestrictedSchemaVisitorMixIn, self).should_display_attr(schema) + def should_display_attr(self, rschema): + return (super(RestrictedSchemaVisitorMixIn, self).should_display_attr(rschema) and rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')) diff -r b246d5cee44e -r ea1defea9636 web/views/startup.py --- a/web/views/startup.py Thu Jul 16 17:00:19 2009 +0200 +++ b/web/views/startup.py Thu Jul 16 17:00:55 2009 +0200 @@ -10,7 +10,7 @@ _ = unicode from logilab.common.textutils import unormalize -from logilab.mtconverter import html_escape +from logilab.mtconverter import xml_escape from cubicweb.view import StartupView from cubicweb.selectors import match_user_groups, implements