Search - User list
Full Version: Search by author
Root » Bugs » Search by author
1
mazay
Here is a traceback of search query
Environment:


Request Method: GET
Request URL: [url]http://forum.pure-ftpd-webui.org/search/?action=search&keywords=&author=mazay&forum=0&search_in=all&sort_by=0&sort_dir=DESC&show_as=topics&search=%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C[/url]

Django Version: 1.3
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.admin',
'django.contrib.admindocs',
'registration',
'django_authopenid',
'djangobb_forum',
'haystack',
'messages',
'notification',
'mailer',
'south']
Installed Middleware:
('django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django_authopenid.middleware.OpenIDMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'djangobb_forum.middleware.LastLoginMiddleware',
'djangobb_forum.middleware.UsersOnline')


Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/opt/pure_ftpd_webui_forum/djangobb_forum/util.py" in wrapper
73. output = function(request, *args, **kwargs)
File "/opt/pure_ftpd_webui_forum/djangobb_forum/util.py" in wrapper
94. result = func(request, *args, **kwargs)
File "/opt/pure_ftpd_webui_forum/djangobb_forum/views.py" in search
187. if post.object.topic not in topics:

Exception Type: AttributeError at /search/
Exception Value: 'NoneType' object has no attribute 'topic'
Looks like post variable doesn't set.

And here is another traceback
Environment:


Request Method: GET
Request URL: [url]http://forum.pure-ftpd-webui.org/search/?action=search&keywords=&author=mazay&forum=0&search_in=all&sort_by=0&sort_dir=DESC&show_as=posts&search=%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C[/url]

Django Version: 1.3
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.admin',
'django.contrib.admindocs',
'registration',
'django_authopenid',
'djangobb_forum',
'haystack',
'messages',
'notification',
'mailer',
'south']
Installed Middleware:
('django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django_authopenid.middleware.OpenIDMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'djangobb_forum.middleware.LastLoginMiddleware',
'djangobb_forum.middleware.UsersOnline')


Template error:
In template /opt/pure_ftpd_webui_forum/djangobb_forum/templates/forum/search_posts.html, error at line 15
Caught VariableDoesNotExist while rendering: Failed lookup for key [topic] in u'None'
5 : {% block content %}


6 : {% with results as paged_qs %}


7 : <div class="linkst">


8 : <div class="inbox">


9 : <p class="pagelink">{% pagination %}</p>


10 : <div class="clearer"></div>


11 : </div>


12 : </div>


13 :


14 : {% if results %}


15 : {% for post in results %}


16 : <div class="blockpost searchposts roweven">


17 : <h2>{% link post.instance.topic.forum %}&nbsp;&raquo;&nbsp;{% link post.instance.topic %}&nbsp;&raquo;&nbsp;<a href="{{ post.instance.get_absolute_url }}">{% forum_time post.instance.created %}</a></h2>


18 :


19 : <div class="box">


20 : <div class="inbox">


21 : <div class="postleft">


22 : <dl>


23 : <dt><strong><a href="{% url djangobb:forum_profile post.instance.user %}">{{ post.instance.user }}</a></strong></dt>


24 : <dd>{% trans "Replies:" %} {{ post.instance.topic.post_count }}</dd>


25 : <dd><div class="icon"><div class="nosize"><!-- --></div></div>


Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/opt/pure_ftpd_webui_forum/djangobb_forum/util.py" in wrapper
77. return render_to_response(tmpl, output, context_instance=RequestContext(request))
File "/usr/lib/python2.6/site-packages/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/lib/python2.6/site-packages/django/template/loader.py" in render_to_string
188. return t.render(context_instance)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
123. return self._render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py" in render
127. return compiled_parent._render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py" in render
64. result = block.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/defaulttags.py" in render
500. output = self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/defaulttags.py" in render
311. return self.nodelist_true.render(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/defaulttags.py" in render
227. nodelist.append(node.render(context))
File "/usr/lib/python2.6/site-packages/django/template/base.py" in render
880. resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]
File "/usr/lib/python2.6/site-packages/django/template/base.py" in resolve
653. value = self._resolve_lookup(context)
File "/usr/lib/python2.6/site-packages/django/template/base.py" in _resolve_lookup
692. raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute

Exception Type: TemplateSyntaxError at /search/
Exception Value: Caught VariableDoesNotExist while rendering: Failed lookup for key [topic] in u'None'
Search by author is working only if select forum to search and show as topics.
scrapper
so when searching by author it fails with message:

KeyError at /forum/search

"No field named ‘user’

I work on that issue right now.
greetings
scrapper
scrapper
this seems to cure the issue:

in djangobb_forum/views.py:
———————————
(about line 178)
order = {'0': ‘created’,
‘1’: ‘author’, #replace user with author!
‘2’: ‘topic’,

have fun
scrapper

(I will PM slavonic to fix it.)
slav0nic
tnx, commited
scrapper
thx my friend,
fast and great!

mattym
Close but it doesn't completely fix the issue.
I get this error:

AttributeError at /forum/search/ 'NoneType' object has no attribute 'topic'

when I type in certain keywords that also appear to be in the Title of a “Topic”.

If the keyword is not in the title of the Post and not found I get the usual:

“Your search returned no hits.”

I appear to have the fix in my version:

order = {'0': 'created',
'1': 'author',
'2': 'topic',
'3': 'forum'}.get(sort_by, 'created')

Very strange. Is there anything else I can provide, other than the same stacktrace?

Here are the params in localvars

sort_dir 	

u'DESC'

forum

u'0'

author

u''

post

<SearchResult: djangobb_forum.post (pk=u'20')>

request

<WSGIRequest
GET:<QueryDict: {u'sort_dir': [u'DESC'], u'search': [u'Submit'], u'forum': [u'0'], u'author': [u''], u'sort_by': [u'0'], u'keywords': [u'u'], u'search_in': [u'all'], u'action': [u'search'], u'show_as': [u'topics']}>,
POST:<QueryDict: {}>,
COOKIES:{'csrftoken': 'c717e3814b9b08243d6637a9a0a5623d', 'djdt': 'hide'},
META:{'Apple_PubSub_Socket_Render': '/tmp/launch-yLvHYU/Render',
'COMMAND_MODE': 'unix2003',
'COM_GOOGLE_CHROME_FRAMEWORK_SERVICE_PROCESS/USERS/xxxxxxxxxx/LIBRARY/APPLICATION_SUPPORT/GOOGLE/CHROME_SOCKET': '/tmp/launch-eb9i4T/ServiceProcessSocket',
'CONTENT_LENGTH': '',
'CONTENT_TYPE': 'text/plain',
'CSRF_COOKIE': 'c717e3814b9b08243d6637a9a0a5623d',
'DISPLAY': '/tmp/launch-GoxC1w/org.x:0',
'DJANGO_SETTINGS_MODULE': 'xxxxxxxxxx.settings',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HOME': '/Users/xxxxxxxxxx',
'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_COOKIE': 'csrftoken=c717e3814b9b08243d6637a9a0a5623d; djdt=hide',
'HTTP_HOST': 'localhost:8000',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1',
'LANG': 'en_US.UTF-8',
'LOGNAME': 'xxxxxxxxxx',
'OLDPWD': '/Users/xxxxxxxxxx/devenv/xxxxxxxxxx/bin',
'PATH': '/Users/xxxxxxxxxx/devenv/xxxxxxxxxx/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin',
'PATH_INFO': u'/forum/search/',
'PS1': '(epicrapbattles)\\h:\\W \\u\\$ ',
'PWD': '/Users/xxxxxxxxxx/django/sites/dev/xxxxxxxxxx',
'QUERY_STRING': 'action=search&keywords=u&author=&forum=0&search_in=all&sort_by=0&sort_dir=DESC&show_as=topics&search=Submit',
'REMOTE_ADDR': '127.0.0.1',
'REMOTE_HOST': '',
'REQUEST_METHOD': 'GET',
'RUN_MAIN': 'true',
'SCRIPT_NAME': u'',
'SERVER_NAME': 'ereg.adobe.com',
'SERVER_PORT': '8000',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.6.1',
'SHELL': '/bin/bash',
'SHLVL': '1',
'SSH_AUTH_SOCK': '/tmp/launch-Y2BNKz/Listeners',
'TERM': 'xterm-color',
'TERM_PROGRAM': 'Apple_Terminal',
'TERM_PROGRAM_VERSION': '273.1',
'TMPDIR': '/var/folders/FE/FESg7aRGGIa6Tpf4qDojTk+++TI/-Tmp-/',
'TZ': 'America/Chicago',
'USER': 'xxxxxxxxxx',
'VERSIONER_PYTHON_PREFER_32_BIT': 'no',
'VERSIONER_PYTHON_VERSION': '2.6',
'VIRTUAL_ENV': '/Users/xxxxxxxxxx/devenv/xxxxxxxxxx',
'_': '/Users/xxxxxxxxxx/devenv/xxxxxxxxxx/bin/python',
'__CF_USER_TEXT_ENCODING': '0x1F5:0:0',
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x100416140>,
'wsgi.file_wrapper': <class 'django.core.servers.basehttp.FileWrapper'>,
'wsgi.input': <socket._fileobject object at 0x104004c80>,
'wsgi.multiprocess': False,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>

topics

[<Topic: Why doens't This work>]

posts

[<SearchResult: djangobb_forum.post (pk=u'21')>, <SearchResult: djangobb_forum.post (pk=u'20')>, <SearchResult: djangobb_forum.post (pk=u'19')>, <SearchResult: djangobb_forum.post (pk=u'18')>, <SearchResult: djangobb_forum.post (pk=u'17')>, <SearchResult: djangobb_forum.post (pk=u'16')>, <SearchResult: djangobb_forum.post (pk=u'15')>, <SearchResult: djangobb_forum.post (pk=u'14')>, <SearchResult: djangobb_forum.post (pk=u'13')>, <SearchResult: djangobb_forum.post (pk=u'12')>, <SearchResult: djangobb_forum.post (pk=u'11')>, <SearchResult: djangobb_forum.post (pk=u'10')>, <SearchResult: djangobb_forum.post (pk=u'9')>, <SearchResult: djangobb_forum.post (pk=u'8')>, <SearchResult: djangobb_forum.post (pk=u'7')>, <SearchResult: djangobb_forum.post (pk=u'6')>, <SearchResult: djangobb_forum.post (pk=u'4')>, <SearchResult: djangobb_forum.post (pk=u'3')>, <SearchResult: djangobb_forum.post (pk=u'2')>]

sort_by

u'0'

action

u'search'

groups

[]

search_in

u'all'

keywords

u'u'

query

[<SearchResult: djangobb_forum.post (pk=u'14')>, <SearchResult: djangobb_forum.post (pk=u'13')>, <SearchResult: djangobb_forum.post (pk=u'12')>, <SearchResult: djangobb_forum.post (pk=u'11')>, <SearchResult: djangobb_forum.post (pk=u'10')>, <SearchResult: djangobb_forum.post (pk=u'8')>, <SearchResult: djangobb_forum.post (pk=u'9')>, <SearchResult: djangobb_forum.post (pk=u'7')>, <SearchResult: djangobb_forum.post (pk=u'6')>, <SearchResult: djangobb_forum.post (pk=u'4')>, <SearchResult: djangobb_forum.post (pk=u'3')>, <SearchResult: djangobb_forum.post (pk=u'2')>, <SearchResult: djangobb_forum.post (pk=u'21')>, <SearchResult: djangobb_forum.post (pk=u'20')>, <SearchResult: djangobb_forum.post (pk=u'19')>, <SearchResult: djangobb_forum.post (pk=u'18')>, <SearchResult: djangobb_forum.post (pk=u'17')>, <SearchResult: djangobb_forum.post (pk=u'16')>, <SearchResult: djangobb_forum.post (pk=u'15')>]

topics_to_exclude

<SQ: AND >

order

'-created'

Thank,
Matt
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB