WebFaction
Community site: login faq

When attempting to access my sitemap.xml, I'm receiving this error:

'Account' object has no attribute 'get_absolute_url' on line 112.

109.    def get_absolute_url(self):
110.        if self.group is None:
111.            return reverse('wiki_article', args=(self.title,))
112.        return self.group.get_absolute_url() + 'wiki/' + self.title

I can't find this 'Account' object in the traceback. Am I failing to import something here? Please let me know if you need more information.

Edit: This is the app thats failing: http://code.google.com/p/django-wikiapp/source/browse/trunk/wiki/models.py?r=161

asked 20 Feb '11, 14:15

pythondjango
161810
accept rate: 0%

edited 20 Feb '11, 15:10


What kind of object is 'self' (tuple, list, dictionary?). Try adding print,

109.    def get_absolute_url(self):
110.        if self.group is None:
111.            return reverse('wiki_article', args=(self.title,))
                print self
112.        return self.group.get_absolute_url() + 'wiki/' + self.title

The output of print should be in the applications logs/devserver output. Is there an "Account" object it that set of data?

permanent link

answered 20 Feb '11, 14:22

johns
5.4k312
accept rate: 23%

edited 20 Feb '11, 14:24

Added the print statement. Checked my frontend and user access/error logs, but this is all I found. Not sure if it's relevant:

[error] from pkg_resources import resource_stream [error] /home/user/envs/pinax073/lib/python2.6/site-packages/ybrowserauth.py:16: DeprecationWarning: the md5 module is deprecated; use hashlib instead [error] import md5 [error] /home/user/envs/pinax073/lib/python2.6/site-packages/gdata/tlslite/utils/cryptomath.py:9: DeprecationWarning: the sha module is deprecated; use the hashlib module instead [error] import sha

(20 Feb '11, 15:07) pythondjango

My mistake. I have never used it live and made an assumption, it was slightly wrong. You have to modify print, or you can checkout django-logging,

http://code.google.com/p/django-logging/wiki/Overview

I did take a look at the code example you provided, we would still need to know what 'self' was in that exact context to be able to debug the code.

(20 Feb '11, 15:26) johns

How can I answer your 'self' question? How can I give you the context?

Edit: Are these two PATH attributes correct? Seems like the TRANSLATED path is wrong.

PATH_INFO: u'/sitemap.xml'

PATH_TRANSLATED: '/home/user/webapps/app/mysite.wsgi/sitemap.xml'

(20 Feb '11, 15:31) pythondjango

By getting print or django-logging working. Mod_wsgi and mod_python do not send stdout to the log by default, only stderr. The django devserver sends both. You would modify print like so,

print >> sys.stderr, self
(20 Feb '11, 15:39) johns

So I've installed django-logging but I can't figure out how to get it's results. I placed 'import logging' in the models.py file. Now what?

(20 Feb '11, 16:26) pythondjango

As long as it is set up correctly it would be with a call to its function as outlined here,

http://code.google.com/p/django-logging/wiki/Overview#Usage

logging.debug(self). However the modified print should be an easier route. I have tested this on a pinax app of my own and can verify it works. You will have to restart the apache server to see it in error_app.log.

(20 Feb '11, 16:56) johns
showing 5 of 6 show 1 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×2

question asked: 20 Feb '11, 14:15

question was seen: 4,871 times

last updated: 20 Feb '11, 16:56

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM