Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2009-11-27 04:00:57
Size: 1071
Editor: BenGolding
Comment:
Revision 4 as of 2011-02-15 06:05:18
Size: 1053
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
== Adding the {{{alx-form}}} tag == == Adding the <alx-form> tag ==
Line 18: Line 18:
In each Albatross application, there is a point at which an instance of App (or a subclass thereof) is created, usually in {{{app.py}}} or {{{app.cgi}}} or wherever the main entry point of the application is. This needs instance needs to be told about the new tag. That's done in code that usually looks something like this: In each Albatross application, there is a point at which an instance of App (or a subclass thereof) is created, usually in {{{app.py}}} or {{{app.cgi}}} or wherever the main entry point of the application is. This instance needs to be told about the new tag. That's done in code that looks something like this:

Getting started

You need to have a version of Albatross which has the Albatross Forms support included (or have installed it by hand yourself). You can quickly test whether it is present by running:

$ python
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from albatross.ext import form
>>>

If it's missing, you'll see an import error.

Adding the <alx-form> tag

In each Albatross application, there is a point at which an instance of App (or a subclass thereof) is created, usually in app.py or app.cgi or wherever the main entry point of the application is. This instance needs to be told about the new tag. That's done in code that looks something like this:

   1 from albatross.ext import form
   2 ...
   3 
   4 if __name__ == '__main__':
   5     app = App()
   6     for tag_class in form.tag_classes:
   7         app.register_tagclasses(tag_class)
   8     app.run(Request())

None: Getting_started (last edited 2011-02-15 06:05:18 by localhost)