appy.gen: bugfixes.

This commit is contained in:
Gaetan Delannay 2012-03-03 23:29:32 +01:00
parent 91d3887847
commit 431511026c
3 changed files with 15 additions and 7 deletions

View file

@ -136,8 +136,9 @@ class User(ModelClass):
# All methods defined below are fake. Real versions are in the wrapper.
title = gen.String(show=False, indexed=True)
gm = {'group': 'main', 'multiplicity': (1,1), 'width': 25}
name = gen.String(**gm)
firstName = gen.String(**gm)
def showName(self): pass
name = gen.String(show=showName, **gm)
firstName = gen.String(show=showName, **gm)
def showLogin(self): pass
def validateLogin(self): pass
login = gen.String(show=showLogin, validator=validateLogin,

View file

@ -521,7 +521,7 @@ function updateRowNumber(row, rowIndex, action) {
var nSuffix = name.lastIndexOf('_');
var nameSuffix = '';
if (nSuffix != -1) {
nameSuffix = id.substring(nSuffix);
nameSuffix = name.substring(nSuffix);
name = name.substring(0, nSuffix);
}
// Compute the current row index if not already done.

View file

@ -9,6 +9,10 @@ class UserWrapper(AbstractWrapper):
if self.o.isTemporary(): return 'edit'
return 'view'
def showName(self):
'''Name and first name, by default, are always shown.'''
return True
def showEmail(self):
'''In most cases, email is the login. Show the field only if it is not
the case.'''
@ -178,8 +182,11 @@ class ZopeUserPatches:
if self._check_context(object): return 1
return
try:
from AccessControl.User import SimpleUser
SimpleUser.getRoles = getRoles
SimpleUser.getRolesInContext = getRolesInContext
SimpleUser.allowed = allowed
except ImportError:
pass
# ------------------------------------------------------------------------------