Fix for JPEG upload problem in Django in virtualenv
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
Request Method: GET
Request URL: http://localhost:8000/users/cy/
Exception Type: TemplateSyntaxError
Exception Value: Caught an exception while rendering: invalid literal for int() with base 10: ”
Exception Location: /usr/local/lib/python2.6/dist-packages/django/template/debug.py in render_node, line 81
Python Executable: /usr/bin/python
Here is the code in my template that causes the error:
<a class="tagcloud" style="font-size: {{ tag.font_size|add:"12" href="/users/{{ userviewed }}/lists/tagged/{{ tag.name }}/">{{ tag.name }}</a>
The culprit in the above code is the statement: {{ tag.font_size|add:"12" }}, the font_size property of the tag object doesn’t seem to return a value that could be safely converted to a number.
I have been using http://code.google.com/p/django-tagging/ to implement tagging in myListBoard.com.
I think the problem is with the steps option on the tagging_tags tags of the django-tagging application which defaults to the value of 7. When a list is created using a tag that has been used 6 times, there might some math in the django-tagging application that I didn’t bother to look into.
So being a lazy coder, I instead replaced the culprit code with this:
{{ tag.count|add:"12" }}.
That solved the problem and the tags still grows as the number of usage grows too. After uploading my changes, the site seems to work okay even with many uses of the same tag on a list.
I might be missing something with the use of the font_size property but hey myListBoard.com is already in production, so any quick solution is acceptable at this time.
All steps failed to get an IP address for his computer from our DHCP server.
It’s my fault, I forgot to test my updates with the other web browsers yesterday.
After fixing it, I did a sample search for “PayPal” to check if it’s working. To my surprise it did not display any article from my blog with PayPal in it. I thought something’s wrong with my blog and tried “IMBR” and the articles were displayed. Now that’s a bummer! I know Google still does indexing of my pages but this is not good to my visitors.
So for now, I reverted everything to WordPress’ search engine. Google search results is not important to me for now anyway. What’s important is that the search functionality works.
Thanks Ian.
Recent Comments