mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-26 17:36:01 +03:00
[GH-ISSUE #255] initial "syncdb --migrate" not working on PostgreSQL #240
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#240
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tonioo on GitHub (Dec 4, 2013).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/255
Originally assigned to: @tonioo on GitHub.
Originally created by Hervé Cauwelier on 2012-05-26T20:51:29Z
Hi,
I'm trying Modoboa but I can't install it.
Here is my configuration:
Cython==0.16
Django==1.3.1
South==0.7.5
django-ckeditorfiles==1.0
ipdb==0.6.1
ipython==0.12.1
lxml==2.3.4
psycopg2==2.4.5
py-rrdtool==0.2.1
pycrypto==2.6
sievelib==0.4
wsgiref==0.1.2
I first followed INSTALL but I got an error, see "first syncdb.txt" for the traceback and "first syncdb postgresql log.txt".
I then determined PostgreSQL was not recovering from a DatabaseError as you expected so I patched admin/init.py.
See "db_table_exists.patch", the "db_table_exists" functions comes from here: https://gist.github.com/527113/307c2dec09ceeb647b8fa1d6d49591f3352cb034
But then, as the migrations were running smoothly, it failed again, see "second syncdb.txt" and "second syncdb postgresql log.txt".
I continue looking for the cause of the error but your lights are welcome.
@tonioo commented on GitHub (Dec 4, 2013):
Posted by Antoine Nguyen on 2012-05-27T07:26:42Z
Hi, thanks for your feedback.
I've already encountered the first issue in a previous version. I'm not a postgres user and it's true I haven't tested that Modoboa works with it for a while :p
Anyway, the 'db_table_exists' function is already available into Modoboa (see lib/dbutils.py). The second issue is different, I need to investigate.
@tonioo commented on GitHub (Dec 4, 2013):
Posted by Antoine Nguyen on 2012-05-27T09:12:47Z
Applied in changeset commit:4eb8e69b3c28.
@tonioo commented on GitHub (Dec 4, 2013):
Posted by Antoine Nguyen on 2012-05-27T09:13:23Z
Can you confirm this fix is working for you?
@tonioo commented on GitHub (Dec 4, 2013):
Posted by Hervé Cauwelier on 2012-05-27T14:00:47Z
Thanks, changing the migration worked. But I wonder why it would not work for me. Could it be a regression in South 0.7.5?
I applied a slightly different patch to admin/init.py:
diff --git a/modoboa/admin/init.py b/modoboa/admin/init.py
index f5581eb..73f3bec 100644
--- a/modoboa/admin/init.py
+++ b/modoboa/admin/init.py
@@ -1,6 +1,7 @@
-- coding: utf-8 --
from modoboa.lib import parameters, events
+from modoboa.lib.dbutils import db_table_exists
from django.utils.translation import ugettext as _, ugettext_lazy
from django.db.utils import DatabaseError
from models import Extension
@@ -41,11 +42,9 @@ def enabled_applications():
:return: a list
"""
result = [("admin", "admin"), ("userprefs", "userprefs")]
try:
if db_table_exists("admin_extension"):
exts = Extension.objects.filter(enabled=True)
result += [(ext.name, ext.name) for ext in exts]
except DatabaseError:
return sorted(result, key=lambda e: e[0])
parameters.register_admin("DEFAULT_TOP_REDIRECTION", type="list", deflt="admin",
I don't like imports inside functions (expect for circular imports), and I prefer not to ignore any DatabaseError that are now legitimate.
@tonioo commented on GitHub (Dec 4, 2013):
Posted by Antoine Nguyen on 2012-05-27T17:56:32Z
You're right, I can remove the exception catching now.
About the import statement, as we are inside a init.py file, it is better to keep it inside the function to avoid a potential circular import.