eXt
unread,Mar 20, 2012, 4:32:47 PM3/20/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-lfc
Hi,
I've ecountered a problem when I tried to reinstall app in manage
panel.
1. I have an application "MyTheme"
2. I have a Template "Home" that I register/unregister in my app's
__init__.py
3. I have a Page "Home Page that uses the "Home" Template
4. I have a Portal that has a Page set to "Home Page"
Now, when I click "Reinstall" to reinstall "MyTheme" app:
1. App's ungregister method is called
2. Unregister method deletes all registered templates including "Home"
template
3. Cascade starts so after "Home" Template is deleted also "Home Page"
Page is deleted (and all other pages that use that template) and also
Portal is deleted.
4. Register method is called and I see:
Traceback:
File "/home/ext/dev/proj_lfc/eggs/Django-1.1.4-py2.7.egg/django/core/
handlers/base.py" in get_response
99. response = callback(request, *callback_args,
**callback_kwargs)
File "/home/ext/dev/proj_lfc/parts/lfc/lfc/manage/views.py" in portal
224. portal = get_portal()
File "/home/ext/dev/proj_lfc/parts/lfc/lfc/utils/__init__.py" in
get_portal
128. portal = lfc.models.Portal.objects.filter()[0]
File "/home/ext/dev/proj_lfc/eggs/Django-1.1.4-py2.7.egg/django/db/
models/query.py" in __getitem__
160. return list(qs)[0]
Exception Type: IndexError at /manage/
Exception Value: list index out of range
This is because there is no Portal object. This also means that I
can't use my web page any more - neither manage nor admin panel works.
(of course I can restore db backup or manually add portal object do
db, but it is still rahter hard way)
So:
1. Shouldn't app reinstallation just overwrite templates instead of
removing and adding them?
2. Assumption that there always is a default portal is wrong.
Any thoughts how to deal with app reinstallation??