@register.tag
def showuser(parser.token):
#какой-то код
pdb showinfo.showuser('parser', 'show as user')
*** AttributeError: 'str' object has no attribute 'contents'
Caught an exception while rendering: 'request'
Original Traceback (most recent call last):
File "C:\server\python\Lib\site-packages\django\template\debug.py", line 71, in render_node
result = node.render(context)
File "D:/proj\rin\bugcatcher\templatetags\userinfo.py", line 28, in render
req = context['request']
File "C:\server\python\lib\site-packages\django\template\context.py", line 44, in __getitem__
raise KeyError(key)
KeyError: 'request'
Request Method: GET
Request URL: http://localhost/rin/bugcatcher/
Exception Type: TemplateSyntaxError
Exception Value:
Caught an exception while rendering: 'request'
Original Traceback (most recent call last):
File "C:\server\python\Lib\site-packages\django\template\debug.py", line 71, in render_node
result = node.render(context)
File "D:/proj\rin\bugcatcher\templatetags\userinfo.py", line 28, in render
req = context['request']
File "C:\server\python\lib\site-packages\django\template\context.py", line 44, in __getitem__
raise KeyError(key)
KeyError: 'request'
Exception Location: C:\server\python\Lib\site-packages\django\template\debug.py in render_node, line 81
Python Executable: C:\server\apache\bin\httpd.exe
Python Version: 2.5.4
return render_to_response('inpost.html', {'form': form}, context_instance=RequestContext(request))
{'request': <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'sessionid': 'b51af09fd612bc8f6fb5cbacb0469bb6'}