generate wikihomepage from name if parameter is missing
This commit is contained in:
parent
44f5ffa8c3
commit
bbd6ae9017
2 changed files with 7 additions and 5 deletions
|
@ -146,8 +146,6 @@ developer name on all bug logs)'),
|
|||
('nonddemail', 'email')):
|
||||
if not tuple[0] in rp or not rp[tuple[0]]:
|
||||
rp[tuple[0]] = fields[tuple[1]]
|
||||
if not 'mode' in rp or not rp['mode']:
|
||||
rp['mode'] = 'html'
|
||||
|
||||
schema = DeveloperData()
|
||||
try:
|
||||
|
@ -158,9 +156,12 @@ developer name on all bug logs)'),
|
|||
except formencode.validators.Invalid, error:
|
||||
c.messages = { 'errors' : error.unpack_errors() }
|
||||
return render('/showform.mako')
|
||||
if form_result['wikihomepage'] is None:
|
||||
log.debug('generate wikihomepage from name')
|
||||
form_result['wikihomepage'] = "".join(
|
||||
[part.capitalize() for part in form_result['name'].split()])
|
||||
data = build_urls(form_result)
|
||||
log.debug("data %r", data)
|
||||
if 'mode' in rp and rp['mode'] == 'json':
|
||||
if form_result['mode'] == 'json':
|
||||
response.headers['Content-Type'] = 'text/javascript'
|
||||
return simplejson.dumps(
|
||||
dict([("%s.%s" % \
|
||||
|
|
|
@ -34,10 +34,11 @@ class DeveloperData(formencode.Schema):
|
|||
username = formencode.validators.PlainText()
|
||||
nonddemail = formencode.validators.Email()
|
||||
aliothusername = formencode.validators.PlainText()
|
||||
mode = formencode.validators.OneOf([u'json', u'html'], not_empty=True)
|
||||
mode = formencode.validators.OneOf([u'json', u'html'], if_missing=u'html')
|
||||
forumsid = formencode.validators.Int(if_missing=None)
|
||||
wikihomepage = formencode.validators.String(if_missing=None)
|
||||
|
||||
|
||||
class DDDataRequest(formencode.Schema):
|
||||
"""Validation schema for DDData request."""
|
||||
allow_extra_fields = True
|
||||
|
|
Loading…
Reference in a new issue