equal
deleted
inserted
replaced
162 def vocabulary(self, form): |
162 def vocabulary(self, form): |
163 """return vocabulary for this field. This method will be called by |
163 """return vocabulary for this field. This method will be called by |
164 widgets which desire it.""" |
164 widgets which desire it.""" |
165 if self.choices is not None: |
165 if self.choices is not None: |
166 if callable(self.choices): |
166 if callable(self.choices): |
167 vocab = self.choices(req=form.req) |
167 try: |
|
168 vocab = self.choices(form=form) |
|
169 except TypeError: |
|
170 warn('vocabulary method (eg field.choices) should now take ' |
|
171 'the form instance as argument', DeprecationWarning) |
|
172 vocab = self.choices(req=form.req) |
168 else: |
173 else: |
169 vocab = self.choices |
174 vocab = self.choices |
170 if vocab and not isinstance(vocab[0], (list, tuple)): |
175 if vocab and not isinstance(vocab[0], (list, tuple)): |
171 vocab = [(x, x) for x in vocab] |
176 vocab = [(x, x) for x in vocab] |
172 else: |
177 else: |