FileField truncation/exception on path string overflow (#9893)

2009-04-07 Thread akaihola
Continuing the discussion from http://code.djangoproject.com/ticket/9893 here. Summary: FileField and ImageField have a problem when the length of the file path relative to MEDIA_ROOT exceeds 100 characters (or the overridden max_length). I get a 500 server error (with PostgreSQL) and the

Re: Testing: making it easier to create mock Request objects

2008-09-07 Thread akaihola
I couldn't find a ticket for this issue yet. Simon, mind if I create a ticket and dump your description of the issue there? -Antti --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post

Re: surprise when initializing DecimalField with a string value

2008-09-03 Thread akaihola
Jacob's comment on #django-dev: > that's been discussed ad-nauseum in the past. models don't > have __setattr__ hooks for speed, so you can say > "model.intfield = "Fish"" for all Django cares. > [...] it's a well-known problem, but one without a "good" fix. > I think model validation will

surprise when initializing DecimalField with a string value

2008-09-01 Thread akaihola
According to the backwards incompatible changes wiki page: > you must either store a python decimal value in the model attribute or a > string (which will then be converted to a decimal) But what is "then" in "will then be converted"? It appears that the conversion doesn't take place when

Re: #7295: quotes, escaping and translation of string literals in templates

2008-05-23 Thread akaihola
It's confusing that the django.utils.text.smart_split() function un- escapes quotes and backslashes inside the literal string while preserving the surrounding quotes: >>> print ' '.join(smart_split(ur'arg1 "the \"second\" argument" "the \\third\\ argument"')) arg1 "the "second"

Re: #7295: quotes, escaping and translation of string literals in templates

2008-05-23 Thread akaihola
The django.utils.text.smart_split() function used to split template tag contents seems to strip backslashes. On the other hand, string literals in variables (like {{"mystring"}}) are passed to the filter expression parser with backslashes intact. This complicates things a bit. Forget the part

Re: {GSoC 2008}Django-Newcomments : A preview

2008-05-23 Thread akaihola
On 22 touko, 18:47, "Nicolas Lara" <[EMAIL PROTECTED]> wrote: > objet it refers since I dont see any case in which it would make sense > to have the replies away from the objects being replied upon. I've experimented with both approaches on a couple of websites, and the "correct" solution

#7295: quotes, escaping and translation of string literals in templates

2008-05-23 Thread akaihola
While I was trying to implement allowing filter expressions as arguments to some built-in template tags (see #5756), I found inconsistencies in the handling of literal strings in the template system. Collin Grady's patch [1] for {% ifequal %} looks good, but using the same logic for other tags

Re: MD5 crypt passwords

2007-12-16 Thread akaihola
I need to allow users to log in to my Django site with their old Unix usernames and passwords, which may be encoded with MD5-based crypt. Yuri, I don't believe your hook provides that functionality. --~--~-~--~~~---~--~~ You received this message because you are

Re: Django WSGI bug with twill?

2007-12-04 Thread akaihola
Titus Brown, the author of twill, fixed this issue in the latest snapshot. It's available from http://darcs.idyll.org/~t/projects/twill-latest.tar.gz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Django WSGI bug with twill?

2007-12-03 Thread akaihola
I tried old versions of twill, and it seemed to work correctly in 0.8.4, but version 0.8.5 introduced this duplicating behavior. I can see that the application result reading mechanism was heavily modified at that point. Here are relevant snippets of the source for your convenience. twill

Re: Django WSGI bug with twill?

2007-12-03 Thread akaihola
(twill 0.9b1 is of course as close as saying "easy_install twill" if you have setuptools installed) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to

Re: Django WSGI bug with twill?

2007-12-03 Thread akaihola
Here is a simple test case. Place twilltest.py and urls.py in a directory and run "PYTHONPATH=. python twilltest.py". Make sure Django and twill exist in your PYTHONPATH. --- twilltest.py - #!/usr/bin/python from django.conf import settings

Django WSGI bug with twill?

2007-12-03 Thread akaihola
I'm desperately trying to get twill to work together with Django using twill's WSGI intercepting. The problem is, I always get the content of the page concatenated twice together. I've debugged and narrowed down the problem so it must be either in twill.wsgi_intercept.wsgi_fake_socket.makefile()

MD5 crypt passwords

2007-12-02 Thread akaihola
Changeset 5073 [1] added support for Unix DES crypt passwords (see ticket 3316 [2] for discussion). Many systems use MD5-based crypt shadow passwords (see e.g. man 3 crypt or its on-line version [3], under heading "GNU Extension"). This extension to the crypt library prefixes the encrypted

formset_for_model() and the form prefix

2007-10-15 Thread akaihola
Am I correct in my conclusion that formset_for_model() in the newforms- admin branch doesn't offer any convenient way to define the form's prefix? Is my best option currently to subclass BaseModelFormSet and override the defalt value of the prefix= kwarg in its __init__()? If so, wouldn't it

Re: newforms-admin: unique_together validation

2007-09-09 Thread akaihola
Malcolm, That's basically what I hoped to hear :) I started looking at model validation in the db model and admin modules, but following the code led me to newforms, which did left me wondering if something's still missing. Thanks for the update, I'll stay alert and jump in to test the new

newforms-admin: unique_together validation

2007-09-07 Thread akaihola
Today I challenged myself to dive into newforms-admin source code and try to figure out how to fix the unique_together problem for inline forms in admin. I thought I'd share what I found and where I got stuck in case someone wants to shed some light on the matter. I realize that my knowledge of

unicode and doctest

2007-05-09 Thread akaihola
I'm having a hard time trying to do my unit testing in unicode. I'm using the unicode branch of Django. Here's a simple tests.py example: # -*- encoding: utf-8 -*- u""" >>> print u'\u00e4' this output should not match the above test """ When I run this with manage.py test, I get the following

Re: LazyDate removal (changeset 4985)

2007-04-22 Thread akaihola
Just use datetime.now without the function call parentheses. See http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#RemovedLazyDate for an explanation. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: bug with joins and &, or am I simply confused?

2006-06-04 Thread akaihola
I've opened another bug which could have something to do with this: http://code.djangoproject.com/ticket/2080 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send

Re: How to merge two queryset, and sort the result by date

2006-04-05 Thread akaihola
My guess is that there's no way to do it on the db level. You can retrieve the results for both queries as lists and then merge: results = list(queryset1.filter(criteria...)) + list(queryset2.filter(criteria...)) results.sort(lambda a, b: cmp(a.date, b.date))

Re: How to create related table from field

2006-04-02 Thread akaihola
> If I understood docs correctly this is now possible in m-r branch. Sounds interesting! Which part of the docs? Wouldn't you need to specify the translated field in the i18n_for_foo table as well? For example an Article object would need translations for both the title and the content.

Re: Magic Removal: verbose_name not worrking?

2006-03-05 Thread akaihola
tonecmd, maybe you need: events[0].what.get_what_display() for more information, see: http://www.djangoproject.com/documentation/db_api/#get-foo-display --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: are TinyMCE + other HTML input editors safe to use.

2006-02-25 Thread akaihola
I admit there's nothing you can do on the client side to avoid the need for server-side validation. But allowing only a tight subset of tags in TinyMCE does solve many user experience problems when pasting formatted text. --~--~-~--~~~---~--~~ You received this

Re: are TinyMCE + other HTML input editors safe to use.

2006-02-15 Thread akaihola
My solution was to prevent harmful tags and attributes in TinyMCE's configuration. Even copy-pasting from word processors works ok now. For more information see: http://groups.google.com/group/django-users/msg/60ad1f2a544ec2d4 --~--~-~--~~~---~--~~ You received

Re: Tinymce

2006-01-25 Thread akaihola
Open the generated admin page in your browser. Take a look at the HTML source. Check that the paths in the

Re: appache and pthonpath

2006-01-24 Thread akaihola
If you have /var/www/mysite/settings.py then you need PythonPath "['/var/www']+sys.path" just like limodou just instructed. Your DocumentRoot should be outside the Django project tree. I usually have: /home/myproject/public_html /home/myproject/django/myproject and define: DocumentRoot

Re: help with custom tag plus custom filter

2006-01-22 Thread akaihola
I don't see why you couldn't use compile_string (from django.core.template) or your own parser to resolve variables in your template tag. A custom parser might be faster, but then again with compile_string you get more features.