Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Feeds problem

Hi

I'm really liking Sphene and I'm using it for my currently live web site.

I'm having a problem with feeds giving me an exception that I'm having difficulty debugging. Maybe you can shed some light on the problem.

It's failing on a URL that looks like: /board/feeds/latest/1/

The error is:
TemplateSyntaxError at /board/feeds/latest/1/
Caught an exception while rendering: invalid literal for int() with base 10: ''

Relating to sphene/sphboard/feeds/latestpost_description.html:
{{ obj.body_escaped }}

If I change it to obj.body, it seems to work just fine... (but this doesn't apply markup, does it?)

I'm using sphene trunk and tried a few versions of Django.

The traceback is:
File "/var/www/site/communitytools/sphenecoll/sphene/sphboard/renderers.py", line 143, in render_body
return renderer.render(body)
File "/var/www/site/communitytools/sphenecoll/sphene/sphboard/renderers.py", line 41, in render
return wikilink_utils.render_wikilinks(bbcode.bb2xhtml(text))
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/wikilink_utils.py", line 68, in render_wikilinks
done = WIKILINK_RE_COMPILED.sub( render_wikilinks_match, source )
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/wikilink_utils.py", line 63, in render_wikilinks_match
wikilink = handle_wikilinks_match(match.groupdict())
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/wikilink_utils.py", line 48, in handle_wikilinks_match
if not snip.has_edit_permission() \
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/models.py", line 289, in has_edit_permission
pref = self.get_wiki_preference()
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/models.py", line 252, in get_wiki_preference
self._wiki_preference = self.__get_wiki_preference()
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/models.py", line 259, in __get_wiki_preference
parent = self.get_parent()
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/models.py", line 218, in get_parent
return WikiSnip.objects.get( group = self.group,
File "/var/www/site/django/db/models/fields/related.py", line 249, in __get__
rel_obj = QuerySet(self.field.rel.to).get(**params)
File "/var/www/site/django/db/models/query.py", line 303, in get
clone = self.filter(*args, **kwargs)
File "/var/www/site/django/db/models/query.py", line 489, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/var/www/site/django/db/models/query.py", line 507, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/var/www/site/django/db/models/sql/query.py", line 1257, in add_q
can_reuse=used_aliases)
File "/var/www/site/django/db/models/sql/query.py", line 1200, in add_filter
self.where.add((alias, col, field, lookup_type, value), connector)
File "/var/www/site/django/db/models/sql/where.py", line 48, in add
params = field.get_db_prep_lookup(lookup_type, value)
File "/var/www/site/django/db/models/fields/__init__.py", line 202, in get_db_prep_lookup
return [self.get_db_prep_value(value)]
File "/var/www/site/django/db/models/fields/__init__.py", line 353, in get_db_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: ''

Any ideas?


--- Last Edited by gak at 2008-12-20 07:51:50 ---
I'm really liking Sphene and I'm using it for my currently live web site.
cool thanks, have you considered posting a link in the Who's using SCT category :)

I'm having a problem with feeds giving me an exception that I'm having difficulty debugging. Maybe you can shed some light on the problem.

It's failing on a URL that looks like: /board/feeds/latest/1/

The error is:
TemplateSyntaxError at /board/feeds/latest/1/
Caught an exception while rendering: invalid literal for int() with base 10: ''


hmm.. it's a bit hard to debug it this way .. from what i can tell .. some field in the database is probably an empty string which should be a number (duh) ..
which database are you using ? would it be possible for you to send me a dump or does it contain confidential data ?

you could try adding a few debugging statements to:
File "/var/www/site/communitytools/sphenecoll/sphene/sphwiki/models.py", line 218, in get_parent

e.g. simply outputting the 'name' should help you figure out in the database what's wrong ..
Hey, we have Signatures !!! Great, isn't it ? ;)
I'm really liking Sphene and I'm using it for my currently live web site.
cool thanks, have you considered posting a link in the Who's using SCT category :)
Sure, I'll add it soon.

It's failing on a URL that looks like: /board/feeds/latest/1/

I've done some more investigation. When parsing CamelCase, wikilink_utils.py is not correctly getting a WikiSnip object. Simply doing a "print snip" fails. It looks like it is because get_current_group() is returning None:

snip = WikiSnip.objects.get( group = get_current_group(), name = snipname, )


Then it catches an exception (due to the snip belonging to a group) and creates a new WikiSnip:
snip = WikiSnip( group = get_current_group(), name = snipname, )


This works except the group attribute isn't defined in the WikiSnip object, as in "hasattr(snip, 'group') == False". This doesn't play nice in the model because it assumes self.group exists. Printing the WikiSnip object fails because __unicode__ uses self.group.

The rest of the site seems to work fine and my urls.py "defaultdict" groupName is set to the group name in the database. The all the snip rows' group_id is pointing to the group id.

So I guess my question is if it's a problem with my group configuration to make get_current_group() return None? Or is it something else I'm doing wrong?

The data isn't too confidential so I'll email you the DB if that will help.
are you sure get_current_group() returns None ? because there are quite a few places depending on it ...

do you have the 'sphene.community.middleware.ThreadLocals', middleware installed ?
Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.



Powered by Sphene Community Tools