--- a/devtools/fill.py Wed Dec 09 12:23:31 2009 +0100
+++ b/devtools/fill.py Wed Dec 09 12:24:38 2009 +0100
@@ -112,7 +112,7 @@
attrlength = get_max_length(self.e_schema, attrname)
num_len = numlen(index)
if num_len >= attrlength:
- ascii = self.e_schema.rproperty(attrname, 'internationalizable')
+ ascii = self.e_schema.rdef(attrname).internationalizable
return ('&'+decompose_b26(index, ascii))[:attrlength]
# always use plain text when no format is specified
attrprefix = attrname[:max(attrlength-num_len-1, 0)]
--- a/hooks/test/unittest_hooks.py Wed Dec 09 12:23:31 2009 +0100
+++ b/hooks/test/unittest_hooks.py Wed Dec 09 12:24:38 2009 +0100
@@ -434,17 +434,17 @@
sqlcursor = self.session.pool['system']
try:
self.execute('SET X indexed FALSE WHERE X relation_type R, R name "name"')
- self.failUnless(self.schema['name'].rproperty('Workflow', 'String', 'indexed'))
+ self.failUnless(self.schema['name'].rdef('Workflow', 'String').indexed)
self.failUnless(self.index_exists('Workflow', 'name'))
self.commit()
- self.failIf(self.schema['name'].rproperty('Workflow', 'String', 'indexed'))
+ self.failIf(self.schema['name'].rdef('Workflow', 'String').indexed)
self.failIf(self.index_exists('Workflow', 'name'))
finally:
self.execute('SET X indexed TRUE WHERE X relation_type R, R name "name"')
- self.failIf(self.schema['name'].rproperty('Workflow', 'String', 'indexed'))
+ self.failIf(self.schema['name'].rproperty('Workflow', 'String').indexed)
self.failIf(self.index_exists('Workflow', 'name'))
self.commit()
- self.failUnless(self.schema['name'].rproperty('Workflow', 'String', 'indexed'))
+ self.failUnless(self.schema['name'].rdef('Workflow', 'String').indexed)
self.failUnless(self.index_exists('Workflow', 'name'))
def test_unique_change(self):
--- a/web/test/unittest_views_searchrestriction.py Wed Dec 09 12:23:31 2009 +0100
+++ b/web/test/unittest_views_searchrestriction.py Wed Dec 09 12:24:38 2009 +0100
@@ -67,16 +67,16 @@
select = self.parse('DISTINCT Any V,TN,L ORDERBY TN,L WHERE T nom TN, V connait T, T is Personne, V is CWUser,'
'NOT V in_state VS, VS name "published", V login L')
rschema = self.schema['connait']
- for s, o in rschema.iter_rdefs():
- rschema.set_rproperty(s, o, 'cardinality', '++')
+ for rdefs in rschema.rdefs.values():
+ rdefs.cardinality = '++'
try:
self.assertEquals(self._generate(select, 'in_state', 'subject', 'name'),
"DISTINCT Any A,B ORDERBY B WHERE V is CWUser, "
"NOT V in_state VS, VS name 'published', "
"V in_state A, A name B")
finally:
- for s, o in rschema.iter_rdefs():
- rschema.set_rproperty(s, o, 'cardinality', '**')
+ for rdefs in rschema.rdefs.values():
+ rdefs.cardinality = '**'
def test_nonregr3(self):
#'DISTINCT Any X,TMP,N WHERE P name TMP, X version_of P, P is Project, X is Version, not X in_state S,S name "published", X num N ORDERBY TMP,N'
--- a/web/uicfg.py Wed Dec 09 12:23:31 2009 +0100
+++ b/web/uicfg.py Wed Dec 09 12:24:38 2009 +0100
@@ -351,6 +351,7 @@
else:
eid = None
strict = False
+ cw = entity._cw
for rschema, targetschemas, role in eschema.relation_definitions(True):
# check category first, potentially lower cost than checking
# permission which may imply rql queries
@@ -360,13 +361,14 @@
continue
rdef = rschema.role_rdef(eschema, tschema, role)
if not ((not strict and rdef.has_local_role(permission)) or
- rdef.has_perm(entity._cw, permission, fromeid=eid)):
+ rdef.has_perm(cw, permission, fromeid=eid)):
continue
_targetschemas.append(tschema)
if not _targetschemas:
continue
targetschemas = _targetschemas
if permission is not None:
+ rdef = eschema.rdef(rschema, targettype=targetschemas[0])
# tag allowing to hijack the permission machinery when
# permission is not verifiable until the entity is actually
# created...
@@ -374,25 +376,25 @@
yield (rschema, targetschemas, role)
continue
if rschema.final:
- if not eschema.rdef(rschema).has_perm(entity._cw, permission, fromeid=eid):
+ if not rdef.has_perm(cw, permission, fromeid=eid):
continue
elif role == 'subject':
# on relation with cardinality 1 or ?, we need delete perm as well
# if the relation is already set
if (permission == 'add'
- and rschema.cardinality(eschema, targetschemas[0], role) in '1?'
+ and rdef.role_cardinality(role) in '1?'
and eid and entity.related(rschema.type, role)
- and not rschema.has_perm(entity._cw, 'delete', fromeid=eid,
- toeid=entity.related(rschema.type, role)[0][0])):
+ and not rdef.has_perm(cw, 'delete', fromeid=eid,
+ toeid=entity.related(rschema.type, role)[0][0])):
continue
elif role == 'object':
# on relation with cardinality 1 or ?, we need delete perm as well
# if the relation is already set
if (permission == 'add'
- and rschema.cardinality(targetschemas[0], eschema, role) in '1?'
+ and rdef.role_cardinality(role) in '1?'
and eid and entity.related(rschema.type, role)
- and not rschema.has_perm(entity._cw, 'delete', toeid=eid,
- fromeid=entity.related(rschema.type, role)[0][0])):
+ and not rdef.has_perm(cw, 'delete', toeid=eid,
+ fromeid=entity.related(rschema.type, role)[0][0])):
continue
yield (rschema, targetschemas, role)
--- a/web/views/basecontrollers.py Wed Dec 09 12:23:31 2009 +0100
+++ b/web/views/basecontrollers.py Wed Dec 09 12:24:38 2009 +0100
@@ -68,7 +68,7 @@
def publish(self, rset=None):
"""log in the instance"""
- if self._cw.config['auth-mode'] == 'http':
+ if self._cw.vreg.config['auth-mode'] == 'http':
# HTTP authentication
raise ExplicitLogin()
else:
--- a/web/views/primary.py Wed Dec 09 12:23:31 2009 +0100
+++ b/web/views/primary.py Wed Dec 09 12:24:38 2009 +0100
@@ -256,7 +256,7 @@
# because of that, we known that rset.printable_rql() will return
# rql with no limit set anyway (since it's handled manually)
if 'dispctrl' in self.cw_extra_kwargs:
- limit = self.extra_kwargs['dispctrl'].get('limit')
+ limit = self.cw_extra_kwargs['dispctrl'].get('limit')
else:
limit = None
if limit is None or self.cw_rset.rowcount <= limit: