accept extra fields forumsid and wikihomepage

This commit is contained in:
Jan Dittberner 2010-06-03 21:49:34 +02:00
parent 2b6e6869f7
commit c3afa11013
3 changed files with 8 additions and 4 deletions

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# DDPortfolio service DdportfolioController
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info>
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
#
# This file is part of DDPortfolio service.
#
@ -156,7 +156,8 @@ developer name on all bug logs)'),
except formencode.validators.Invalid, error:
c.messages = { 'errors' : error.unpack_errors() }
return render('/showform.mako')
data = build_urls(rp)
data = build_urls(form_result)
log.debug("data %r", data)
if 'mode' in rp and rp['mode'] == 'json':
response.headers['Content-Type'] = 'text/javascript'
return simplejson.dumps(

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# DDPortfolio service form handling model
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info>
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
#
# This file is part of DDPortfolio service.
#
@ -35,6 +35,8 @@ class DeveloperData(formencode.Schema):
nonddemail = formencode.validators.Email()
aliothusername = formencode.validators.PlainText()
mode = formencode.validators.OneOf([u'json', u'html'], not_empty=True)
forumsid = formencode.validators.Int(if_missing=None)
wikihomepage = formencode.validators.String(if_missing=None)
class DDDataRequest(formencode.Schema):
"""Validation schema for DDData request."""

View file

@ -51,7 +51,8 @@ def build_urls(fields):
fields."""
data = []
qfields = dict([(key, quote_plus(fields[key].encode('utf8'))) \
for key in fields if fields[key] is not None])
for key in fields \
if fields[key] is not None and isinstance(fields[key], unicode)])
if 'gpgfp' not in qfields:
fpr = keyfinder.getFingerprintByEmail(fields['email'].encode('utf8'))
if fpr: