~ubuntu-branches/ubuntu/oneiric/moin/oneiric-security

« back to all changes in this revision

Viewing changes to MoinMoin/security/textcha.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-03-30 12:55:34 UTC
  • mfrom: (0.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100330125534-4c2ufc1rok24447l
Tags: 1.9.2-2ubuntu1
* Merge from Debian testing (LP: #521834). Based on work by Stefan Ebner.
  Remaining changes:
 - Remove python-xml from Suggests field, the package isn't anymore in
   sys.path.
 - Demote fckeditor from Recommends to Suggests; the code was previously
   embedded in moin, but it was also disabled, so there's no reason for us
   to pull this in by default currently. Note: This isn't necessary anymore
   but needs a MIR for fckeditor, so postpone dropping this change until
   lucid+1
* debian/rules:
  - Replace hardcoded python2.5 with python* and hardcore python2.6 for ln
* debian/control.in: drop versioned depends on cdbs

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    def _get_textchas(self):
47
47
        """ get textchas from the wiki config for the user's language (or default_language or en) """
48
48
        request = self.request
 
49
        groups = request.groups
49
50
        cfg = request.cfg
50
51
        user = request.user
51
52
        disabled_group = cfg.textchas_disabled_group
52
 
        if disabled_group and user.name and request.dicts.has_member(disabled_group, user.name):
 
53
        if disabled_group and user.name and user.name in groups.get(disabled_group, []):
53
54
            return None
54
55
        textchas = cfg.textchas
55
56
        if textchas:
141
142
    def _extract_form_values(self, form=None):
142
143
        if form is None:
143
144
            form = self.request.form
144
 
        question = form.get('textcha-question', [None])[0]
145
 
        given_answer = form.get('textcha-answer', [u''])[0]
 
145
        question = form.get('textcha-question')
 
146
        given_answer = form.get('textcha-answer', u'')
146
147
        return question, given_answer
147
148
 
148
149
    def render(self, form=None):