do not lock table with backends other than postgresql (postgresql specific syntax) (fixes #52)
--- a/src/cm/models.py Tue Aug 03 16:42:05 2010 +0200
+++ b/src/cm/models.py Tue Aug 03 18:01:35 2010 +0200
@@ -600,10 +600,11 @@
def create_inactive_user(self, email, send_invitation, **kwargs):
- #prevent concurrent access
- cursor = connection.cursor()
- sql = "LOCK TABLE auth_user IN EXCLUSIVE MODE"
- cursor.execute(sql)
+ if 'postgresql' in settings.DATABASE_ENGINE:
+ #prevent concurrent access
+ cursor = connection.cursor()
+ sql = "LOCK TABLE auth_user IN EXCLUSIVE MODE"
+ cursor.execute(sql)
try:
user_with_email = User.objects.get(email__iexact=email)
--- a/src/cm/tests/__init__.py Tue Aug 03 16:42:05 2010 +0200
+++ b/src/cm/tests/__init__.py Tue Aug 03 18:01:35 2010 +0200
@@ -6,4 +6,5 @@
from cm.tests.test_history import *
from cm.tests.test_security import *
from cm.tests.test_activity import *
+from cm.tests.test_registration import *
from cm.tests.test_api import *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cm/tests/test_registration.py Tue Aug 03 18:01:35 2010 +0200
@@ -0,0 +1,16 @@
+from django.test import TestCase
+from django.test.client import Client
+from django.core import management
+
+
+from cm.models import *
+from cm.security import *
+from cm.tests.test_comment_positioning import create_comment
+
+
+class RegistrationTest(TestCase):
+ fixtures = ['roles_generic','test_content']
+
+ def test_registration(self):
+ user = UserProfile.objects.create_inactive_user('no@noreply', False)
+
\ No newline at end of file