Re: django server tree organization

2006-07-30 Thread [EMAIL PROTECTED]


Guillermo Fernandez Castellanos wrote:
> Hi,
>
of course ,the second model is better,the first one is too much
confused
> I've seen this subject several times in the mailing lists without
> being able to find a definite/useful answer in the mailing list.
>
> I'm going to have a server with several domain names serve a few
> applications (blog, photo gallery,...). But I'm a bit at a loss when
> dealing with how to organize the different files.
>
> In Django there's a separation between templates, media, applications,
> the sites urls.py,... The question is, what is the
> suggested/official/best practices way of managing a server with
> several sites? Same for keeping an svn tree.
>
> Do you organize it like:
> /templates/site1
>/site2
> /media/site1
>   /site2
> /urls/site1
>   /site2
> /apps/app1
> /app2
> /app3
>
> Or more like:
> /site1/templates
> /media
> /urls.py
> /site2/templates
> /media
> /urls.py
>
> Or maybe another way?
>
> Same for svn (maybe for svn it makes more sense the second model...).
> 
> Thanks a lot,
> 
> G


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: TEMPLATE_CONTEXT_PROCESSORS

2006-07-30 Thread Rares Vernica

Hi,

I written my own views. How can I pass a RequestContext objects, instead 
of a plain Context object, from my view to my template?

Thanks a lot,
Ray

Ian Clelland wrote:
> On 7/24/06, Rares Vernica <[EMAIL PROTECTED]> wrote:
>> The goal is to have request.META.PATH_INFO in templates.
>>
>> The problem is that TEMPLATE_CONTEXT_PROCESSORS does not seem to make
>> any difference. request is still not accessible from template. Even is
>> I
>> set the variable to () nothing happens.
> 
> As far as I know, the TEMPLATE_CONTEXT_PROCESSORS setting only affects
> templates which have a RequestContext object passed to them by the
> view, and not a plain Context object.
> 
> The Django generic views all use RequestContext objects, but if you've
> written your own views, then you may be using plain Context objects,
> and your context processors won't be executed at all.
> 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Database API question: I am not able to return a QuerySet

2006-07-30 Thread SmileyChris

How about just making the query like this:

A.objects.filter(b__status=1)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



editable=False and "Could not find Formfield or InlineObjectCollection named ..."

2006-07-30 Thread Corey

When I set editable=False in a model and modify the "fields" attribute
of the Admin class, a "Could not find Formfield or
InlineObjectCollection named ..." is generated.

Removing the editable=False makes it work again.

Is this a bug, or working as it is supposed to?

Thanks,

Corey


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Database API question: I am not able to return a QuerySet

2006-07-30 Thread Suriya

Hi all,

I have a situation here where I do not know how to use
the filter() function in the database API to obtain a
QuerySet. I am describing the schema and what I have
done, below. I hope you have an answer to my question.

# Only the necessary fields are shown here
class A(models.Model):
pass

class B(models.Model):
a  = models.ForeignKey(A)
status = models.IntegerField('Status', blank=False)
date   = models.DateField('Date',  blank=False)
class Meta:
get_latest_by = 'date'

Whenever there is a change in the status of a row in
table A, a new row is added to table B, to reflect that
change. The latest row in table B corresponding to an
A, represents the current status of that A. It is
possible that there exists an A, which has no entry in
table B.

Now, what I want is a QuerySet of A's whose current
status is 1.

As of now, this is what I am doing:

class ValidAsManager(models.Manager):
"""does not return a QuerySet"""
def get_query_set(self):
return (i for i in super(ValidAsManager, self).get_query_set()
 if i.status() == 1)

class A(models.Model):

objects = models.Manager()
current_objects = ValidAsManager()

def status(self):
try:
s = self.b_set.latest()
return s.status
except ObjectDoesNotExist:
return 0

I am not able to use generic views for listing the
valid A's because ValidAsManager does not return a
QuerySet. Could someone tell me what I can do to return
a QuerySet? How can I use the filter function to do so?

If you feel my schema is incorrect, I can consider
changing it.

Thanks,
Suriya


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: app specific admin changes

2006-07-30 Thread Tamara D. Snyder

This is what I thought, but where do I put these files?  Directly in  
my project directory?  In a project/templates/admin directory?   
Directly in my application directory?  In my application/templates  
directory?  In an application/templates/admin directory? In an  
application/templates/application/admin directory?

I have tried:
project/application/templates/admin - this only works for the top  
listing in TEMPLATE_DIRS in the settings file, and it works for all  
applications
project/application/templates/admin/application - doesn't work
project/application/templates/admin/application/model - doesn't work
project/templates/admin/application - doesn't work
project/templates/admin/application/model - doesn't work

I guess I just don't know where to put it, in the grand scheme of  
things.

Thanks for the help!

On Jul 30, 2006, at 6:35 PM, James Bennett wrote:

>
> On 7/30/06, Tamara D. Snyder <[EMAIL PROTECTED]> wrote:
>> I think that what I need to do is to make a copy of the
>> base_site.html file in the contrib/admin/templates/admin directory
>> and make my changes to it.  My problem is where to save the file.
>
> Where you save the file will make all the difference, because the
> admin follows a simple set of rules for determining which template it
> will use.
>
> For example, the template which shows an individual object and lets
> you edit it is called 'change_form.html'. Assuming an application
> called "blog" and a model called "Entry", the admin will load that
> template by looking for the following files, in the following order:
>
> blog/entry/change_form.html
> blog/change_form.html
> change_form.html
>
> So, depending on where you save your template, you can override for a
> specific mode, or for all models in an application, without affecting
> anything else (if you saved a template at "blog/change_form.html", for
> example, applications other than "blog" would still use the default
> one).
>
>
> -- 
> "May the forces of evil become confused on the way to your house."
>   -- George Carlin
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Empte XXX__in queries with postgres

2006-07-30 Thread Russell Keith-Magee
On 7/31/06, Neilen Marais <[EMAIL PROTECTED]> wrote:
Is this considered to be a bug, or must I simply live with it?I'd call inconsistency between database platforms a bug. If you would log this, we would be much obliged.Thanks,
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  -~--~~~~--~~--~--~---


Re: non date-based detail pages: previous/next?

2006-07-30 Thread Ian Holsman
you might want to do this 'work' when the user actually requests the page in question, not when you generate the one he is looking at.for example have 2 views defined in urls.pygetnext/(object-id)/getprev/(object-id)/and have these 2 views do the calculation on what is 'next' and issue the 301 redirect's to the real url in question.if you wanted to be really smart you could cache the result so the 2nd person to view the page would get the real url instead of the redirect.(thats how I would do it)but then.. I usually aim for the most complex way possible ;-)regardsianOn 31/07/2006, at 9:24 AM, SmileyChris wrote:jcb wrote: I have a page that lists a bunch of Geolocation objects (using thegeneric view list, works great.) I have a detail page(django.views.generic.list_detail.object_detail) that works great thesame way...displaying one geolocation (with a tiny Google map, nice.) Perhaps the best way is to not use a generic view list page. Instead,why don't you make a simple view which can parse the list, adding innext / prev ids for each item, then return the template.Then in your list template, add the next/prev ids for each item to thequerystring for each detail link.Maybe there's another more genius way, but that's how I'd do it :)

--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---


Re: non date-based detail pages: previous/next?

2006-07-30 Thread SmileyChris


jcb wrote:
> I have a page that lists a bunch of Geolocation objects (using the
> generic view list, works great.) I have a detail page
> (django.views.generic.list_detail.object_detail) that works great the
> same way...displaying one geolocation (with a tiny Google map, nice.)

Perhaps the best way is to not use a generic view list page. Instead,
why don't you make a simple view which can parse the list, adding in
next / prev ids for each item, then return the template.
Then in your list template, add the next/prev ids for each item to the
querystring for each detail link.

Maybe there's another more genius way, but that's how I'd do it :)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Simplifying template?

2006-07-30 Thread SmileyChris

Something like the following would be neat:

{{ s.teachers|loop:"userinfo.informal_name"|join:"; " }}
I thought of using python's "map" as the filter name but "loop" is
probably be a more generic term.

How I imagine the filter would look:
def loop(value, arg):
# TODO: do some test to ensure value is iterable
return [djangos_magical_resolver("x." + arg) for x in value]


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



app specific admin changes

2006-07-30 Thread Tamara D. Snyder

Hi All,

I am relatively new to Django, but I am enjoying trying to get my  
first application working.

My question today is about application specific changes to the  
Admin.  For instance, my project is full of little test applications  
(blog1, blog2, places, events).

I would like the "branding" at the top of each of the change-list and  
edit pages to go along with each app - in other words, at the top of  
the blog1 posts change-list page I would like it to say "Blog1  
Administration" and at the top of the places change-list page I would  
like it to say "Places Administration" and so forth.

I think that what I need to do is to make a copy of the  
base_site.html file in the contrib/admin/templates/admin directory  
and make my changes to it.  My problem is where to save the file.

My directory structure looks like this:

project dir
settings.py
urls.py
blog1 dir
models.py
urls.py
views.py
templates dir
blog1_base.html
blog1 dir
other templates for blog1
admin dir
base_site.html
places dir
models.py
urls.py
views.py
templates dir
places_base.html
places dir
other templates for places
admin dir
base_site.html


My problem is that if I edit the base_site.html files in my  
directories above, the changes seem to be universal, and which one  
gets used depends on the order of the directories that I list in the  
settings file (in TEMPLATE_DIRS)

Where/how should I position the base_site.html files so that only the  
application they pertain to will use them?

(Obviously I got this idea from part 2 of the tutorial, but that  
seems to cover only making project-wide changes to the admin, I am  
looking to make application specific changes.  I've searched the  
documentation, but I didn't find anything.  But if I've missed  
something, please point me to the right place.)

Thanks!

Tamara

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Empte XXX__in queries with postgres

2006-07-30 Thread Neilen Marais

Hi

I fairly often have code that looks like

Model.objects.filter(id__in=some_list)

where some_list is generated programatically. Sometimes some_list is
empty, and if it is, I get a psycopg.ProgrammingError exception. OTOH if I
use SQLite I simply get back an empty query-set as expected.

Is this considered to be a bug, or must I simply live with it?

Thanks
Neilen

-- 
you know its kind of tragic 
we live in the new world
but we've lost the magic
-- Battery 9 (www.battery9.co.za)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



non date-based detail pages: previous/next?

2006-07-30 Thread jcb

Okay, I've scoured the fine, fine documentation, and, well, nothing.

I have a page that lists a bunch of Geolocation objects (using the
generic view list, works great.) I have a detail page
(django.views.generic.list_detail.object_detail) that works great the
same way...displaying one geolocation (with a tiny Google map, nice.)

What I'm stymied about...how do you get a reference to the previous and
next geolocations in the result so you can have links on the page for
previous geolocation and next geolocation?

(The primary key IDs are not consecutive...they are mostly, but there
are gaps.)

This seems like something fundamental and generic-ish, hence my attempt
to use a generic view.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django server tree organization

2006-07-30 Thread Guillermo Fernandez Castellanos

Hi,

I've seen this subject several times in the mailing lists without
being able to find a definite/useful answer in the mailing list.

I'm going to have a server with several domain names serve a few
applications (blog, photo gallery,...). But I'm a bit at a loss when
dealing with how to organize the different files.

In Django there's a separation between templates, media, applications,
the sites urls.py,... The question is, what is the
suggested/official/best practices way of managing a server with
several sites? Same for keeping an svn tree.

Do you organize it like:
/templates/site1
   /site2
/media/site1
  /site2
/urls/site1
  /site2
/apps/app1
/app2
/app3

Or more like:
/site1/templates
/media
/urls.py
/site2/templates
/media
/urls.py

Or maybe another way?

Same for svn (maybe for svn it makes more sense the second model...).

Thanks a lot,

G

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: rss feed, unique_id

2006-07-30 Thread Wiktor Grębla

Wiktor Grêbla napisa³(a):

I've an impression that this message was not delivered to the list, 
although google finds it...

> I was trying to add an rss feed with blog comments, and I'm mostly done,
> here are some snippets i pasted on irc this morning:
>
> http://paste.e-scribe.com/934/
>
> The problem is that i'd like to have unique_id for each item (comments 
> don't have unique links, as they're "attached" to the blog entries).
>
> As far as I see, unique_id is set to the link in the 
> syndication/feeds.py, get_feed() function, so what comes to my mind is 
> to use low-level feedgenerator, which allows to set unique_id. The 
> example in the docs looks quite straightforward, but something is 
> missing (for me), how should i use it? How should i return generated 
> feed? Or maybe there is a better (simpler, more correct) way?
>
> item_link() could simply return some meaningless (unique) link, or 
> even better, return a correct link to the entry/article with an 
> additional part (comment id) and then (with url.rewrite) I could 
> ignore the additional part, but maybe there is a better way?
>
> (An example how to use feedgenerator would be appreciated :))

Actually, as I found out later reading the code, using feedgenerator is 
not at all difficult:

http://paste.e-scribe.com/936/

Regards,
W.

-- 
Talkers are no good doers.
http://greblus.go.pl


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: Scandinavian characters in .po files and timezones

2006-07-30 Thread Mikko Nylén

Thanks for all answers. I was able to fix the problem by starting over with the 
django.po. May be the problem was that when I did start working with the file, 
I didn't have set encoding=utf-8 and when I turned it on in the middle, Vim 
didn't convert the characters to UTF-8.

- Mikko Nylé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
-~--~~~~--~~--~--~---



Re: Class variables in mod_python

2006-07-30 Thread [EMAIL PROTECTED]

Adrian Holovaty wrote:
[...]
> You could use the cache framework to store stuff in there temporarily.
> Alternatively, I don't think it's a huge problem to store that in the
> database.

Thanks for your quick response! Good to know that at least I was on the
right track as to what my problem was.

I changed it to use a database table. I just felt that this was nothing
that *needed* to be persistent. Oh, well. No big deal.

Cheers,

  Daniel


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Class variables in mod_python

2006-07-30 Thread Adrian Holovaty

On 7/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> This works fine in the development server. Under mod_python, though, it
> appears that these class variables don't work (getRequest doesn't
> return what I've previously put in via newRequest). Is there a
> difference wrt class variables between mod_python and the development
> server?
>
> I'd assume the problem was due to the fact that mod_python spawns new
> processes for each request, right?

Yeah, that's exactly it. You shouldn't really count on any sort of
global variables in mod_python, because there's no guarantee you'll
get the same Python interpreter for one request that you got for a
previous request.

> Is there a workable solution for using class variables with mod_python?
> I'd hate to store this temporary information (removed once the user
> successfully changed his password) in the DB.

You could use the cache framework to store stuff in there temporarily.
Alternatively, I don't think it's a huge problem to store that in the
database.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Simplifying template?

2006-07-30 Thread Adrian Holovaty

On 7/29/06, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
> Is there any way to make the following any simpler? It's inside
> another {% for ... %}, so the ugliness is particularly jarring.
>
> {% for t in s.teachers %}
> {{ t.userinfo.informal_name }}{% if not forloop.last %}}; {{% endif %}}
> {% endfor %}

That's the Django template convention for putting a bunch of text
"between" elements, so you don't have to change a thing. If you're
interested in coming up with a more terse way of doing that, we'd be
happy to take a look at your suggestions!

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Class variables in mod_python

2006-07-30 Thread [EMAIL PROTECTED]

Hi.

I've built a password reset mechanism for my application using class
variables to store random passwords which are later used to authorize
password resets.

Here's what I'm using:

# Speichert Passwortanfragen und gibt sie bei Bedarf zurück
class PasswordRequest:
requests = {}

def newRequest(self, username, key):
self.requests[username] = key

def getRequest (self, username):
if self.requests.has_key(username):
return self.requests[username]
return None

def removeRequest(self, username):
if self.requests.has_key(username):
del self.requests[username]

This works fine in the development server. Under mod_python, though, it
appears that these class variables don't work (getRequest doesn't
return what I've previously put in via newRequest). Is there a
difference wrt class variables between mod_python and the development
server?

I'd assume the problem was due to the fact that mod_python spawns new
processes for each request, right?

Is there a workable solution for using class variables with mod_python?
I'd hate to store this temporary information (removed once the user
successfully changed his password) in the DB.

Or is there something else scwewy awound here?

Daniel


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Scandinavian characters in .po files and timezones

2006-07-30 Thread Jean-Francois Roy


On Jul 30, 2006, at 08:08, Mikko Nylén wrote:


Also, I'd like to ask how different timezones should be handled? I'm
building an application where it would be necessary for the users  
to be able
to choose their own timezone to display date and time information  
correctly.

One option would be, of course, to save the date and time returned by
datetime.utcnow() to database and then for each user have setting
"timezone", which would tell the offset from UTC in seconds.  
However, if

there are any better ways to handle this, I'd like to know about them.



You may want to have a look at http://code.djangoproject.com/ticket/ 
2447, which I recently submitted. It's not much, and probably not  
very good, but it's been working for me nicely with datetime fields  
so far.



Jean-François Roy

--
Co-Founder of MacStorm
/dev/klog. You better pipe that through your mind.

http://www.devklog.net
http://www.macstorm.org
[EMAIL PROTECTED]

http://www.devklog.net/documents/Jean-Francois_Roy.gpgkey
Fingerprint: 06CD 6F7B 4BF0 2AC6 78B2 57A3 06BE 6CB3 0591 FA2D



PGP.sig
Description: This is a digitally signed message part


Re: Scandinavian characters in .po files and timezones

2006-07-30 Thread Ian Clelland

On 7/30/06, Antonio Cavedoni <[EMAIL PROTECTED]> wrote:
> I don't know much about Vim, but it appears your ö and ä are entered
> with an encoding different than UTF-8. Python then tries to decode
> your characters thinking they might be valid UTF-8, but they are not,
> so it raises the UnicodeDecodeError.
>
> FYI: ä (LATIN SMALL LETTER A WITH DIAERESIS) in UTF-8 is \xc3\xa4,
> whereas \xe4 is its encoded form in ISO-8859-1/Latin-1 (and
> ISO-8859-10/Latin-6 as well, I haven't looked at other encodings).

It's quite possible that this is the case -- in a unix environment,
you can use the od command to see the bytewise encoding of the text
file. Use something like

  od -t x1 filename.txt

to see the individual bytes in hex.

Also, to test pythons unicode handling, try a simple file with nothing but

print u"ä"

and see how python handles the string.

> I googled a bit, and found this page [1] where it says that to set
> your Vim to the UTF-8 encoding you have to use the following command
> (note the column at the beginning):
>
> :set encoding=utf-8

The colon at the beginning of the line is to enter command mode in
vim, when you are using it interactively. It is not required in a
.vimrc file.


-- 
Regards,
Ian Clelland
<[EMAIL PROTECTED]>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Scandinavian characters in .po files and timezones

2006-07-30 Thread Antonio Cavedoni

On 30 Jul 2006, at 14:08, Mikko Nylén wrote:
> I tried to change all 'ä's with \xe4 and 'ö's with \xf6 and with  
> those I was
> able to make the messages compile. However, when trying to launch the
> built-in server, I get error saying "UnicodeDecodeError: 'utf8'  
> codec can't
> decode bytes in position 26-28: invalid data".
>
> I'm using Vim as my editor and I have set "set encoding=utf-8"  
> in .vimrc.
> Also, in the django.po I have line "Content-Type: text/plain;
> charset=utf-8". Is there something else I'm missing?

I don’t know much about Vim, but it appears your ö and ä are entered  
with an encoding different than UTF-8. Python then tries to decode  
your characters thinking they might be valid UTF-8, but they are not,  
so it raises the UnicodeDecodeError.

FYI: ä (LATIN SMALL LETTER A WITH DIAERESIS) in UTF-8 is \xc3\xa4,  
whereas \xe4 is its encoded form in ISO-8859-1/Latin-1 (and  
ISO-8859-10/Latin-6 as well, I haven’t looked at other encodings).

I googled a bit, and found this page [1] where it says that to set  
your Vim to the UTF-8 encoding you have to use the following command  
(note the column at the beginning):

:set encoding=utf-8

[1] http://www.vim.org/htmldoc/mbyte.html

> Also, I'd like to ask how different timezones should be handled? I'm
> building an application where it would be necessary for the users  
> to be able
> to choose their own timezone to display date and time information  
> correctly.
> One option would be, of course, to save the date and time returned by
> datetime.utcnow() to database and then for each user have setting
> "timezone", which would tell the offset from UTC in seconds.

Yeah, this way sounds reasonable to me.

You may also want to have a look at pytz:

http://pytz.sourceforge.net/

Cheers!
-- 
Antonio



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



rss feed, unique_id

2006-07-30 Thread Wiktor Grębla

Hi.

I was trying to add an rss feed with blog comments, and I'm mostly done,
here are some snippets i pasted on irc this morning:

http://paste.e-scribe.com/934/

The problem is that i'd like to have unique_id for each item (comments 
don't have unique links, as they're "attached" to the blog entries).

As far as I see, unique_id is set to the link in the 
syndication/feeds.py, get_feed() function, so what comes to my mind is 
to use low-level feedgenerator, which allows to set unique_id. The 
example in the docs looks quite straightforward, but something is 
missing (for me), how should i use it? How should i return generated 
feed? Or maybe there is a better (simpler, more correct) way?

item_link() could simply return some meaningless (unique) link, or even 
better, return a correct link to the entry/article with an additional 
part (comment id) and then (with url.rewrite) I could ignore the 
additional part, but maybe there is a better way?

(An example how to use feedgenerator would be appreciated :))

Cheers,
W.

-- 
Talkers are no good doers.
http://greblus.go.pl

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



POST MATRIMONY MESSAGE/PROFILE FREE & JOBS/RESUMES FREE

2006-07-30 Thread chetana.jobs


Post Matrimony Message/Profile FREE only on
http://www.net4matrimonials.com

--

--

--

Post jobs/resumes FREE only on http://www.net4professionals.com


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django vs TurboGears

2006-07-30 Thread Jeroen Ruigrok van der Werven

On 7/30/06, gabor <[EMAIL PROTECTED]> wrote:
> what is JASON?
> (or the original poster misspelled json?)

http://www.json.org/

JSON (JavaScript Object Notation) is a lightweight data-interchange format.

Good chance simplejson will make it to Python 2.6.

-- 
Jeroen Ruigrok van der Werven

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django vs TurboGears

2006-07-30 Thread gabor

Elver Loho wrote:
> 
>> Django doesn't use AJAX while TG uses Mochikit and JASON.
> 
> ...and what stops you from using Mochikit and JASON with Django? It's
> like saying that you can't order ice-cream at McDonald's, because it's
> not part of the Happy Meal you're eating.
> 

(after several minutes of (unsuccessfull googling))

what is JASON?
(or the original poster misspelled json?)


> 
> I'll give you a couple of reasons to use Django, which I myself found 
> important.
> 
> * Caching framework. Simply awesome.
> * Autogenerated admin interface is more advanced than the Turbogears
> one. (Last I checked.) Still, you will have to write your own
> eventually.

and the project's name is MUCH cooler :-)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Scandinavian characters in .po files and timezones

2006-07-30 Thread Mikko Nylén

Hi!,

I would like to use internationalization features provided by Django, but
I'm having some issues when dealing with Scandinavian characters 'ä', 'ö'
and 'å'. If I enter such characters in django.po and try to compile the
messages, it tells me that there is an invalid byte sequence wherever such
characters are used.

I tried to change all 'ä's with \xe4 and 'ö's with \xf6 and with those I was
able to make the messages compile. However, when trying to launch the
built-in server, I get error saying "UnicodeDecodeError: 'utf8' codec can't
decode bytes in position 26-28: invalid data".

I'm using Vim as my editor and I have set "set encoding=utf-8" in .vimrc.
Also, in the django.po I have line "Content-Type: text/plain;
charset=utf-8". Is there something else I'm missing?

Also, I'd like to ask how different timezones should be handled? I'm
building an application where it would be necessary for the users to be able
to choose their own timezone to display date and time information correctly.
One option would be, of course, to save the date and time returned by
datetime.utcnow() to database and then for each user have setting
"timezone", which would tell the offset from UTC in seconds. However, if
there are any better ways to handle this, I'd like to know about them.

Thanks,

- Mikko Nylé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
-~--~~~~--~~--~--~---



Re: Template widget size

2006-07-30 Thread Nagy Károly

Steven Armstrong írta:

>Instead of writing a patch, I've extended/wrapped djangos model and form 
>fields. This way you can update django without having to reapply patches.
>
>You can find the code and instructions under [1].
>
>Just for the record. I'm totally with Malcolm that this is not a pretty 
>solution and that in time there must be a better way.
>
>[1] http://www.c-area.ch/code/django/
>  
>
Thank you Steven, i'll check it.
I am not sure (yet) what is the difference in our opinions, i aggre with
Malcolm, too.
I just wanted to mention, if any code connects model with presentation,
do it right. We can shift it to here, there, anywhere..core developer
knows better the right place for it.
Anyway, this patch saves me some work. (this thread became twice long as
useful :)

Charlie (who agree)

-- 

"...s minden mestert kinevettem, ki nem nevetett önmagán."
GPG public key: http://www.rendszergazda.com/gpg/charlie-gpg-public-key.asc


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: psycopg2

2006-07-30 Thread Tom Tobin

On 7/30/06, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> postgresql_psycopg2
>
> Yes I found it. Yes I know it's not supported . But could somebody tell me
> how to tell it to shut up? My eyes are bleeding! :)  The debug output is
> just a little overwhelming and quite useless unless you are the module
> developer. Is there switch somewhere I could flip without shutting off
> debugging for everything?

See the last question here:

http://initd.org/tracker/psycopg/wiki/PsycopgTwoFaq

In short, rebuild psycopg2 after yanking PSYCOPG_DEBUG from "define"
in setup.cfg.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---