Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

oauth, create user error, pk not updated

when creating user in askbot, we need the id of the newly created user in EmailFeedSetting, called from post_save. I look in the django create user code self.save_base(), the pk is not updated after create user, so id is null in User object. This leads to error in saving EmailFeedSetting().

How does Askbot handle this? Is there another place where user pk is updated?

Thanks,

Error Log user = User.objects.create_user(username, email) File "/home/pubmedly/lib/python2.7/django/contrib/auth/models.py", line 136, in create_user user.save(using=self._db) File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 460, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update)

File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 578, in save_base [Mon Aug 13 16:49:59 2012] [error] created=(not record_exists), raw=raw, using=using)

File "/home/pubmedly/lib/python2.7/django/dispatch/dispatcher.py", line 172, in send [Mon Aug 13 16:49:59 2012] [error] response = receiver(signal=self, sender=sender, **named)

File "/home/pubmedly/.virtualenvs/django131/lib/python2.7/site-packages/askbot/models/__init__.py", line 3000, in add_missing_subscriptions instance.add_missing_askbot_subscriptions()

File "/home/pubmedly/.virtualenvs/django131/lib/python2.7/site-packages/askbot/models/__init__.py", line 1761, in user_add_missing_askbot_subscriptions feed_setting.save()

File "/home/pubmedly/.virtualenvs/django131/lib/python2.7/site-packages/askbot/models/user.py", line 323, in save super(EmailFeedSetting,self).save(args,*kwargs)

File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 460, in save [Mon Aug 13 16:49:59 2012] [error] self.save_base(using=using, force_insert=force_insert, force_update=force_update)

File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 553, in save_base [Mon Aug 13 16:49:59 2012] [error] result = manager._insert(values, return_id=update_pk, using=using)

File "/home/pubmedly/lib/python2.7/django/db/models/manager.py", line 195, in _insert [Mon Aug 13 16:49:59 2012] [error] return insert_query(self.model, values, **kwargs)

File "/home/pubmedly/lib/python2.7/django/db/models/query.py", line 1436, in insert_query [Mon Aug 13 16:49:59 2012] [error] return query.get_compiler(using=using).execute_sql(return_id)

File "/home/pubmedly/lib/python2.7/django/db/models/sql/compiler.py", line 796, in execute_sql [Mon Aug 13 16:49:59 2012] [error] cursor = super(SQLInsertCompiler, self).execute_sql(None)

File "/home/pubmedly/lib/python2.7/django/db/models/sql/compiler.py", line 738, in execute_sql [Mon Aug 13 16:49:59 2012]

File "/home/pubmedly/lib/python2.7/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute [Mon Aug 13 16:49:59 2012]

IntegrityError: null value in column "subscriber_id" violates not-null constraint

oauth, create user error, pk not updated

when creating user in askbot, we need the id of the newly created user in EmailFeedSetting, called from post_save. I look in the django create user code self.save_base(), the pk is not updated after create user, so id is null in User object. This leads to error in saving EmailFeedSetting().

How does Askbot handle this? Is there another place where user pk is updated?

Thanks,

Error Log user = User.objects.create_user(username, email) File "/home/pubmedly/lib/python2.7/django/contrib/auth/models.py", line 136, in create_user user.save(using=self._db) File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 460, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update)

File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 578, in save_base [Mon Aug 13 16:49:59 2012] [error] created=(not record_exists), raw=raw, using=using)

File "/home/pubmedly/lib/python2.7/django/dispatch/dispatcher.py", line 172, in send [Mon Aug 13 16:49:59 2012] [error] response = receiver(signal=self, sender=sender, **named)

File "/home/pubmedly/.virtualenvs/django131/lib/python2.7/site-packages/askbot/models/__init__.py", line 3000, in add_missing_subscriptions instance.add_missing_askbot_subscriptions()

File "/home/pubmedly/.virtualenvs/django131/lib/python2.7/site-packages/askbot/models/__init__.py", line 1761, in user_add_missing_askbot_subscriptions feed_setting.save()

File "/home/pubmedly/.virtualenvs/django131/lib/python2.7/site-packages/askbot/models/user.py", line 323, in save super(EmailFeedSetting,self).save(args,*kwargs)

File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 460, in save [Mon Aug 13 16:49:59 2012] [error] self.save_base(using=using, force_insert=force_insert, force_update=force_update)

File "/home/pubmedly/lib/python2.7/django/db/models/base.py", line 553, in save_base [Mon Aug 13 16:49:59 2012] [error] result = manager._insert(values, return_id=update_pk, using=using)

File "/home/pubmedly/lib/python2.7/django/db/models/manager.py", line 195, in _insert [Mon Aug 13 16:49:59 2012] [error] return insert_query(self.model, values, **kwargs)

File "/home/pubmedly/lib/python2.7/django/db/models/query.py", line 1436, in insert_query [Mon Aug 13 16:49:59 2012] [error] return query.get_compiler(using=using).execute_sql(return_id)

File "/home/pubmedly/lib/python2.7/django/db/models/sql/compiler.py", line 796, in execute_sql [Mon Aug 13 16:49:59 2012] [error] cursor = super(SQLInsertCompiler, self).execute_sql(None)

File "/home/pubmedly/lib/python2.7/django/db/models/sql/compiler.py", line 738, in execute_sql [Mon Aug 13 16:49:59 2012]

File "/home/pubmedly/lib/python2.7/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute [Mon Aug 13 16:49:59 2012]

IntegrityError: null value in column "subscriber_id" violates not-null constraint