~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject.py

  • Committer: William Grant
  • Date: 2010-01-28 22:51:40 UTC
  • mto: This revision was merged to the branch mainline in revision 1454.
  • Revision ID: me@williamgrant.id.au-20100128225140-7x3a3as9noz7q6qf
Allow unsetting of the URL or description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
 
149
149
 
150
150
class OfferingSchema(formencode.Schema):
151
 
    description = formencode.validators.UnicodeString()
152
 
    url = formencode.validators.URL()
 
151
    description = formencode.validators.UnicodeString(
 
152
        if_missing=None, not_empty=False)
 
153
    url = formencode.validators.URL(if_missing=None, not_empty=False)
153
154
 
154
155
 
155
156
class OfferingEdit(XHTMLView):
167
168
                validator = OfferingSchema()
168
169
                data = validator.to_python(data, state=req)
169
170
 
170
 
                self.context.url = unicode(data['url'])
 
171
                self.context.url = unicode(data['url']) if data['url'] else None
171
172
                self.context.description = data['description']
172
173
                req.store.commit()
173
174
                req.throw_redirect(req.publisher.generate(self.context))