hi,
I have a view that takes a sentence in unicode from a database,
splits it into words and dumps those words in the Word table. The
'word' in word table is unique, and it is expected that duplicates be
rejected, so I put 'save()' within a try-except statement. If my view
does one record at a time - it works perfectly. If I try to loop
through all the records, I get a ProgrammingError complaining of
improper formatting - but am unable to find out where exactly the
formatting is improper. If I put this function in the 'save' method
of the model - I get the same error. This is the view that works:
def lessontodict(request,id):
"""
After a lesson is approved, the words, both written and
spoken are
dumped into the word table
"""
line = Lesson_line.objects.filter(lesson=id)
lng = line.lesson.language
spkwords = line.sentencespk.split()
for wrd in spkwords:
try:
wd = wrd.strip('!.,?')
w = Word(word=wd,written=False,
language=lng)
w.save()
except:
pass
wrtwords = line.sentencewrt.split()
for wrd in wrtwords:
try:
wd = wrd.strip('!.,?')
w = Word(word=wd,written=True,
language=lng)
w.save()
except:
pass
t = loader.get_template("web/updated.html")
c=Context({'request':request})
return HttpResponse(t.render(c))
This is the save in the model that doesnt work:
def save(self):
"""dumping all the words in the word database"""
super(Lesson_line,self).save()
spkwords = self.sentencespk.split()
for wrd in spkwords:
# get around handling duplicates
try:
lng=self.lesson.language
wd = wrd.strip('!.,?')
w = Word(word=wd,written=False,
language=lng)
w.save()
except:
pass
wrtwords = self.sentencewrt.split()
for wrd in wrtwords:
try:
lng=self.lesson.language
wd = wrd.strip('!.,?')
w = Word(word=wd,written=True,
language=lng)
w.save()
except:
pass
and here is the error message: I have put the whole thing, because I
just cannot identify where it is going wrong
ProgrammingError at /web/admin/web/lesson_line/1/
ERROR: current transaction is aborted, commands ignored until end of
transaction block SET client_encoding to 'UNICODE'
Request Method: POST
Request URL: http://arichuvadi.nrcfosshelpline.in/web/admin/web/
lesson_line/1/
Exception Type: ProgrammingError
Exception Value: ERROR: current transaction is aborted, commands
ignored until end of transaction block SET client_encoding to 'UNICODE'
Exception Location: /usr/lib/python2.4/site-packages/django/db/
backends/postgresql/base.py in _cursor, line 103
Python Executable: /usr/bin/python
Python Version: 2.4.4
Traceback (innermost last)
Switch back to interactive view
* /usr/lib/python2.4/site-packages/django/core/handlers/base.py
in _real_get_response
74. # Apply view middleware
75. for middleware_method in self._view_middleware:
76. response = middleware_method(request, callback,
callback_args, callback_kwargs)
77. if response:
78. return response
79.
80. try:
81. response = callback(request, *callback_args,
**callback_kwargs) ...
82. except Exception, e:
83. # If the view raised an exception, run it through exception
84. # middleware, and if the exception middleware returns a
85. # response, use that. Otherwise, reraise the exception.
86. for middleware_method in self._exception_middleware:
87. response = middleware_method(request, e)
▶ Local vars
Variable Value
callback
<function _checklogin at 0x4e34f17c>
callback_args
(u'web', u'lesson_line', u'1')
callback_kwargs
{}
debug
<module 'django.views.debug' from '/usr/lib/python2.4/site-
packages/django/views/debug.py'>
e
<psycopg.ProgrammingError instance at 0x4e35cacc>
exceptions
<module 'django.core.exceptions' from '/usr/lib/python2.4/site-
packages/django/core/exceptions.pyc'>
mail_admins
<function mail_admins at 0x4e04ed14>
middleware_method
<bound method XViewMiddleware.process_view of
<django.middleware.doc.XViewMiddleware object at 0x4e05ccac>>
request
<ModPythonRequest\npath:/web/admin/web/lesson_line/1/,
\nGET:<MultiValueDict: {}>,\nPOST:<MultiValueDict: {u'sentencewrt':
[u'\u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95\u0bb3\u0bcd! \u0b9a
\u0b9e\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd
\u0b95\u0bb3\u0bcd!'], u'soundspk': [u'spoken/t_1_1_v_.ogg'],
u'priority': [u'1'], u'soundwrt': [u'written/t_1_1_s_.ogg'],
u'english': [u'Welcome! Sanjay Welcome!'], u'lesson': [u'2'],
u'sentencespk': [u'\u0bb5\u0bbe\u0b99\u0bcd\u0b95! \u0b9a\u0b9e\u0bcd
\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0b99\u0bcd\u0b95! ']}>,\nCOOKIES:
{'sessionid': '841e4b05d20ca71d337ca2a31dbe9d98'},\nMETA:
{'AUTH_TYPE': None,\n 'CONTENT_LENGTH': 0L,\n 'CONTENT_TYPE': None,\n
'GATEWAY_INTERFACE': 'CGI/1.1',\n 'HTTP_ACCEPT': 'text/
xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5',\n 'HTTP_ACCEPT_CHARSET':
'ISO-8859-1,utf-8;q=0.7,*;q=0.7',\n 'HTTP_ACCEPT_ENCODING':
'gzip,deflate',\n 'HTTP_ACCEPT_LANGUAGE':
'en,fi;q=0.8,ta;q=0.6,pl;q=0.4,en-us;q=0.2',\n 'HTTP_CONNECTION':
'keep-alive',\n 'HTTP_CONTENT_LENGTH': '1342',\n 'HTTP_CONTENT_TYPE':
'multipart/form-data;
boundary=---------------------------168072824752491622650073',\n
'HTTP_COOKIE': 'sessionid=841e4b05d20ca71d337ca2a31dbe9d98',\n
'HTTP_HOST': 'arichuvadi.nrcfosshelpline.in',\n 'HTTP_KEEP_ALIVE':
'300',\n 'HTTP_REFERER': 'http://arichuvadi.nrcfosshelpline.in/web/
admin/web/lesson_line/1/',\n 'HTTP_USER_AGENT': 'Mozilla/5.0
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.7) Gecko/20070914
Firefox/2.0.0.7',\n 'PATH_INFO': '/admin/web/lesson_line/1/',\n
'PATH_TRANSLATED': None,\n 'QUERY_STRING': None,\n 'REMOTE_ADDR':
'117.97.129.207',\n 'REMOTE_HOST': None,\n 'REMOTE_IDENT': None,\n
'REMOTE_USER': None,\n 'REQUEST_METHOD': 'POST',\n 'SCRIPT_NAME':
None,\n 'SERVER_NAME': 'arichuvadi.nrcfosshelpline.in',\n
'SERVER_PORT': 0,\n 'SERVER_PROTOCOL': 'HTTP/1.1',\n
'SERVER_SOFTWARE': 'mod_python'}>
resolver
<RegexURLResolver arichuvadi.urls ^/>
response
None
self
<django.core.handlers.modpython.ModPythonHandler object at
0x4df8344c>
settings
<django.conf.LazySettings object at 0x4dfe0fec>
urlconf
u'arichuvadi.urls'
urlresolvers
<module 'django.core.urlresolvers' from '/usr/lib/python2.4/
site-packages/django/core/urlresolvers.py'>
* /usr/lib/python2.4/site-packages/django/contrib/admin/views/
decorators.py in _checklogin
48. def _checklogin(request, *args, **kwargs):
49. if request.user.is_authenticated() and
request.user.is_staff:
50. # The user is valid. Continue to the admin page.
51. if 'post_data' in request.POST:
52. # User must have re-authenticated through a different
window
53. # or tab.
54. request.POST = _decode_post_data(request.POST['post_data'])
55. return view_func(request, *args, **kwargs) ...
56.
57. assert hasattr(request, 'session'), "The Django admin
requires session middleware to be installed. Edit your
MIDDLEWARE_CLASSES setting to insert
'django.contrib.sessions.middleware.SessionMiddleware'."
58.
59. # If this isn't already the login page, display it.
60. if LOGIN_FORM_KEY not in request.POST:
61. if request.POST:
▶ Local vars
Variable Value
args
(u'web', u'lesson_line', u'1')
kwargs
{}
request
<ModPythonRequest\npath:/web/admin/web/lesson_line/1/,
\nGET:<MultiValueDict: {}>,\nPOST:<MultiValueDict: {u'sentencewrt':
[u'\u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95\u0bb3\u0bcd! \u0b9a
\u0b9e\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd
\u0b95\u0bb3\u0bcd!'], u'soundspk': [u'spoken/t_1_1_v_.ogg'],
u'priority': [u'1'], u'soundwrt': [u'written/t_1_1_s_.ogg'],
u'english': [u'Welcome! Sanjay Welcome!'], u'lesson': [u'2'],
u'sentencespk': [u'\u0bb5\u0bbe\u0b99\u0bcd\u0b95! \u0b9a\u0b9e\u0bcd
\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0b99\u0bcd\u0b95! ']}>,\nCOOKIES:
{'sessionid': '841e4b05d20ca71d337ca2a31dbe9d98'},\nMETA:
{'AUTH_TYPE': None,\n 'CONTENT_LENGTH': 0L,\n 'CONTENT_TYPE': None,\n
'GATEWAY_INTERFACE': 'CGI/1.1',\n 'HTTP_ACCEPT': 'text/
xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5',\n 'HTTP_ACCEPT_CHARSET':
'ISO-8859-1,utf-8;q=0.7,*;q=0.7',\n 'HTTP_ACCEPT_ENCODING':
'gzip,deflate',\n 'HTTP_ACCEPT_LANGUAGE':
'en,fi;q=0.8,ta;q=0.6,pl;q=0.4,en-us;q=0.2',\n 'HTTP_CONNECTION':
'keep-alive',\n 'HTTP_CONTENT_LENGTH': '1342',\n 'HTTP_CONTENT_TYPE':
'multipart/form-data;
boundary=---------------------------168072824752491622650073',\n
'HTTP_COOKIE': 'sessionid=841e4b05d20ca71d337ca2a31dbe9d98',\n
'HTTP_HOST': 'arichuvadi.nrcfosshelpline.in',\n 'HTTP_KEEP_ALIVE':
'300',\n 'HTTP_REFERER': 'http://arichuvadi.nrcfosshelpline.in/web/
admin/web/lesson_line/1/',\n 'HTTP_USER_AGENT': 'Mozilla/5.0
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.7) Gecko/20070914
Firefox/2.0.0.7',\n 'PATH_INFO': '/admin/web/lesson_line/1/',\n
'PATH_TRANSLATED': None,\n 'QUERY_STRING': None,\n 'REMOTE_ADDR':
'117.97.129.207',\n 'REMOTE_HOST': None,\n 'REMOTE_IDENT': None,\n
'REMOTE_USER': None,\n 'REQUEST_METHOD': 'POST',\n 'SCRIPT_NAME':
None,\n 'SERVER_NAME': 'arichuvadi.nrcfosshelpline.in',\n
'SERVER_PORT': 0,\n 'SERVER_PROTOCOL': 'HTTP/1.1',\n
'SERVER_SOFTWARE': 'mod_python'}>
view_func
<function _wrapped_view_func at 0x4e34f144>
* /usr/lib/python2.4/site-packages/django/views/decorators/
cache.py in _wrapped_view_func
32.
33. def never_cache(view_func):
34. """
35. Decorator that adds headers to a response so that it will
36. never be cached.
37. """
38. def _wrapped_view_func(request, *args, **kwargs):
39. response = view_func(request, *args, **kwargs) ...
40. add_never_cache_headers(response)
41. return response
42. return _wrapped_view_func
▶ Local vars
Variable Value
args
(u'web', u'lesson_line', u'1')
kwargs
{}
request
<ModPythonRequest\npath:/web/admin/web/lesson_line/1/,
\nGET:<MultiValueDict: {}>,\nPOST:<MultiValueDict: {u'sentencewrt':
[u'\u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95\u0bb3\u0bcd! \u0b9a
\u0b9e\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd
\u0b95\u0bb3\u0bcd!'], u'soundspk': [u'spoken/t_1_1_v_.ogg'],
u'priority': [u'1'], u'soundwrt': [u'written/t_1_1_s_.ogg'],
u'english': [u'Welcome! Sanjay Welcome!'], u'lesson': [u'2'],
u'sentencespk': [u'\u0bb5\u0bbe\u0b99\u0bcd\u0b95! \u0b9a\u0b9e\u0bcd
\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0b99\u0bcd\u0b95! ']}>,\nCOOKIES:
{'sessionid': '841e4b05d20ca71d337ca2a31dbe9d98'},\nMETA:
{'AUTH_TYPE': None,\n 'CONTENT_LENGTH': 0L,\n 'CONTENT_TYPE': None,\n
'GATEWAY_INTERFACE': 'CGI/1.1',\n 'HTTP_ACCEPT': 'text/
xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5',\n 'HTTP_ACCEPT_CHARSET':
'ISO-8859-1,utf-8;q=0.7,*;q=0.7',\n 'HTTP_ACCEPT_ENCODING':
'gzip,deflate',\n 'HTTP_ACCEPT_LANGUAGE':
'en,fi;q=0.8,ta;q=0.6,pl;q=0.4,en-us;q=0.2',\n 'HTTP_CONNECTION':
'keep-alive',\n 'HTTP_CONTENT_LENGTH': '1342',\n 'HTTP_CONTENT_TYPE':
'multipart/form-data;
boundary=---------------------------168072824752491622650073',\n
'HTTP_COOKIE': 'sessionid=841e4b05d20ca71d337ca2a31dbe9d98',\n
'HTTP_HOST': 'arichuvadi.nrcfosshelpline.in',\n 'HTTP_KEEP_ALIVE':
'300',\n 'HTTP_REFERER': 'http://arichuvadi.nrcfosshelpline.in/web/
admin/web/lesson_line/1/',\n 'HTTP_USER_AGENT': 'Mozilla/5.0
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.7) Gecko/20070914
Firefox/2.0.0.7',\n 'PATH_INFO': '/admin/web/lesson_line/1/',\n
'PATH_TRANSLATED': None,\n 'QUERY_STRING': None,\n 'REMOTE_ADDR':
'117.97.129.207',\n 'REMOTE_HOST': None,\n 'REMOTE_IDENT': None,\n
'REMOTE_USER': None,\n 'REQUEST_METHOD': 'POST',\n 'SCRIPT_NAME':
None,\n 'SERVER_NAME': 'arichuvadi.nrcfosshelpline.in',\n
'SERVER_PORT': 0,\n 'SERVER_PROTOCOL': 'HTTP/1.1',\n
'SERVER_SOFTWARE': 'mod_python'}>
view_func
<function change_stage at 0x4e34f10c>
* /usr/lib/python2.4/site-packages/django/contrib/admin/views/
main.py in change_stage
343. if manipulator.fields_changed:
344. change_message.append(_('Changed %s.') % get_text_list
(manipulator.fields_changed, _('and')))
345. if manipulator.fields_deleted:
346. change_message.append(_('Deleted %s.') % get_text_list
(manipulator.fields_deleted, _('and')))
347. change_message = ' '.join(change_message)
348. if not change_message:
349. change_message = _('No fields changed.')
350. LogEntry.objects.log_action(request.user.id,
ContentType.objects.get_for_model(model).id, pk_value, force_unicode
(new_object), CHANGE, change_message) ...
351.
352. msg = _('The %(name)s "%(obj)s" was changed
successfully.') % {'name': force_unicode(opts.verbose_name), 'obj':
force_unicode(new_object)}
353. if "_continue" in request.POST:
354. request.user.message_set.create(message=msg + ' ' + _
("You may edit it again below."))
355. if '_popup' in request.REQUEST:
356. return HttpResponseRedirect(request.path + "?_popup=1")
▶ Local vars
Variable Value
app_label
u'web'
change_message
u'No fields changed.'
errors
{}
manipulator
<django.db.models.manipulators.ChangeManipulator object at
0x4e4108cc>
model
<class 'arichuvadi.web.models.Lesson_line'>
model_name
u'lesson_line'
new_data
<MultiValueDict: {u'soundwrt_file': [], u'soundspk_file': [],
u'sentencewrt': [u'\u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95\u0bb3
\u0bcd! \u0b9a\u0b9e\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0bb0\u0bc1
\u0b99\u0bcd\u0b95\u0bb3\u0bcd!'], u'soundspk': [u'spoken/
t_1_1_v_.ogg'], u'priority': [1], u'soundwrt': [u'written/
t_1_1_s_.ogg'], u'lesson_id': [u'2'], u'english': [u'Welcome! Sanjay
Welcome!'], u'lesson': [u'2'], u'sentencespk': [u'\u0bb5\u0bbe\u0b99
\u0bcd\u0b95! \u0b9a\u0b9e\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0b99
\u0bcd\u0b95! ']}>
new_object
<Lesson_line: Tamil Conversation with
Guest,வாருங்கள்! சஞ்சய்
வாருங்கள்!>
object_id
u'1'
opts
<Options for Lesson_line>
pk_value
u'1'
request
<ModPythonRequest\npath:/web/admin/web/lesson_line/1/,
\nGET:<MultiValueDict: {}>,\nPOST:<MultiValueDict: {u'sentencewrt':
[u'\u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95\u0bb3\u0bcd! \u0b9a
\u0b9e\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd
\u0b95\u0bb3\u0bcd!'], u'soundspk': [u'spoken/t_1_1_v_.ogg'],
u'priority': [u'1'], u'soundwrt': [u'written/t_1_1_s_.ogg'],
u'english': [u'Welcome! Sanjay Welcome!'], u'lesson': [u'2'],
u'sentencespk': [u'\u0bb5\u0bbe\u0b99\u0bcd\u0b95! \u0b9a\u0b9e\u0bcd
\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0b99\u0bcd\u0b95! ']}>,\nCOOKIES:
{'sessionid': '841e4b05d20ca71d337ca2a31dbe9d98'},\nMETA:
{'AUTH_TYPE': None,\n 'CONTENT_LENGTH': 0L,\n 'CONTENT_TYPE': None,\n
'GATEWAY_INTERFACE': 'CGI/1.1',\n 'HTTP_ACCEPT': 'text/
xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5',\n 'HTTP_ACCEPT_CHARSET':
'ISO-8859-1,utf-8;q=0.7,*;q=0.7',\n 'HTTP_ACCEPT_ENCODING':
'gzip,deflate',\n 'HTTP_ACCEPT_LANGUAGE':
'en,fi;q=0.8,ta;q=0.6,pl;q=0.4,en-us;q=0.2',\n 'HTTP_CONNECTION':
'keep-alive',\n 'HTTP_CONTENT_LENGTH': '1342',\n 'HTTP_CONTENT_TYPE':
'multipart/form-data;
boundary=---------------------------168072824752491622650073',\n
'HTTP_COOKIE': 'sessionid=841e4b05d20ca71d337ca2a31dbe9d98',\n
'HTTP_HOST': 'arichuvadi.nrcfosshelpline.in',\n 'HTTP_KEEP_ALIVE':
'300',\n 'HTTP_REFERER': 'http://arichuvadi.nrcfosshelpline.in/web/
admin/web/lesson_line/1/',\n 'HTTP_USER_AGENT': 'Mozilla/5.0
(Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.7) Gecko/20070914
Firefox/2.0.0.7',\n 'PATH_INFO': '/admin/web/lesson_line/1/',\n
'PATH_TRANSLATED': None,\n 'QUERY_STRING': None,\n 'REMOTE_ADDR':
'117.97.129.207',\n 'REMOTE_HOST': None,\n 'REMOTE_IDENT': None,\n
'REMOTE_USER': None,\n 'REQUEST_METHOD': 'POST',\n 'SCRIPT_NAME':
None,\n 'SERVER_NAME': 'arichuvadi.nrcfosshelpline.in',\n
'SERVER_PORT': 0,\n 'SERVER_PROTOCOL': 'HTTP/1.1',\n
'SERVER_SOFTWARE': 'mod_python'}>
* /usr/lib/python2.4/site-packages/django/contrib/contenttypes/
models.py in get_for_model
13. key = (opts.app_label, opts.object_name.lower())
14. try:
15. ct = CONTENT_TYPE_CACHE[key]
16. except KeyError:
17. # The smart_unicode() is needed around
opts.verbose_name_raw because it might
18. # be a django.utils.functional.__proxy__ object.
19. ct, created = self.model._default_manager.get_or_create
(app_label=key[0],
20. model=key[1], defaults={'name': smart_unicode
(opts.verbose_name_raw)}) ...
21. CONTENT_TYPE_CACHE[key] = ct
22. return ct
23.
24. def clear_cache(self):
25. """
26. Clear out the content-type cache. This needs to happen
during database
▶ Local vars
Variable Value
key
('web', 'lesson_line')
model
<class 'arichuvadi.web.models.Lesson_line'>
opts
<Options for Lesson_line>
self
<django.contrib.contenttypes.models.ContentTypeManager object
at 0x4e27da4c>
* /usr/lib/python2.4/site-packages/django/db/models/manager.py
in get_or_create
65. def extra(self, *args, **kwargs):
66. return self.get_query_set().extra(*args, **kwargs)
67.
68. def get(self, *args, **kwargs):
69. return self.get_query_set().get(*args, **kwargs)
70.
71. def get_or_create(self, **kwargs):
72. return self.get_query_set().get_or_create(**kwargs) ...
73.
74. def create(self, **kwargs):
75. return self.get_query_set().create(**kwargs)
76.
77. def filter(self, *args, **kwargs):
78. return self.get_query_set().filter(*args, **kwargs)
▶ Local vars
Variable Value
kwargs
{'app_label': 'web', 'defaults': {'name': u'lesson_line'},
'model': 'lesson_line'}
self
<django.contrib.contenttypes.models.ContentTypeManager object
at 0x4e27da4c>
* /usr/lib/python2.4/site-packages/django/db/models/query.py in
get_or_create
278. Looks up an object with the given kwargs, creating one
if necessary.
279. Returns a tuple of (object, created), where created is a
boolean
280. specifying whether an object was created.
281. """
282. assert len(kwargs), 'get_or_create() must be passed at
least one keyword argument'
283. defaults = kwargs.pop('defaults', {})
284. try:
285. return self.get(**kwargs), False ...
286. except self.model.DoesNotExist:
287. params = dict([(k, v) for k, v in kwargs.items() if '__'
not in k])
288. params.update(defaults)
289. obj = self.model(**params)
290. obj.save()
291. return obj, True
▶ Local vars
Variable Value
defaults
{'name': u'lesson_line'}
kwargs
{'model': 'lesson_line', 'app_label': 'web'}
self
Error in formatting: ERROR: current transaction is aborted,
commands ignored until end of transaction block SET client_encoding
to 'UNICODE'
* /usr/lib/python2.4/site-packages/django/db/models/query.py in get
254.
255. def get(self, *args, **kwargs):
256. "Performs the SELECT and returns a single object
matching the given keyword arguments."
257. clone = self.filter(*args, **kwargs)
258. # clean up SQL by removing unneeded ORDER BY
259. if not clone._order_by:
260. clone._order_by = ()
261. obj_list = list(clone) ...
262. if len(obj_list) < 1:
263. raise self.model.DoesNotExist, "%s matching query does
not exist." % self.model._meta.object_name
264. assert len(obj_list) == 1, "get() returned more than one
%s -- it returned %s! Lookup parameters were %s" %
(self.model._meta.object_name, len(obj_list), kwargs)
265. return obj_list[0]
266.
267. def create(self, **kwargs):
▶ Local vars
Variable Value
args
()
clone
Error in formatting: ERROR: current transaction is aborted,
commands ignored until end of transaction block SET client_encoding
to 'UNICODE'
kwargs
{'model': 'lesson_line', 'app_label': 'web'}
self
Error in formatting: ERROR: current transaction is aborted,
commands ignored until end of transaction block SET client_encoding
to 'UNICODE'
* /usr/lib/python2.4/site-packages/django/db/models/query.py in
__iter__
107. def __repr__(self):
108. return repr(self._get_data())
109.
110. def __len__(self):
111. return len(self._get_data())
112.
113. def __iter__(self):
114. return iter(self._get_data()) ...
115.
116. def __getitem__(self, k):
117. "Retrieve an item or slice from the set of results."
118. if not isinstance(k, (slice, int, long)):
119. raise TypeError
120. assert (not isinstance(k, slice) and (k >= 0)) \
▶ Local vars
Variable Value
self
Error in formatting: ERROR: current transaction is aborted,
commands ignored until end of transaction block SET client_encoding
to 'UNICODE'
* /usr/lib/python2.4/site-packages/django/db/models/query.py in
_get_data
475. if (self._order_by is not None and len(self._order_by) >
0) and \
476. (combined._order_by is None or len(combined._order_by)
== 0):
477. combined._order_by = self._order_by
478. return combined
479.
480. def _get_data(self):
481. if self._result_cache is None:
482. self._result_cache = list(self.iterator()) ...
483. return self._result_cache
484.
485. def _get_sql_clause(self):
486. qn = connection.ops.quote_name
487. opts = self.model._meta
488.
▶ Local vars
Variable Value
self
Error in formatting: ERROR: current transaction is aborted,
commands ignored until end of transaction block SET client_encoding
to 'UNICODE'
* /usr/lib/python2.4/site-packages/django/db/models/query.py in
iterator
181. except EmptyResultSet:
182. raise StopIteration
183.
184. # self._select is a dictionary, and dictionaries' key
order is
185. # undefined, so we convert it to a list of tuples.
186. extra_select = self._select.items()
187.
188. cursor = connection.cursor() ...
189. cursor.execute("SELECT " + (self._distinct and "DISTINCT
" or "") + ",".join(select) + sql, params)
190.
191. fill_cache = self._select_related
192. fields = self.model._meta.fields
193. index_end = len(fields)
194. has_resolve_columns = hasattr(self, 'resolve_columns')
▶ Local vars
Variable Value
extra_select
[]
params
['lesson_line', 'web']
select
['"django_content_type"."id"', '"django_content_type"."name"',
'"django_content_type"."app_label"', '"django_content_type"."model"']
self
Error in formatting: ERROR: current transaction is aborted,
commands ignored until end of transaction block SET client_encoding
to 'UNICODE'
sql
u' FROM "django_content_type" WHERE
("django_content_type"."model" = %s AND
"django_content_type"."app_label" = %s)'
* /usr/lib/python2.4/site-packages/django/db/backends/
__init__.py in cursor
26. def close(self):
27. if self.connection is not None:
28. self.connection.close()
29. self.connection = None
30.
31. def cursor(self):
32. from django.conf import settings
33. cursor = self._cursor(settings) ...
34. if settings.DEBUG:
35. return self.make_debug_cursor(cursor)
36. return cursor
37.
38. def make_debug_cursor(self, cursor):
39. from django.db.backends import util
▶ Local vars
Variable Value
self
<django.db.backends.postgresql.base.DatabaseWrapper object at
0x4e0d289c>
settings
<django.conf.LazySettings object at 0x4dfe0fec>
* /usr/lib/python2.4/site-packages/django/db/backends/postgresql/
base.py in _cursor
96. if settings.DATABASE_PORT:
97. conn_string += " port=%s" % settings.DATABASE_PORT
98. self.connection = Database.connect(conn_string,
**self.options)
99. self.connection.set_isolation_level(1) # make
transactions transparent to all cursors
100. cursor = self.connection.cursor()
101. if set_tz:
102. cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
103. cursor.execute("SET client_encoding to 'UNICODE'") ...
104. cursor = UnicodeCursorWrapper(cursor, 'utf-8')
105. return cursor
106.
107. def typecast_string(s):
108. """
109. Cast all returned strings to unicode strings.
▶ Local vars
Variable Value
cursor
<cursor object at 0x4e32fd40>
self
<django.db.backends.postgresql.base.DatabaseWrapper object at
0x4e0d289c>
set_tz
False
settings
<django.conf.LazySettings object at 0x4dfe0fec>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in _real_get_response
81. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
decorators.py" in _checklogin
55. return view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
39. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/
main.py" in change_stage
350. LogEntry.objects.log_action(request.user.id,
ContentType.objects.get_for_model(model).id, pk_value, force_unicode
(new_object), CHANGE, change_message)
File "/usr/lib/python2.4/site-packages/django/contrib/contenttypes/
models.py" in get_for_model
20. model=key[1], defaults={'name': smart_unicode
(opts.verbose_name_raw)})
File "/usr/lib/python2.4/site-packages/django/db/models/manager.py"
in get_or_create
72. return self.get_query_set().get_or_create(**kwargs)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
get_or_create
285. return self.get(**kwargs), False
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in get
261. obj_list = list(clone)
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
__iter__
114. return iter(self._get_data())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_get_data
482. self._result_cache = list(self.iterator())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
iterator
188. cursor = connection.cursor()
File "/usr/lib/python2.4/site-packages/django/db/backends/
__init__.py" in cursor
33. cursor = self._cursor(settings)
File "/usr/lib/python2.4/site-packages/django/db/backends/postgresql/
base.py" in _cursor
103. cursor.execute("SET client_encoding to 'UNICODE'")
ProgrammingError at /web/admin/web/lesson_line/1/
ERROR: current transaction is aborted, commands ignored until end
of transaction block SET client_encoding to 'UNICODE'
Request information
GET
No GET data
POST
Variable Value
sentencewrt
u'\u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95\u0bb3\u0bcd! \u0b9a\u0b9e
\u0bcd\u0b9a\u0baf\u0bcd \u0bb5\u0bbe\u0bb0\u0bc1\u0b99\u0bcd\u0b95
\u0bb3\u0bcd!'
soundspk
u'spoken/t_1_1_v_.ogg'
priority
u'1'
soundwrt
u'written/t_1_1_s_.ogg'
english
u'Welcome! Sanjay Welcome!'
lesson
u'2'
sentencespk
u'\u0bb5\u0bbe\u0b99\u0bcd\u0b95! \u0b9a\u0b9e\u0bcd\u0b9a\u0baf
\u0bcd \u0bb5\u0bbe\u0b99\u0bcd\u0b95! '
--
regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---