pombreda / formalchemy

Automatically exported from code.google.com/p/formalchemy
MIT License
0 stars 0 forks source link

Want to add instructions to FieldSet #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

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

Original issue reported on code.google.com by wackysa...@gmail.com on 13 Apr 2009 at 9:30

GoogleCodeExporter commented 9 years ago
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

Original comment by wackysa...@gmail.com on 13 Apr 2009 at 9:30

GoogleCodeExporter commented 9 years ago
hmmm.. Documentation missing.

Original comment by wackysa...@gmail.com on 13 Apr 2009 at 9:30

GoogleCodeExporter commented 9 years ago
I'd like to see a complete patch, including templates & docs, before committing.

Original comment by jbel...@gmail.com on 13 Apr 2009 at 9:35

GoogleCodeExporter commented 9 years ago
This patch should fix the issue, and document the changes.

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

Original comment by wackysa...@gmail.com on 16 Apr 2009 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
doctests fail.

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

Original comment by jbel...@gmail.com on 17 Apr 2009 at 2:33

GoogleCodeExporter commented 9 years ago
Now implemented with more generic 'metadata'

Original comment by wackysa...@gmail.com on 20 Apr 2009 at 4:24

Attachments:

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

Original comment by wackysa...@gmail.com on 21 Apr 2009 at 2:46

Attachments:

GoogleCodeExporter commented 9 years ago
sorry I didn't have time to review sooner.  looks good; committed.  Thanks!

Original comment by jbel...@gmail.com on 27 Apr 2009 at 3:46