Export to GitHub

formalchemy - issue #92

Want to add instructions to FieldSet


Posted on Apr 13, 2009 by Massive Kangaroo

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 Kangaroo

Index: 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 Kangaroo

hmmm.. Documentation missing.

Comment #3

Posted on Apr 13, 2009 by Swift Dog

I'd like to see a complete patch, including templates & docs, before committing.

Comment #4

Posted on Apr 16, 2009 by Massive Kangaroo

This patch should fix the issue, and document the changes.

Nothing tests it however, haven't got around to poke with the test suite.

Attachments

Comment #5

Posted on Apr 17, 2009 by Swift Dog

doctests fail.

I'd like to see a test of the template change too before committing.

Comment #6

Posted on Apr 20, 2009 by Massive Kangaroo

Now implemented with more generic 'metadata'

Attachments

Comment #7

Posted on Apr 21, 2009 by Massive Kangaroo

ok, this fixes the issue, adds the functionality, covers all the tests, adds templates for both Tempita and Mako, and documents the changes.

Attachments

Comment #8

Posted on Apr 27, 2009 by Swift Dog

sorry I didn't have time to review sooner. looks good; committed. Thanks!

Status: Fixed