Implemented .with_instructions(text) that will fill the .instructions property on the Field element.
This allows you to do (in fieldset.mako for example):
% if field.instructions: <span class="instruction">${field.instructions|n}</span> % endif
Comment #1
Posted on Apr 13, 2009 by Massive KangarooIndex: fields.py
--- fields.py (révision 738) +++ fields.py (copie de travail) @@ -656,6 +656,8 @@ self.is_pk = False # True iff this Field is a raw foreign key self.is_raw_foreign_key = False + # Instructions + self.instructions = None return False
def __deepcopy__(self, memo):
@@ -744,6 +746,9 @@
def bind(self, parent):
"""Return a copy of this Field, bound to a different parent"""
return self._modified(parent=parent)
+ def with_instructions(self, text):
+ """Return a copy of this Field, with some newly attached instructions"""
+ return self._modified(instructions=text)
def validate(self, validator):
"""
Add the validator
function to the list of validation
Comment #2
Posted on Apr 13, 2009 by Massive Kangaroohmmm.. Documentation missing.
Comment #3
Posted on Apr 13, 2009 by Swift DogI'd like to see a complete patch, including templates & docs, before committing.
Comment #4
Posted on Apr 16, 2009 by Massive KangarooThis patch should fix the issue, and document the changes.
Nothing tests it however, haven't got around to poke with the test suite.
- issue92.patch 3.22KB
Comment #5
Posted on Apr 17, 2009 by Swift Dogdoctests fail.
I'd like to see a test of the template change too before committing.
Comment #6
Posted on Apr 20, 2009 by Massive KangarooNow implemented with more generic 'metadata'
- issue92.patch 3.92KB
Comment #7
Posted on Apr 21, 2009 by Massive Kangaroook, this fixes the issue, adds the functionality, covers all the tests, adds templates for both Tempita and Mako, and documents the changes.
- issue92-v3.patch 5.58KB
Comment #8
Posted on Apr 27, 2009 by Swift Dogsorry I didn't have time to review sooner. looks good; committed. Thanks!
Status: Fixed