添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
I have search far and wide for some help regarding the Internal Error
and i can't find any help. I have absolutely no idea why this is
showing it doesn't make any sens. I just want a way to catch it but
that is impossible. I would appreciate any help.


Traceback:
File "C:\Python26\Lib\site-packages\django\core\handlers\base.py" in
get_response
99. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\Python26\Lib\site-packages\iitcms\auth\decorators.py" in
_checklogin
18. return view_func(request, *args, **kwargs)
File "C:\Python26\Lib\site-packages\iitcms\products\my_admin\views.py"
in import_excel
1312. msg = prepare_products(request)
File "C:\Python26\Lib\site-packages\iitcms\products\utils.py" in
prepare_products
115. error_list, ignored_list_number, new_list_number,
edited_list_number = create_products(products, category)
File "C:\Python26\Lib\site-packages\iitcms\products\utils.py" in
create_products
164. rezult = create_product(category, product, cat_poz,
name_poz, description_poz, price_poz, codes_poz, stoc_poz, um_poz)
File "C:\Python26\Lib\site-packages\iitcms\products\utils.py" in
create_product
305. new_product =
Product.objects.get(product_name__iexact = product_name)
File "C:\Python26\Lib\site-packages\django\db\models\manager.py" in
get
119. return self.get_query_set().get(*args, **kwargs)
File "C:\Python26\Lib\site-packages\django\db\models\query.py" in get
293. num = len(clone)
File "C:\Python26\Lib\site-packages\django\db\models\query.py" in
__len__
74. self._result_cache = list(self.iterator())
File "C:\Python26\Lib\site-packages\django\db\models\query.py" in
iterator
231. for row in self.query.results_iter():
File "C:\Python26\Lib\site-packages\django\db\models\sql\query.py" in
results_iter
281. for rows in self.execute_sql(MULTI):
File "C:\Python26\Lib\site-packages\django\db\models\sql\query.py" in
execute_sql
2373. cursor.execute(sql, params)
File "C:\Python26\Lib\site-packages\django\db\backends\util.py" in
execute
19. return self.cursor.execute(sql, params)

Exception Type: InternalError at /products/admin/import/
Exception Value: current transaction is aborted, commands ignored
until end of transaction block
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
The problems is that some part of your code is screwing up something with your database connection. Then, some other part of your code tries to use the database and it can't, so it breaks. Find out where the error is coming from (from your traceback), then figure out what code executes before that code.

Shawn
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
i actually found a solution. i don't know what the problem is... and
it wouldn't mater anyway. I just wanted to catch and show a message
about it. You should you something like this:

from django.db import transaction

@transaction.commit_manually
def view(request):
try:
#do something with database
transaction.commit()
except:
transaction.rollback()
#return error message.


Thank you for the help.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
I ran into the same problem, but have avoided the "commit manually" and used
try:
#do my normal stuff
except psycopg2.InternalError, e:
#transaction.rollback_unless_managed()
django.db.connection._rollback()

Again, I am not sure whether it is a signal handler or some internal
Django save processing that is causing the problem.

I didn't use rollback_unless_managed because I didn't understand the
interaction between managed and unmanaged.

Maybe someone can explain the issue.

Carl
Post by t***@gmail.com
i actually found a solution. i don't know what the problem is... and
it wouldn't mater anyway. I just wanted to catch and show a message
from django.db import transaction
@transaction.commit_manually
#do something with database
transaction.commit()
transaction.rollback()
#return error message.
Thank you for the help.
--
Carl Zmola
301-562-1900 x315
***@woti.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.