appy.gen: added new format 'captcha' for a String.
This commit is contained in:
parent
0d55abb239
commit
a80ef513ff
15 changed files with 123 additions and 53 deletions
|
@ -938,14 +938,17 @@ class ToolMixin(BaseMixin):
|
|||
return [f.__dict__ for f in self.getAllAppyTypes(contentType) \
|
||||
if (f.type == 'Pod') and (f.show == 'result')]
|
||||
|
||||
def getUserLine(self, user):
|
||||
'''Returns a one-line user info as shown on every page.'''
|
||||
res = [user.getId()]
|
||||
rolesToShow = [r for r in user.getRoles() \
|
||||
def getUserLine(self):
|
||||
'''Returns a info about the currently logged user as a 2-tuple: first
|
||||
elem is the one-line user info as shown on every page; second line is
|
||||
the URL to edit user info.'''
|
||||
appyUser = self.appy().appyUser
|
||||
res = [appyUser.title, appyUser.login]
|
||||
rolesToShow = [r for r in appyUser.roles \
|
||||
if r not in ('Authenticated', 'Member')]
|
||||
if rolesToShow:
|
||||
res.append(', '.join([self.translate(r) for r in rolesToShow]))
|
||||
return ' | '.join(res)
|
||||
return (' | '.join(res), appyUser.o.getUrl(mode='edit'))
|
||||
|
||||
def generateUid(self, className):
|
||||
'''Generates a UID for an instance of p_className.'''
|
||||
|
|
|
@ -418,7 +418,7 @@ class BaseMixin:
|
|||
return the result.'''
|
||||
page = self.REQUEST.get('page', 'main')
|
||||
for field in self.getAppyTypes('edit', page):
|
||||
if (field.type == 'String') and (field.format == 3):
|
||||
if (field.type == 'String') and (field.format in (3,4)):
|
||||
self.REQUEST.set(field.name, '')
|
||||
return self.ui.edit(self)
|
||||
|
||||
|
@ -1073,6 +1073,9 @@ class BaseMixin:
|
|||
obj = self
|
||||
return appyType.getPossibleValues(obj, withTranslations, withBlankValue)
|
||||
|
||||
def getCaptchaChallenge(self, name):
|
||||
return self.getAppyType(name).getCaptchaChallenge(self.REQUEST.SESSION)
|
||||
|
||||
def appy(self):
|
||||
'''Returns a wrapper object allowing to manipulate p_self the Appy
|
||||
way.'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue