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 » Feature Discussions » Now I got this one

Page: 1 2 Next

==========================================================================
Environment:

Request Method: GET
Request URL: http://www.abc.com/ggum/board/show/3/
Django Version: 0.97-pre-SVN-7199
Python Version: 2.4.4
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'home',
'sphene.community',
'sphene.sphboard',
'sphene.sphblog',
'sphene.sphwiki']
Installed Middleware:
('sphene.community.middleware.ThreadLocals',
'sphene.community.middleware.GroupMiddleware',
'sphene.community.middleware.LastModified',
'sphene.community.middleware.PermissionDeniedMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')


Template error:
In template /data/lib/communitytools/sphenecoll/sphene/sphboard/templates/sphene/sphboard/_displayLatestPost.html, error at line 10
Caught an exception while rendering: 'int' object has no attribute 'year'
1 : {% load i18n %}


2 : {% load sph_extras %}


3 : {% load sphboard_extras %}


4 : {% if latestPost %}


5 : {% ifequal showSubject 1 %}


6 : <a href="../../thread/{{ latestPost.get_thread.id }}/?page={{ latestPost.get_threadinformation.get_page_count }}">{% sph_truncate latestPost.subject 30 "..." %}</a>


7 : {% blocktrans with latestPost.postdate|date:"Y-m-d H:i:s" as latest_post %}at {{ latest_post }}{% endblocktrans %}


8 : <br/>


9 : {% else %}


10 : {% blocktrans with latestPost.get_thread.id as thread_id and latestPost.get_threadinformation.get_page_count as page_count and latestPost.postdate|date:"Y-m-d H:i:s" as latest_post %} At <a href="../../thread/{{ thread_id }}/?page={{ page_count }}">{{ latest_post }}</a>{% endblocktrans %}


11 : <br/>


12 : {% endifequal %}


13 : {% trans "By" %} {% sphboard_displayUserName latestPost.author %}


14 : {% else %}


15 : {% trans "No Posts Yet." %}


16 : {% endif %}


17 :


18 :


19 :

Traceback:
File "/data/lib/django_trunk/django/template/debug.py" in render_node
71. result = node.render(context)
File "/data/lib/django_trunk/django/templatetags/i18n.py" in render
71. contextvar = val.render(context)
File "/data/lib/django_trunk/django/template/__init__.py" in render
782. output = force_unicode(self.filter_expression.resolve(context))
File "/data/lib/django_trunk/django/template/__init__.py" in resolve
539. new_obj = func(obj, *arg_vals)
File "/data/lib/django_trunk/django/template/defaultfilters.py" in date
624. return format(value, arg)
File "/data/lib/django_trunk/django/utils/dateformat.py" in format
264. return df.format(format_string)
File "/data/lib/django_trunk/django/utils/dateformat.py" in format
29. pieces.append(force_unicode(getattr(self, piece)()))
File "/data/lib/django_trunk/django/utils/dateformat.py" in Y
241. return self.data.year

Exception Type: AttributeError at /ggum/board/show/3/
Exception Value: 'int' object has no attribute 'year'
==========================================================================
this is weird...
have you done something special ? or does it happen every time you open the category list ?

i have no idea how 'latestPost.postdate' could be an integer ? which database are you using ?
Hey, we have Signatures !!! Great, isn't it ? ;)
this is weird...
have you done something special ? or does it happen every time you open the category list ?
No I didn't do anything. Yes it happen every time right after I posted.

i have no idea how 'latestPost.postdate' could be an integer ? which database are you using ?


PostgreSQL
does it (also) happen in a development environment ?
maybe you could add debugging like:

sphenecoll/sphene/sphboard/templatetags/sphboard_extras.py line 44 (right after def sphboard_latestPost...) add:

    print "latestPost: %s/%s/%s" % (type(latestPost),str(latestPost),latestPost.postdate)


usually this should output:

    latestPost: <class 'sphene.sphboard.models.Post'>/hatschi/2008-03-09 14:18:45.206820
Hey, we have Signatures !!! Great, isn't it ? ;)
==========================================================================
Environment:

Request Method: GET
Request URL: http://www.abc.com/ggum/board/show/1/
Django Version: 0.97-pre-SVN-7199
Python Version: 2.4.4
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'home',
'sphene.community',
'sphene.sphboard',
'sphene.sphblog',
'sphene.sphwiki']
Installed Middleware:
('sphene.community.middleware.ThreadLocals',
'sphene.community.middleware.GroupMiddleware',
'sphene.community.middleware.LastModified',
'sphene.community.middleware.PermissionDeniedMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')


Template error:
In template /data/lib/communitytools/sphenecoll/sphene/sphboard/templates/sphene/sphboard/listCategories.html, error at line 84
Caught an exception while rendering: coercing to Unicode: need string or buffer, NoneType found
74 : <td colspan="4"><small>Thread was moved: <a href="{{ thread.get_absolute_url }}">{{ thread.subject }}</a> into <a href="{{ thread.category.get_absolute_url }}">{{ thread.root_post.category.name }}</a>.


75 : {% blocktrans with thread.get_absolute_url as th_url and thread.subject as th_subject and thread.category.get_absolute_url as cat_url and thread.root_post.category.name as cat_name %}Thread was moved: <a href="{{ th_url }}">{{ th_subject }}</a> into <a href="{{ cat_url }}">{{ cat_name }}</a>.{% endblocktrans %}


76 : </small></td>


77 : {% else %}


78 : <td>{% if thread.is_sticky %}<b>{% trans "Sticky:" %}</b> {% endif %}{% if thread.is_hot %}<b>{% trans "Hot:" %}</b> {% endif %}{% if thread.is_poll %}{% trans "Poll:" %} {% endif %}{% if thread.is_closed %}{% trans "Locked:" %} {% endif %}{% block thread_list_subject %}<a href="{{ thread.get_absolute_url }}">{{ thread.subject }}</a>{% endblock %}{% if thread.has_paging %} ( {% sph_pagination thread.get_page_count -1 thread.get_absolute_url %} ){% endif %}<br/><small>{% if isShowLatest %}{% sphboard_displayBreadcrumbsForCategory thread.category 1 %} - {% endif %}by {% sphboard_displayUserName thread.author %}</small></td>


79 : {% block thread_list_info %}


80 : {% if sph_settings.board_count_views %}


81 : <td class="sphboard_viewcount">{{ thread.view_count }}</td>


82 : {% endif %}


83 : <td class="sphboard_postcount">{{ thread.post_count }}</td>


84 : <td class="sphboard_latestpost"> {% sphboard_latestPost thread.latest_post 0 %} </td>


85 : {% endblock %}


86 : {% endif %}


87 : </tr>


88 : {% endfor %}


89 : <tr>


90 : <td colspan="{% if sph_settings.board_count_views %}5{% else %}4{% endif %}"><span class="board_threadcount">{% blocktrans %}{{ hits }} Threads in this category.{% endblocktrans %}</span><span class="board_pagination">{% sph_pagination pages page %}</span></td>


91 : </tr>


92 : </table>


93 : <br/><br/>


94 : {% include category.get_category_type.get_new_thread_link_template %}


Traceback:
File "/data/lib/django_trunk/django/template/debug.py" in render_node
71. result = node.render(context)
File "/data/lib/django_trunk/django/template/__init__.py" in render
895. dict = func(*args)
File "/data/lib/communitytools/sphenecoll/sphene/sphboard/templatetags/sphboard_extras.py" in sphboard_latestPost
44. print "latestPost: %s/%s/%s" % (type(latestPost),str(latestPost),latestPost.postdate)
File "/data/lib/django_trunk/django/db/models/base.py" in __str__
129. return force_unicode(self).encode('utf-8')
File "/data/lib/django_trunk/django/utils/encoding.py" in force_unicode
51. s = unicode(s)

Exception Type: TypeError at /ggum/board/show/1/
Exception Value: coercing to Unicode: need string or buffer, NoneType found
=========================================================================

this is the error reporting right after adding the code that you asked

my best guess would be that latestPost is None ..

try the following statement in your database .. (assuming that your category id is 1 .. which i guess from your URL):

select id,root_post_id,latest_post_id from sphboard_threadinformation where category_id = 1;

did that error happen from the first post on ? do you get any results back ? what value is latest_post_id .. ?
Hey, we have Signatures !!! Great, isn't it ? ;)
I got this result

id | root_post_id | latest_post_id
----+--------------+----------------
13 | 13 | 13
so this was your first post in this category ?

is there a post with the id 13 ? -> select * from sphboard_post where id = 13

do you have posted any other threads in this category ? -> select id from sphboard_post where category_id = 1 and thread_id is null
Hey, we have Signatures !!! Great, isn't it ? ;)
Ah I seems to know the reason why.....

Because I deleted the post in admin page.

So probably, the thread order is destroied by doing that.

So this probrem is caused I guess.

Does it make sense?
so this was your first post in this category ?
yes

is there a post with the id 13 ? -> select * from sphboard_post where id = 13


select * from sphboard_post where id = 13;
id | status | category_id | subject | body | thread_id | postdate | author_id | markup | is_hidden
----+--------+-------------+---------+--------------+-----------+-------------------------------+-----------+--------+-----------
13 | 0 | 1 | asdf | asdfsdf\r | | 2008-03-08 05:18:59.527331+09 | 1 | bbcode | 0

do you have posted any other threads in this category ? -> select id from sphboard_post where category_id = 1 and thread_id is null


id
----
13


Page: 1 2 Next

Please login to post a reply.



Powered by Sphene Community Tools