Re: Site wide date format

2008-07-16 Thread web-junkie

Wouldn't it be useful to use that setting as a default for the date
filter, so you wouldn't need to specify a format every time?
I could write a patch..

On 15 Jul., 15:31, Arien <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 15, 2008 at 8:14 AM, Adam Peacock <[EMAIL PROTECTED]> wrote:
>
> > I'm looking for a consistent way to format dates across my site,
> > without having to put the format into every template.  Is it possible
> > to set a default date format for the "date" filter?  For example, I
> > want {{ var.date|date }} to format to {{ var.date|date:"l, F j Y" }}
> > unless I specify otherwise, but still have the ability to format it
> > differently in some cases.  Is this possible?
>
> Use the DATE_FORMAT 
> setting:http://www.djangoproject.com/documentation/settings/#date-format
>
> Arien
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What is reverse() good for? Not really reversing...

2008-05-06 Thread web-junkie

Okay, if you take the perspective that it reverses the normal order,
it does what it should. But then I don't know why we have such a
function in there, as the ordering can easily manipulated.
What I expected from the method is, when iterating, to give me the
last item instead of the first one an so on.. that has nothing to do
with how it sould execute SQL so I don't know why I should state any
SQL here.

On 2 Mai, 17:51, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, May 2, 2008 at 11:11 AM, web-junkie <[EMAIL PROTECTED]> wrote:
>
> > On 1 Mai, 19:32, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> > > While it may be the long way around, can you not do the following?
> > > a = Articles.objects.all()[:3]
> > > a.reverse()
>
> > > That would probably be my solution.
>
> > That's exactly what I tried, and as I described, it gives you
> > something wrong, not the queryset reversed...
>
> Now, I don't think what it give you is wrong, it's just not what you
> wanted/expected.  Instead of reversing the result after retrieval/slicing
> using the normal ordering, it is reversing the normal ordering and then
> retrieving/slicing the result.  So, given a sequence with normal ordering:
>
> a,b,c,x,y.z
>
> You are looking to get (c,b,a) instead of (z,y,x).  Below, you mention a doc
> note that explains why it doesn't do what you want by noting that there is
> no efficient way in SQL to produce the result you are looking for and say
> that is nonsense.  If it is nonsense, could you please state the SQL
> statement you would use to achieve the result you are looking for?
>
> Karen
>
>
>
>
>
> > > On Thu, May 1, 2008 at 12:36 PM, web-junkie <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > what is the new reverse() method good for? Seems it just swaps the
> > > > order_by statement?
> > > > I would appreciate a reverse() method that, if used after slicing,
> > > > would actually reverse the queryset.
> > > > In the docs it's said: "Django doesn't support that mode of access
> > > > (slicing from the end), because it's not possible to do it efficiently
> > > > in SQL."
> > > > That is nonsense, because reverse should not slice from anywhere, it
> > > > should just reverse, and you can do that in python.
> > > > So when I have Articles.objects.all()[:3] which gives me a,b,c,
> > > > Articles.objects.all()[:3].reverse() would make c,b,a out of it, not
> > > > z,y,x! Or am I missing something?
>
> > > --
> > > Justin Lilly
> > > Web Developer/Designerhttp://justinlilly.com-Zitierten Text ausblenden
> > -
>
> > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What is reverse() good for? Not really reversing...

2008-05-06 Thread web-junkie

That is what I do at the moment, putting it in a list in such an order
that it is reversed.

On 2 Mai, 19:58, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote:
> On Thu, 2008-05-01 at 09:36 -0700, web-junkie wrote:
> > Hi,
>
> > what is the newreverse() method good for? Seems it just swaps the
> > order_by statement?
> > I would appreciate areverse() method that, if used after slicing,
> > would actuallyreversethe queryset.
> > In the docs it's said: "Django doesn’t support that mode of access
> > (slicing from the end), because it’snotpossible to do it efficiently
> > in SQL."
> > That is nonsense, becausereverseshouldnotslice from anywhere, it
> > should justreverse, and you can do that in python.
> > So when I have Articles.objects.all()[:3] which gives me a,b,c,
> > Articles.objects.all()[:3].reverse() would make c,b,a out of it,not
> > z,y,x! Or am I missing something?
>
> The problem seems to be in getting the ORM to write an appropriate query
> to return the results you want.  Would it work for your needs if you
> pull it out of the queryset into a list, and thenreverseit at the
> python level?
>
> Something like this (untested code follows)
>
> py>>> arts = Articles.objects.all()[:3]
> py>>> arts = list(arts)
> py>>> arts.reverse()
>
> The drawback, of course, is that you no longer have a query set, so
> whether this will work for you depends on your use case.
>
> Cheers,
> Cliff
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What is reverse() good for? Not really reversing...

2008-05-02 Thread web-junkie

That's exactly what I tried, and as I described, it gives you
something wrong, not the queryset reversed...

On 1 Mai, 19:32, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> While it may be the long way around, can you not do the following?
> a = Articles.objects.all()[:3]
> a.reverse()
>
> That would probably be my solution.
>
>   -justin
>
>
>
>
>
> On Thu, May 1, 2008 at 12:36 PM, web-junkie <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > what is the new reverse() method good for? Seems it just swaps the
> > order_by statement?
> > I would appreciate a reverse() method that, if used after slicing,
> > would actually reverse the queryset.
> > In the docs it's said: "Django doesn't support that mode of access
> > (slicing from the end), because it's not possible to do it efficiently
> > in SQL."
> > That is nonsense, because reverse should not slice from anywhere, it
> > should just reverse, and you can do that in python.
> > So when I have Articles.objects.all()[:3] which gives me a,b,c,
> > Articles.objects.all()[:3].reverse() would make c,b,a out of it, not
> > z,y,x! Or am I missing something?
>
> --
> Justin Lilly
> Web Developer/Designerhttp://justinlilly.com- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



What is reverse() good for? Not really reversing...

2008-05-01 Thread web-junkie

Hi,

what is the new reverse() method good for? Seems it just swaps the
order_by statement?
I would appreciate a reverse() method that, if used after slicing,
would actually reverse the queryset.
In the docs it's said: "Django doesn’t support that mode of access
(slicing from the end), because it’s not possible to do it efficiently
in SQL."
That is nonsense, because reverse should not slice from anywhere, it
should just reverse, and you can do that in python.
So when I have Articles.objects.all()[:3] which gives me a,b,c,
Articles.objects.all()[:3].reverse() would make c,b,a out of it, not
z,y,x! Or am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Whitespace handling in newforms modelforms

2008-02-18 Thread web-junkie

Hi,

why isn't whitespace automatically stripped from fields when using
modelforms? This would be convenient.
Is there a reason for not doing so, where is one supposed to do that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: run multiple django app's on server

2008-01-30 Thread web-junkie

That did it for me too, thanks!

On Jan 30, 3:29 pm, prz <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > That's the weird thing,
>
> > If we restart httpd.conf the python code will be compiled in some
> > cases it will show one of the projects for both ports and in a other
> > case it will show the other for both ports without altering anything
> > to the code. Both are working fine independently. So to me it seems
> > that while restarting apache it in some cases goes to the wrong
> > settings file.
>
> make sure you use the
>
> PythonInterpreter XX
>
> setting, otherwise one interpreter will try to run multiple things. Well
> documented
> (but I had the problem initially as well)
>
>     =-= tony
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: run multiple django app's on server

2008-01-30 Thread web-junkie

I have kinda the same problem as of today. It just seems to not use
use the settings file I want.
Is there something wrong with having to exact same virtualhosts that
just differ in the specified django settings?

On Jan 30, 2:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hello Django Users,
>
> I'm working on a application that evolves over time. in order to show
> both applications we set up virtual hosts in the httpd.conf in the
> following way.
>
> 
>   ServerName bioinf-dev.erasmusmc.nl
>   DocumentRoot "/home/bioinf/richard/public_html/iqc"
>   ErrorLog logs/iqc_error_log
>   CustomLog logs/iqc_access_log combined
>
>   
>     SetHandler python-program
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE iqc.settings
>     PythonDebug On
>     PythonPath "['/home/bioinf/richard/public_html','/home/bioinf/
> richard/public_html/iqc']+sys.path"
>   
> 
>
> 
>   ServerName bioinf-dev.erasmusmc.nl
>   DocumentRoot "/home/bioinf/richard/public_html/idap"
>   ErrorLog logs/idap_error_log
>   CustomLog logs/idap_access_log combined
>
>   
>     SetHandler python-program
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE idap.settings
>     PythonDebug On
>     PythonPath "['/home/bioinf/richard/public_html','/home/bioinf/
> richard/public_html/idap']+sys.path"
>   
> 
>
> The problem i'm experiencing is that the templates will mix up.
> What happens is that when i go to bioinf-dev.erasmusmc.nl:8000/ it
> some occasions it will show the templates that are rendered in the
> application that is put under 8001. I've tried several things along
> with the system administrator but he thought it must be something in
> the python code that is mixing up.
>
> Did we specified the Httpd.conf in the wrong way ?
> Is there someone that experienced similar problems and know how to
> solve this ?
>
> you help would be greatly appreciated,
>
> Regards,
>
> Richard Mendes
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with memcached after many hits

2007-10-30 Thread web-junkie

After further investigation I saw that memcached connections kept
adding up, until they reached the limit. From that point it got slow
and DB load jumped up. An Apache reload made everything fast again.
After googling for memcached connections or so, I found
http://groups.google.com/group/django-developers/browse_thread/thread/f83eb95f35c9d9a
which should be the same issue. The fix was to upgrade mod_python (had
to switch from a stable to testing on my Debian).
So, yeah, should be fixed now. Weird issue.

On Oct 30, 9:51 am, web-junkie <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a weird problem where I think memcached or caching in general
> might be the cause. I discovered it during testing the site with
> http_load. After a certain amount of fetches, or hits, to the server,
> the site does not respond normally. It takes 30 seconds or so. Strange
> thing is: Only for cached pages. Non cached pages still load fast
> afterwards.
> When I do the test on a not cached page it is normal, too. No
> problems. But on cached page it seems the site is somehow off track.
> Only fix is to do apache reload.
> The problem is not only with http_test, but after some hours of
> traffic, too! Seems like the cache thinks "That's enough for today",
> until you reload apache.
> Strange problem, maybe I did something wrong somewhere. Any ideas?
> Help would be appreciated. Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with memcached after many hits

2007-10-30 Thread web-junkie

Oh, and I'm running exactly one Django site on the server.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with memcached after many hits

2007-10-30 Thread web-junkie

On Oct 30, 11:30 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Are you using Apache prefork MPM or worker MPM? If worker, how many
> threads in each process? Also, what do you have for maximum number of
> child processes in Apache configuration. Finally, how many Django
> instances are you hosting?

I'm using prefork, as recommended. Settings as follows:

StartServers20
MinSpareServers 20
MaxSpareServers 40
ServerLimit 300
MaxClients  300
MaxRequestsPerChild 4000


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem with memcached after many hits

2007-10-30 Thread web-junkie

Hi,
I have a weird problem where I think memcached or caching in general
might be the cause. I discovered it during testing the site with
http_load. After a certain amount of fetches, or hits, to the server,
the site does not respond normally. It takes 30 seconds or so. Strange
thing is: Only for cached pages. Non cached pages still load fast
afterwards.
When I do the test on a not cached page it is normal, too. No
problems. But on cached page it seems the site is somehow off track.
Only fix is to do apache reload.
The problem is not only with http_test, but after some hours of
traffic, too! Seems like the cache thinks "That's enough for today",
until you reload apache.
Strange problem, maybe I did something wrong somewhere. Any ideas?
Help would be appreciated. Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: which Django version to use for live site to be released in end of february 2008

2007-10-26 Thread web-junkie

We are running a production site with trunk. No problems so far. Just
watch any updates and update regularly.

On Oct 23, 5:00 pm, ydjango <[EMAIL PROTECTED]> wrote:
> I am working on product which will be released end of february. I am
> planning to use Django for building the site. I am new to Django
>
> Which version should I use - SVN or 0.96?
>
> If I use 0.96, I am worried migration to 1.0 will be very painful and
> time consuming.
> If I use SVN version , I am not sure how stable it is?
> Are there any production sites using the svn version.
> Can some one please recommend?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 0.96 login issue with cookies

2007-10-19 Thread web-junkie

Did you activate the cache in Django? I once discovered an issue with
that..


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem with query on m2m relation

2007-10-19 Thread web-junkie

Hi,

I have a m2m relationship from books to authors. A book can have 0-n
authors (yes, don't ask why there can be no authors). If I want to do
a search where I it should match the title or authors, I just gives me
books that have an author. Not the other matches. See here for the
code:

http://dpaste.com/22883/

Is my query wrong? Or wouldn't be the correct behaviour to do a left
join and alllow null values? (Bug?)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error from URLs with non-ascii characters and that need login

2007-09-02 Thread web-junkie

Okay, I did that.
http://code.djangoproject.com/ticket/5308

On Aug 14, 11:09 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-08-10 at 05:05 -0700, web-junkie wrote:
> > Okay, after further investigation the error appears for me too, not
> > just googlebot. When I browse the site as anonymous user and click a
> > link with encoded Unicode in URL, and if that links needs login, I get
> > an error.
> > Seems to be a bug in the checklogin decorator.
>
> If you could file a ticket for this, including a short description of
> how to repeat the problem, that would be brilliant. It will mean we
> don't forget to fix it (the volume on this list is too high for us to
> remember which particular pieces of email might or might not have
> mentioned bugs).
>
> Thanks,
> Malcolm
>
> --
> Save the whales. Collect the whole set.http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error from URLs with non-ascii characters and that need login

2007-08-10 Thread web-junkie

Okay, after further investigation the error appears for me too, not
just googlebot. When I browse the site as anonymous user and click a
link with encoded Unicode in URL, and if that links needs login, I get
an error.
Seems to be a bug in the checklogin decorator.

On Aug 8, 3:34 pm, web-junkie <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I get that error emailed, apparently Google tries to crawl pages that
> need a login. Now when there's Unicode in the URL this error is
> raised.
> Can anyone tell me why I get this error? It's really just Google's
> crawl, when I surf the site everything works fine.
>
> Traceback (most recent call last):
>
>  File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 77, in get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
>  File "/usr/local/lib/python2.4/site-packages/django/contrib/auth/
> decorators.py", line 18, in _checklogin
>return HttpResponseRedirect('%s?%s=%s' % (login_url,
> REDIRECT_FIELD_NAME, quote(request.get_full_path(
>
>  File "/usr/local/lib/python2.4/urllib.py", line 1117, in quote
>res = map(safe_map.__getitem__, s)
>
> KeyError: u'\xdf'
>
> <ModPythonRequest\npath:/gie\xdfen/,\nGET:,
> \nPOST:,\nCOOKIES:{},\nMETA:{'AUTH_TYPE': None,\n
> 'CONTENT_LENGTH': 0L,\n 'CONTENT_TYPE': None,\n 'GATEWAY_INTERFACE':
> 'CGI/1.1',\n 'HTTP_ACCEPT': '*/*',\n 'HTTP_ACCEPT_ENCODING': 'gzip',\n
> 'HTTP_CONNECTION': 'Keep-alive',\n 'HTTP_FROM':
> 'googlebot(at)googlebot.com',\n [...]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Error from URLs with non-ascii characters and that need login

2007-08-08 Thread web-junkie

Hi,

I get that error emailed, apparently Google tries to crawl pages that
need a login. Now when there's Unicode in the URL this error is
raised.
Can anyone tell me why I get this error? It's really just Google's
crawl, when I surf the site everything works fine.

Traceback (most recent call last):

 File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py", line 77, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/usr/local/lib/python2.4/site-packages/django/contrib/auth/
decorators.py", line 18, in _checklogin
   return HttpResponseRedirect('%s?%s=%s' % (login_url,
REDIRECT_FIELD_NAME, quote(request.get_full_path(

 File "/usr/local/lib/python2.4/urllib.py", line 1117, in quote
   res = map(safe_map.__getitem__, s)

KeyError: u'\xdf'



Re: Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie

On Jul 6, 4:44 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-07-06 at 07:25 -0700, web-junkie wrote:
> > Thanks for your reply. I'll give more information:
>
> > #  c:\django_src\django\core\handlers\base.py in get_response
>
> >   77. response = callback(request, *callback_args,
> > **callback_kwargs) ...
>
> > # c:\django_src\django\contrib\syndication\views.py in feed
>
> >   19. feedgen = f(slug, request.path).get_feed(param) ...
>
> > # c:\django_src\django\contrib\syndication\feeds.py in get_feed
>
> >   81. feed_url = add_domain(current_site,
> > self.__get_dynamic_attr('feed_url', obj)), ...
>
> > # c:\django_src\django\contrib\syndication\feeds.py in add_domain
>
> >   13. url = u'http://%s%s' % (domain, url) ...
>
> > print repr(domain) and print repr(url) in add_comain produces
>
> > u'www.example.com'
> > '/gie%C3%9Fen/'
> > 
> > '/feeds/gie\xc3\x9fen/'
>
> And so we see the advantage of providing details about how a problem
> occurs. This makes things clear. :-)
>
> It's a bug. I'll fix it tomorrow morning because I'm doing something
> else right now and about to stop for the evening. Plus I want to think a
> bit about what the right approach is for cases like this -- possibly we
> should be converting request.path to an IRI portion when we construct
> the HttpRequest. Maybe not.
>
> No need to worry about opening a ticket. I've made a note and will look
> at it first thing.
>
> Regards,
> Malcolm
>
> --
> He who laughs last thinks slowest.http://www.pointy-stick.com/blog/- Hide 
> quoted text -
>
> - Show quoted text -

Great, thank you so much!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie

Thanks for your reply. I'll give more information:

#  c:\django_src\django\core\handlers\base.py in get_response

  77. response = callback(request, *callback_args,
**callback_kwargs) ...

# c:\django_src\django\contrib\syndication\views.py in feed

  19. feedgen = f(slug, request.path).get_feed(param) ...

# c:\django_src\django\contrib\syndication\feeds.py in get_feed

  81. feed_url = add_domain(current_site,
self.__get_dynamic_attr('feed_url', obj)), ...

# c:\django_src\django\contrib\syndication\feeds.py in add_domain

  13. url = u'http://%s%s' % (domain, url) ...

print repr(domain) and print repr(url) in add_comain produces

u'www.example.com'
'/gie%C3%9Fen/'

'/feeds/gie\xc3\x9fen/'

You are right when you say that request.path is never passed directly
to add_domain, the error occurs when it uses feed_url.
feed_url is passed to the feed object from request.path

On Jul 6, 4:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-07-06 at 06:51 -0700, web-junkie wrote:
> > Hi, I have a problem of getting my feeds to work with unicode URLs.
>
> >  File "/usr/local/lib/python2.4/site-packages/django/contrib/
> > syndication/feeds.py", line 12, in add_domain
> >url = u'http://%s%s' % (domain, url)
>
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> > 19: ordinal not in range(128)
>
> You're only showing the last line of the traceback here. What is the
> full traceback? In particular, I would like to see which of the calls to
> add_domain() is triggering this.
>
> Can you also print out the values of "domain" and "url" inside that
> function -- or rather, print out repr(domain) and repr(url)? The easiest
> way to do this is change the source to catch UnicodeDecodeError in
> add_domain and then print out the values to sys.stderr and re-raise the
> exception.
>
>
>
> > In all my models I correctly encoded and quoted the URLs, I traced the
> > problem back to the request.path not being correctly quoted when it is
> > passed to the feed object.
>
> request.path is never passed directly to add_domain(), so it would help
> if you could explain this a little more. In particular, whenever
> add_domain() is called, it is using either the "link", "item_link" or
> "feed_url" attributes from your Feed class. If you can show us the code
> that is constructing each of those attributes, that would make things
> easier to work out what is going on.
>
>
>
> > There seems to be a bug or I'm doing something wrong, please help.
>
> It's not impossible that this is a bug, but you haven't given enough
> information to determine that. Show us the code that you've written to
> create these URLs and we should be able to get closer to a solution.
>
> Regards,
> Malcolm
>
> --
> The early bird may get the worm, but the second mouse gets the 
> cheese.http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Feeds don't work with Unicode URLs

2007-07-06 Thread web-junkie

Hi, I have a problem of getting my feeds to work with unicode URLs.

 File "/usr/local/lib/python2.4/site-packages/django/contrib/
syndication/feeds.py", line 12, in add_domain
   url = u'http://%s%s' % (domain, url)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
19: ordinal not in range(128)

In all my models I correctly encoded and quoted the URLs, I traced the
problem back to the request.path not being correctly quoted when it is
passed to the feed object.

There seems to be a bug or I'm doing something wrong, please help.
Thanks :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error from JSON serializer

2007-07-05 Thread web-junkie

okay, seems this ensure_ascii=False is useless, without it there's no
error.

On 5 Jul., 14:13, web-junkie <[EMAIL PROTECTED]> wrote:
> Hi,
>
> after updating to the trunk with the merged Unicode branch I get
> errors for my json pages. Everything is normal until I request
> something where it would serialize data with foreign language letters
> which comes as Unicode from the database.
> And as far as I can tell I have done everything it says 
> inhttp://www.djangoproject.com/documentation/unicode/.
>
>  File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
> __init__.py", line 67, in serialize
>s.serialize(queryset, **options)
>
>  File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
> base.py", line 50, in serialize
>self.end_serialization()
>
>  File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
> json.py", line 26, in end_serialization
>simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder,
> **self.options)
>
>  File "/usr/local/lib/python2.4/site-packages/django/utils/simplejson/
> __init__.py", line 139, in dump
>fp.write(chunk)
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in
> position 2: ordinal not in range(128)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Error from JSON serializer

2007-07-05 Thread web-junkie

Hi,

after updating to the trunk with the merged Unicode branch I get
errors for my json pages. Everything is normal until I request
something where it would serialize data with foreign language letters
which comes as Unicode from the database.
And as far as I can tell I have done everything it says in
http://www.djangoproject.com/documentation/unicode/.


 File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
__init__.py", line 67, in serialize
   s.serialize(queryset, **options)

 File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
base.py", line 50, in serialize
   self.end_serialization()

 File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
json.py", line 26, in end_serialization
   simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder,
**self.options)

 File "/usr/local/lib/python2.4/site-packages/django/utils/simplejson/
__init__.py", line 139, in dump
   fp.write(chunk)

UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in
position 2: ordinal not in range(128)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: json serializing without certain fields

2007-06-01 Thread web-junkie

Sorry for being a littly bit offensive.
Thanks for your replies and for commiting the patches, works like a
charm now.

On Jun 1, 3:44 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 6/1/07, web-junkie <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi
> > how can I get JSON out of my Django object without having certain
> > fields in there for obvious reasons?
> > I found solutions like serializers.serialize("json",
> > Something.objects.all(), fields='myfield' )
> > which do not work, there's also a ticket on 
> > thathttp://code.djangoproject.com/ticket/3466
> > Why isn't that solved by now and how can I get it to work the way I
> > want?
>
> For whatever reason, the triage team hadn't promoted that ticket to
> 'ready for checkin' status. That doesn't mean the ticket wasn't ready
> for checkin - just that nobody had given it enough attention as yet.
>
> Like Malcolm said, we're all volunteers here. Complaining about the
> speed of the bug fixing process doesn't solve the problem. If you want
> things to move faster, feel free to help out.
>
> However, that said, now that we are aware of the problem, it was an
> easy fix, committed as [5409].
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



json serializing without certain fields

2007-06-01 Thread web-junkie

Hi
how can I get JSON out of my Django object without having certain
fields in there for obvious reasons?
I found solutions like serializers.serialize("json",
Something.objects.all(), fields='myfield' )
which do not work, there's also a ticket on that 
http://code.djangoproject.com/ticket/3466
Why isn't that solved by now and how can I get it to work the way I
want?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---