Ticket #61 (closed difetto: sistemata)
Avoid init code in __init__.py and in general at "module level"
| Reported by: | fero | Owned by: | |
|---|---|---|---|
| Priority: | bloccante | Milestone: | ACQUISTIAMO - L'utente può ordinare |
| Component: | sviluppo | Keywords: | |
| Cc: |
Description
That's why we have to avoid code in init.py
Code is executed at import-time.
The following error arises when you perform a syncdb with a clean db. It tries to register roles from auth/init.py but tables are not created yet
File "/home/fero/src/gasistafelice/gasistafelice/../gasistafelice/supplier/models.py", line 18, in <module>
from gasistafelice.auth import SUPPLIER_REFERRER
File "/home/fero/src/gasistafelice/gasistafelice/../gasistafelice/auth/__init__.py", line 63, in <module>
roles_dict[name] = register_role(name)
File "/home/fero/.virtualenvs/desmacerata/lib/python2.6/site-packages/permissions/utils.py", line 503, in register_role
role = Role.objects.create(name=name)
Change History
Note: See
TracTickets for help on using
tickets.

Fixed for auth application and for base/workflows.py
note: I had to rename workflows.py to fix "import workflows" statement