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

[cleanup] Fix some flake8 errors

and drop upper bound of copyright along the way.

autoform module is not added to flake8-ok-files since there are some remaining
errors to be handled, but that's still a start.

--HG--
branch : 3.25
parent 2fc04786dd36
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -19,9 +19,8 @@
from __future__ import print_function
import pkgutil
import re
from os.path import join, basename
from os.path import join
from hashlib import md5
from logging import getLogger
from warnings import warn
......@@ -29,7 +28,6 @@ from warnings import warn
from six import PY2, text_type, string_types, add_metaclass
from six.moves import range
from logilab.common import tempattr
from logilab.common.decorators import cached, clear_cache, monkeypatch, cachedproperty
from logilab.common.logging_ext import set_log_methods
from logilab.common.deprecation import deprecated
......@@ -44,14 +42,15 @@ from yams.constraints import (BaseConstraint, FormatConstraint,
cstr_json_dumps, cstr_json_loads)
from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader,
cleanup_sys_modules, fill_schema_from_namespace)
from yams.buildobjs import _add_relation as yams_add_relation
from rql import parse, nodes, RQLSyntaxError, TypeResolverException
from rql import parse, nodes, stmts, RQLSyntaxError, TypeResolverException
from rql.analyze import ETypeResolver
import cubicweb
from cubicweb import server
from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized, _
from cubicweb import server
PURE_VIRTUAL_RTYPES = set(('identity', 'has_text',))
VIRTUAL_RTYPES = set(('eid', 'identity', 'has_text',))
......@@ -602,6 +601,8 @@ def ERSchema_display_name(self, req, form='', context=None):
a given form
"""
return display_name(req, self.type, form, context)
ERSchema.display_name = ERSchema_display_name
......@@ -621,6 +622,8 @@ def get_groups(self, action):
return frozenset(g for g in self.permissions[action] if isinstance(g, string_types))
except KeyError:
return ()
PermissionMixIn.get_groups = get_groups
......@@ -640,6 +643,8 @@ def get_rqlexprs(self, action):
return tuple(g for g in self.permissions[action] if not isinstance(g, string_types))
except KeyError:
return ()
PermissionMixIn.get_rqlexprs = get_rqlexprs
......@@ -656,6 +661,8 @@ def set_action_permissions(self, action, permissions):
orig_set_action_permissions(self, action, tuple(permissions))
clear_cache(self, 'get_rqlexprs')
clear_cache(self, 'get_groups')
orig_set_action_permissions = PermissionMixIn.set_action_permissions
PermissionMixIn.set_action_permissions = set_action_permissions
......@@ -673,6 +680,8 @@ def has_local_role(self, action):
if action in ('update', 'delete'):
return 'owners' in self.get_groups(action)
return False
PermissionMixIn.has_local_role = has_local_role
......@@ -681,6 +690,8 @@ def may_have_permission(self, action, req):
self.has_perm(req, 'read')):
return False
return self.has_local_role(action) or self.has_perm(req, action)
PermissionMixIn.may_have_permission = may_have_permission
......@@ -691,6 +702,8 @@ def has_perm(self, _cw, action, **kwargs):
return True
except Unauthorized:
return False
PermissionMixIn.has_perm = has_perm
......@@ -734,6 +747,8 @@ def check_perm(self, _cw, action, **kwargs):
for rqlexpr in self.get_rqlexprs(action)):
return
raise Unauthorized(action, str(self))
PermissionMixIn.check_perm = check_perm
......@@ -818,7 +833,7 @@ class CubicWebEntitySchema(EntitySchema):
"""convenience method that returns the *main* (i.e. the first non meta)
attribute defined in the entity schema
"""
for rschema, _ in self.attribute_definitions():
for rschema, __ in self.attribute_definitions():
if not (rschema in META_RTYPES
or self.is_metadata(rschema)):
return rschema
......@@ -1262,7 +1277,7 @@ class RepoEnforcedRQLConstraintMixIn(object):
#
# possible enhancement: check entity being created, it's probably
# the main eid unless this is a composite relation
if eidto is None or 'S' in self.mainvars or not 'O' in self.mainvars:
if eidto is None or 'S' in self.mainvars or 'O' not in self.mainvars:
maineid = eidfrom
qname = role_name(rtype, 'subject')
else:
......@@ -1272,7 +1287,7 @@ class RepoEnforcedRQLConstraintMixIn(object):
msg = session._(self.msg)
else:
msg = '%(constraint)s %(expression)s failed' % {
'constraint': session._(self.type()),
'constraint': session._(self.type()),
'expression': self.expression}
raise ValidationError(maineid, {qname: msg})
......@@ -1320,9 +1335,6 @@ class RQLUniqueConstraint(RepoEnforcedRQLConstraintMixIn, BaseRQLConstraint):
# workflow extensions #########################################################
from yams.buildobjs import _add_relation as yams_add_relation
class workflowable_definition(ybo.metadefinition):
"""extends default EntityType's metaclass to add workflow relations
(i.e. in_state, wf_info_for and custom_workflow). This is the default
......@@ -1409,7 +1421,8 @@ class CubicWebSchemaLoader(BootstrapSchemaLoader):
"""
self.info('loading %s schemas', ', '.join(config.cubes()))
try:
return super(CubicWebSchemaLoader, self).load(config, config.schema_modnames(), **kwargs)
return super(CubicWebSchemaLoader, self).load(
config, config.schema_modnames(), **kwargs)
finally:
# we've to cleanup modules imported from cubicweb.schemas as well
cleanup_sys_modules([join(cubicweb.CW_SOFTWARE_ROOT, 'schemas')])
......@@ -1448,29 +1461,36 @@ def vocabulary(self, entity=None, form=None):
return self.regular_formats + tuple(NEED_PERM_FORMATS)
return self.regular_formats
# XXX itou for some Statement methods
from rql import stmts
# XXX itou for some Statement methods
def bw_get_etype(self, name):
return orig_get_etype(self, bw_normalize_etype(name))
orig_get_etype = stmts.ScopeNode.get_etype
stmts.ScopeNode.get_etype = bw_get_etype
def bw_add_main_variable_delete(self, etype, vref):
return orig_add_main_variable_delete(self, bw_normalize_etype(etype), vref)
orig_add_main_variable_delete = stmts.Delete.add_main_variable
stmts.Delete.add_main_variable = bw_add_main_variable_delete
def bw_add_main_variable_insert(self, etype, vref):
return orig_add_main_variable_insert(self, bw_normalize_etype(etype), vref)
orig_add_main_variable_insert = stmts.Insert.add_main_variable
stmts.Insert.add_main_variable = bw_add_main_variable_insert
def bw_set_statement_type(self, etype):
return orig_set_statement_type(self, bw_normalize_etype(etype))
orig_set_statement_type = stmts.Select.set_statement_type
stmts.Select.set_statement_type = bw_set_statement_type
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -15,6 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
import copy
import warnings
......@@ -25,13 +26,13 @@ from cubicweb.web.views import uicfg
abaa = uicfg.actionbox_appearsin_addmenu
class UICFGTC(CubicWebTC):
def test_default_actionbox_appearsin_addmenu_config(self):
self.assertFalse(abaa.etype_get('TrInfo', 'wf_info_for', 'object', 'CWUser'))
class DefinitionOrderTC(CubicWebTC):
"""This test check that when multiple definition could match a key, only
the more accurate apply"""
......@@ -41,19 +42,19 @@ class DefinitionOrderTC(CubicWebTC):
for rtag in (uicfg.autoform_section, uicfg.autoform_field_kwargs):
rtag._old_tagdefs = copy.deepcopy(rtag._tagdefs)
new_def = (
(('*', 'login', '*'),
{'formtype':'main', 'section':'hidden'}),
(('*', 'login', '*'),
{'formtype':'muledit', 'section':'hidden'}),
(('CWUser', 'login', '*'),
{'formtype':'main', 'section':'attributes'}),
(('CWUser', 'login', '*'),
{'formtype':'muledit', 'section':'attributes'}),
(('CWUser', 'login', 'String'),
{'formtype':'main', 'section':'inlined'}),
(('CWUser', 'login', 'String'),
{'formtype':'inlined', 'section':'attributes'}),
)
(('*', 'login', '*'),
{'formtype': 'main', 'section': 'hidden'}),
(('*', 'login', '*'),
{'formtype': 'muledit', 'section': 'hidden'}),
(('CWUser', 'login', '*'),
{'formtype': 'main', 'section': 'attributes'}),
(('CWUser', 'login', '*'),
{'formtype': 'muledit', 'section': 'attributes'}),
(('CWUser', 'login', 'String'),
{'formtype': 'main', 'section': 'inlined'}),
(('CWUser', 'login', 'String'),
{'formtype': 'inlined', 'section': 'attributes'}),
)
for key, kwargs in new_def:
uicfg.autoform_section.tag_subject_of(key, **kwargs)
......@@ -120,10 +121,12 @@ class DefinitionOrderTC(CubicWebTC):
@tag('uihelper', 'hidden', 'formconfig')
def test_uihelper_formconfig(self):
afk_get = uicfg.autoform_field_kwargs.get
class CWUserFormConfig(uihelper.FormConfig):
etype = 'CWUser'
hidden = ('in_group',)
fields_order = ('login', 'firstname')
section_conf = uicfg.autoform_section.get('CWUser', 'in_group', '*', 'subject')
self.assertCountEqual(section_conf, ['main_hidden', 'muledit_attributes'])
self.assertEqual(afk_get('CWUser', 'firstname', 'String', 'subject'), {'order': 1})
......
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -118,16 +118,10 @@ checking for dark-corner case where it can't be verified properly.
.. Controlling the generic relation fields
"""
from cubicweb import _
from warnings import warn
from six.moves import range
from logilab.mtconverter import xml_escape
from logilab.common.decorators import iclassmethod, cached
from logilab.common.deprecation import deprecated
from logilab.common.registry import NoSelectableObject
from cubicweb import neg_role, uilib
......@@ -185,7 +179,7 @@ class InlinedFormField(ff.Field):
return False
def process_posted(self, form):
pass # handled by the subform
pass # handled by the subform
class InlineEntityEditionFormView(f.FormViewMixIn, EntityView):
......@@ -237,7 +231,7 @@ class InlineEntityEditionFormView(f.FormViewMixIn, EntityView):
**self.cw_extra_kwargs)
if self.pform is None:
form.restore_previous_post(form.session_key())
#assert form.parent_form
# assert form.parent_form
self.add_hiddens(form, entity)
return form
......@@ -261,7 +255,7 @@ class InlineEntityEditionFormView(f.FormViewMixIn, EntityView):
entity = self._entity()
rdef = entity.e_schema.rdef(self.rtype, neg_role(self.role), self.petype)
card = rdef.role_cardinality(self.role)
if card == '1': # don't display remove link
if card == '1': # don't display remove link
return None
# if cardinality is 1..n (+), dont display link to remove an inlined form for the first form
# allowing to edit the relation. To detect so:
......@@ -294,7 +288,7 @@ class InlineEntityEditionFormView(f.FormViewMixIn, EntityView):
except KeyError:
self._cw.data[countkey] = 1
self.form.render(w=self.w, divid=divid, title=title, removejs=removejs,
i18nctx=i18nctx, counter=self._cw.data[countkey] ,
i18nctx=i18nctx, counter=self._cw.data[countkey],
**kwargs)
def form_title(self, entity, i18nctx):
......@@ -374,21 +368,21 @@ class InlineAddNewLinkView(InlineEntityCreationFormView):
& specified_etype_implements('Any'))
_select_attrs = InlineEntityCreationFormView._select_attrs + ('card',)
card = None # make pylint happy
form = None # no actual form wrapped
card = None # make pylint happy
form = None # no actual form wrapped
def call(self, i18nctx, **kwargs):
self._cw.set_varmaker()
divid = "addNew%s%s%s:%s" % (self.etype, self.rtype, self.role, self.peid)
self.w(u'<div class="inlinedform" id="%s" cubicweb:limit="true">'
% divid)
% divid)
js = "addInlineCreationForm('%s', '%s', '%s', '%s', '%s', '%s')" % (
self.peid, self.petype, self.etype, self.rtype, self.role, i18nctx)
if self.pform.should_hide_add_new_relation_link(self.rtype, self.card):
js = "toggleVisibility('%s'); %s" % (divid, js)
__ = self._cw.pgettext
self.w(u'<a class="addEntity" id="add%s:%slink" href="javascript: %s" >+ %s.</a>'
% (self.rtype, self.peid, js, __(i18nctx, 'add a %s' % self.etype)))
% (self.rtype, self.peid, js, __(i18nctx, 'add a %s' % self.etype)))
self.w(u'</div>')
......@@ -400,6 +394,7 @@ def relation_id(eid, rtype, role, reid):
return u'%s:%s:%s' % (eid, rtype, reid)
return u'%s:%s:%s' % (reid, rtype, eid)
def toggleable_relation_link(eid, nodeid, label='x'):
"""return javascript snippet to delete/undelete a relation between two
entities
......@@ -420,6 +415,7 @@ def get_pending_inserts(req, eid=None):
return ['%s:%s:%s' % (subj, rel, obj) for subj, rel, obj in pending
if eid is None or eid in (subj, obj)]
def get_pending_deletes(req, eid=None):
"""shortcut to access req's pending_delete entry
......@@ -430,6 +426,7 @@ def get_pending_deletes(req, eid=None):
return ['%s:%s:%s' % (subj, rel, obj) for subj, rel, obj in pending
if eid is None or eid in (subj, obj)]
def parse_relations_descr(rdescr):
"""parse a string describing some relations, in the form
subjeids:rtype:objeids
......@@ -443,6 +440,7 @@ def parse_relations_descr(rdescr):
for obj in objs.split('_'):
yield int(subj), rtype, int(obj)
def delete_relations(req, rdefs):
"""delete relations from the repository"""
# FIXME convert to using the syntax subject:relation:eids
......@@ -452,6 +450,7 @@ def delete_relations(req, rdefs):
execute(rql, {'x': subj, 'y': obj})
req.set_message(req._('relations deleted'))
def insert_relations(req, rdefs):
"""insert relations into the repository"""
execute = req.execute
......@@ -468,10 +467,12 @@ def inline_creation_form(self, peid, petype, ttype, rtype, role, i18nctx):
peid=peid, petype=petype)
return self._call_view(view, i18nctx=i18nctx)
@ajaxfunc(output_type='json')
def validate_form(self, action, names, values):
return self.validate_form(action, names, values)
@ajaxfunc
def cancel_edition(self, errorurl):
"""cancelling edition from javascript
......@@ -491,6 +492,7 @@ def _add_pending(req, eidfrom, rel, eidto, kind):
pendings.append(value)
req.session.data[key] = pendings
def _remove_pending(req, eidfrom, rel, eidto, kind):
key = 'pending_%s' % kind
pendings = req.session.data[key]
......@@ -499,21 +501,25 @@ def _remove_pending(req, eidfrom, rel, eidto, kind):
pendings.remove(value)
req.session.data[key] = pendings
@ajaxfunc(output_type='json')
def remove_pending_insert(self, args):
eidfrom, rel, eidto = args
_remove_pending(self._cw, eidfrom, rel, eidto, 'insert')
@ajaxfunc(output_type='json')
def add_pending_inserts(self, tripletlist):
for eidfrom, rel, eidto in tripletlist:
_add_pending(self._cw, eidfrom, rel, eidto, 'insert')
@ajaxfunc(output_type='json')
def remove_pending_delete(self, args):
eidfrom, rel, eidto = args
_remove_pending(self._cw, eidfrom, rel, eidto, 'delete')
@ajaxfunc(output_type='json')
def add_pending_delete(self, args):
eidfrom, rel, eidto = args
......@@ -527,7 +533,6 @@ class GenericRelationsWidget(fw.FieldWidget):
w = stream.append
req = form._cw
_ = req._
__ = _
eid = form.edited_entity.eid
w(u'<table id="relatedEntities">')
for rschema, role, related in field.relations_table(form):
......@@ -541,9 +546,9 @@ class GenericRelationsWidget(fw.FieldWidget):
w(u'<li>%s<span id="span%s" class="%s">%s</span></li>'
% (viewparams[1], viewparams[0], viewparams[2], viewparams[3]))
if not form.force_display and form.maxrelitems < len(related):
link = (u'<span>'
'[<a href="javascript: window.location.href+=\'&amp;__force_display=1\'">%s</a>]'
'</span>' % _('view all'))
link = (u'<span>[<a '
'href="javascript: window.location.href+=\'&amp;__force_display=1\'"'
'>%s</a>]</span>' % _('view all'))
w(u'<li>%s</li>' % link)
w(u'</ul>')
w(u'</td>')
......@@ -619,7 +624,8 @@ class GenericRelationsField(ff.Field):
if rschema.has_perm(form._cw, 'delete', **haspermkwargs):
toggleable_rel_link_func = toggleable_relation_link
else:
toggleable_rel_link_func = lambda x, y, z: u''
def toggleable_rel_link_func(x, y, z):
return u''
for row in range(rset.rowcount):
nodeid = relation_id(entity.eid, rschema, role,
rset[row][0])
......@@ -641,7 +647,7 @@ class GenericRelationsField(ff.Field):
for pendingid in pending_inserts:
eidfrom, rtype, eidto = pendingid.split(':')
pendingid = 'id' + pendingid
if int(eidfrom) == entity.eid: # subject
if int(eidfrom) == entity.eid: # subject
label = display_name(form._cw, rtype, 'subject',
entity.cw_etype)
reid = eidto
......@@ -687,13 +693,14 @@ class UnrelatedDivs(EntityView):
relname, role = self._cw.form.get('relation').rsplit('_', 1)
return u"""\
<div class="%s" id="%s">
<select id="%s" onchange="javascript: addPendingInsert(this.options[this.selectedIndex], %s, %s, '%s');">
<select id="%s"
onchange="javascript: addPendingInsert(this.options[this.selectedIndex], %s, %s, '%s');">
%s
</select>
</div>
""" % (hidden and 'hidden' or '', divid, selectid,
xml_escape(json_dumps(entity.eid)), is_cell and 'true' or 'null', relname,
'\n'.join(options))
xml_escape(json_dumps(entity.eid)), is_cell and 'true' or 'null',
relname, '\n'.join(options))
def _get_select_options(self, entity, rschema, role):
"""add options to search among all entities of each possible type"""
......@@ -706,7 +713,7 @@ class UnrelatedDivs(EntityView):
# NOTE: expect 'limit' arg on choices method of relation field
for eview, reid in field.vocabulary(form, limit=limit):
if reid is None:
if eview: # skip blank value
if eview: # skip blank value
options.append('<option class="separator">-- %s --</option>'
% xml_escape(eview))
elif reid != ff.INTERNAL_FIELD_VALUE:
......@@ -724,7 +731,7 @@ class UnrelatedDivs(EntityView):
for eschema in targettypes:
mode = '%s:%s:%s:%s' % (role, entity.eid, rschema.type, eschema)
url = self._cw.build_url(entity.rest_path(), vid='search-associate',
__mode=mode)
__mode=mode)
options.append((eschema.display_name(self._cw),
'<option value="%s">%s %s</option>' % (
xml_escape(url), _('Search for'), eschema.display_name(self._cw))))
......@@ -784,7 +791,7 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
for rtype, role in self.editable_attributes():
try:
self.field_by_name(str(rtype), role)
continue # explicitly specified
continue # explicitly specified
except f.FieldNotFound:
# has to be guessed
try:
......@@ -803,7 +810,7 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
for formview in self.inlined_form_views():
field = self._inlined_form_view_field(formview)
self.fields.append(field)
if not field.fieldset in fsio:
if field.fieldset not in fsio:
fsio.append(field.fieldset)
if self.formtype == 'main':
# add the generic relation field if necessary
......@@ -817,7 +824,7 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
pass
else:
self.fields.append(field)
if not field.fieldset in fsio:
if field.fieldset not in fsio:
fsio.append(field.fieldset)
self.maxrelitems = self._cw.property_value('navigation.related-limit')
self.force_display = bool(self._cw.form.get('__force_display'))
......@@ -949,7 +956,7 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
relation.
"""
return (self.should_display_add_new_relation_link(
rschema, existing, card) and
rschema, existing, card) and
self.check_inlined_rdef_permissions(
rschema, role, tschema, ttype))
......@@ -968,7 +975,6 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
return rdef.has_perm(self._cw, 'add', **rdefkwargs)
return rdef.may_have_permission('add', self._cw)
def should_hide_add_new_relation_link(self, rschema, card):
"""return true if once an inlined creation form is added, the 'add new'
link should be hidden
......@@ -1009,7 +1015,7 @@ class AutomaticEntityForm(forms.EntityFieldsForm):
pass
## default form ui configuration ##############################################
# default form ui configuration ##############################################
_AFS = uicfg.autoform_section
# use primary and not generated for eid since it has to be an hidden
......@@ -1049,6 +1055,7 @@ _AFFK.tag_attribute(('RQLExpression', 'expression'),
_AFFK.tag_subject_of(('TrInfo', 'wf_info_for', '*'),
{'widget': fw.HiddenInput})
def registration_callback(vreg):
global etype_relation_field
......
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -20,7 +20,7 @@
from cubicweb import _
from hashlib import sha1 # pylint: disable=E0611
from hashlib import sha1 # pylint: disable=E0611
from six import text_type
from six.moves import range
......@@ -28,7 +28,6 @@ from six.moves import range
from logilab.mtconverter import xml_escape
from cubicweb import tags
from cubicweb.schema import display_name
from cubicweb.predicates import one_line_rset, is_instance, match_user_groups
from cubicweb.view import EntityView, StartupView
from cubicweb.web import action, formwidgets
......@@ -39,7 +38,8 @@ _pvs.tag_attribute(('CWUser', 'login'), 'hidden')
_affk = uicfg.autoform_field_kwargs
_affk.tag_subject_of(('CWUser', 'in_group', 'CWGroup'),
{'widget': formwidgets.InOutWidget})
{'widget': formwidgets.InOutWidget})
class UserPreferencesEntityAction(action.Action):
__regid__ = 'prefs'
......@@ -66,7 +66,7 @@ class FoafView(EntityView):
self.w(u'''<?xml version="1.0" encoding="%s"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"> '''% self._cw.encoding)
xmlns:foaf="http://xmlns.com/foaf/0.1/"> ''' % self._cw.encoding)
for i in range(self.cw_rset.rowcount):
self.cell_call(i, 0)
self.w(u'</rdf:RDF>\n')
......@@ -121,6 +121,7 @@ class CWGroupMainTab(tabs.PrimaryTab):
'U last_login_time LL, G eid %(x)s', {'x': entity.eid})
self.wview('cwgroup.users', rset, 'null')
class CWGroupUsersTable(tableview.RsetTableView):
__regid__ = 'cwgroup.users'
__select__ = is_instance('CWUser')
......@@ -135,9 +136,7 @@ class CWGroupPermTab(EntityView):
__select__ = is_instance('CWGroup')
def entity_call(self, entity):
self._cw.add_css(('cubicweb.schema.css','cubicweb.acl.css'))
access_types = ('read', 'delete', 'add', 'update')
w = self.w
self._cw.add_css(('cubicweb.schema.css', 'cubicweb.acl.css'))
objtype_access = {'CWEType': ('read', 'delete', 'add', 'update'),
'CWRelation': ('add', 'delete')}
rql_cwetype = 'DISTINCT Any X WHERE X %s_permission CWG, X is CWEType, ' \
......@@ -170,7 +169,7 @@ class CWGroupInContextView(EntityView):
# user / groups management views ###############################################
class ManageUsersAction(actions.ManagersAction):
__regid__ = 'cwuser' # see rewrite rule /cwuser
__regid__ = 'cwuser' # see rewrite rule /cwuser
title = _('users and g