How to create registration like package?

2 views
Skip to first unread message

Lukasz Szybalski

unread,
Jun 20, 2008, 12:33:36 PM6/20/08
to tg-regi...@googlegroups.com
Hello,
I am trying to create package that would be installed just like
registration. I was wondering if you could share some pointers, and
some challenges on how to make this happen?

1. from xx import YY
2. url conflicts that I should be aware of.. /registartion/index...
3. problems with adding subfolders...and filenames?
etc.

Unless you maybe have a blog that you wrote about something similar.


Lucas

Patrick Lewis

unread,
Jun 21, 2008, 12:13:36 PM6/21/08
to tg-registration
If some of this is too basic, forgive me.

Registration is simply a setuptools plugin[1] for paste[2]. If I was
doing it again, I would

1) create a new setuptools based package using `paster create`
2) add the paster plugin entry to setup.py [3]
3) add the Template class pointed to in the plugin (e.g.
registration.Registration) [4]
4) start building the templates in _template_dir. [5]
5) `python setup.py develop` to register the plugin with paste.
6) see if the plugin is registered `paster create --list-packages`
6) test it out. `paster create yournewpackage`

There is also a tutorial at [6].

As to your specific questions:

1) I don't remember any special issues with imports. You can say that
your template requires another template, to ensure that you can import
stuff from the new package without issue. Also, you can use normal
setuptools requires statements to make sure what you need is
installed.

2) I handled this in registration by putting everything under a single
controller, and then making the user hook that controller into the
app. With this approach, I didn't need to worry about url conflicts.

3) Pretty much anything in your _template_dir directory should get
included when you do the template install. You notice registration has
a config directory with a registration.cfg file; this gets put in the
turbogears project's config directory along with other config files
(note that it doesn't wipe out other config files; it just inserts
what's missing).

Hope this helps. If you have more questions, feel free to ask.

[1] http://tinyurl.com/4djh4j
[2] http://pythonpaste.org/script/developer.html#templates
[3] http://code.google.com/p/tg-registration/source/browse/trunk/setup.py#38
[4] http://tinyurl.com/59cse8
[5] http://tinyurl.com/4sotxn
[6] http://tinyurl.com/6y6yzc
Reply all
Reply to author
Forward
0 new messages