Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Graham Dumpleton



On Sep 6, 3:52 pm, Karen Tracey  wrote:
> On Sun, Sep 6, 2009 at 1:36 AM, Jim Myers  wrote:
>
> > Thanks, but that doesn't do it either.
> > I changed the regex to:
>
> > ^portal/student/(?P\S+)/profile_edit/$
>
> > and it still doesn't match :(
>
> It should:
>
> >>> import re
> >>> re.match(r'^portal/student/(?P\S+)/profile_edit/$',
>
> 'portal/student/xx.yy/profile_edit/').groupdict()
> {'userid': 'xx.yy'}
>
>
>
> I don't know what to tell you. The regex now matches the url you specified.
> url mapping isn't fundamentally broken in Django.  There's got to be
> something else going on in your scenario...

There is always the failing to restart Apache after changes
option. ;-)

Graham

> Karen
>
> On Sep 5, 9:44 pm, Karen Tracey  wrote:
>
>
>
> > > On Sat, Sep 5, 2009 at 11:32 PM, Jim Myers  wrote:
>
> > > > Hi, I'm using this regex in urls.py:
>
> > > > r'^portal/student/(?P\S+)/profile_edit$'
>
> > > > There's no trailing slash on this regex, but there is an end of string
>
> > > marker ($). So a match will have to end with 'profile_edit', no trailing
> > > slash.
>
> > > > to try to match this url:
>
> > > >http://dd..org/portal/student/xx.yy/profile_edit/
>
> > > This url ends with a trailing slash, thus won't match the above regex.
>
> > > Karen
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Karen Tracey
On Sun, Sep 6, 2009 at 1:36 AM, Jim Myers  wrote:

>
> Thanks, but that doesn't do it either.
> I changed the regex to:
>
> ^portal/student/(?P\S+)/profile_edit/$
>
> and it still doesn't match :(
>
>
It should:

>>> import re
>>> re.match(r'^portal/student/(?P\S+)/profile_edit/$',
'portal/student/xx.yy/profile_edit/').groupdict()
{'userid': 'xx.yy'}
>>>

I don't know what to tell you. The regex now matches the url you specified.
url mapping isn't fundamentally broken in Django.  There's got to be
something else going on in your scenario...

Karen

On Sep 5, 9:44 pm, Karen Tracey  wrote:
> > On Sat, Sep 5, 2009 at 11:32 PM, Jim Myers  wrote:
> >
> > > Hi, I'm using this regex in urls.py:
> >
> > > r'^portal/student/(?P\S+)/profile_edit$'
> >
> > > There's no trailing slash on this regex, but there is an end of string
> >
> > marker ($). So a match will have to end with 'profile_edit', no trailing
> > slash.
> >
> > > to try to match this url:
> >
> > >http://dd..org/portal/student/xx.yy/profile_edit/
> >
> > This url ends with a trailing slash, thus won't match the above regex.
> >
> > Karen
> >
>

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Jim Myers

Thanks, but that doesn't do it either.
I changed the regex to:

^portal/student/(?P\S+)/profile_edit/$

and it still doesn't match :(

On Sep 5, 9:44 pm, Karen Tracey  wrote:
> On Sat, Sep 5, 2009 at 11:32 PM, Jim Myers  wrote:
>
> > Hi, I'm using this regex in urls.py:
>
> > r'^portal/student/(?P\S+)/profile_edit$'
>
> > There's no trailing slash on this regex, but there is an end of string
>
> marker ($). So a match will have to end with 'profile_edit', no trailing
> slash.
>
> > to try to match this url:
>
> >http://dd..org/portal/student/xx.yy/profile_edit/
>
> This url ends with a trailing slash, thus won't match the above regex.
>
> Karen
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Template tag for getting CSS/scripts/images

2009-09-05 Thread Wiiboy

I'm considering making a custom template tag that returns a url to a
css file or image file.

In your opinion, is it a waste of time?
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Karen Tracey
On Sat, Sep 5, 2009 at 11:32 PM, Jim Myers  wrote:

>
> Hi, I'm using this regex in urls.py:
>
> r'^portal/student/(?P\S+)/profile_edit$'
>
> There's no trailing slash on this regex, but there is an end of string
marker ($). So a match will have to end with 'profile_edit', no trailing
slash.


> to try to match this url:
>
> http://dd..org/portal/student/xx.yy/profile_edit/
>
>
This url ends with a trailing slash, thus won't match the above regex.

Karen

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Image Location

2009-09-05 Thread Karen Tracey
On Sat, Sep 5, 2009 at 7:37 PM, A. Rossi  wrote:

>
> I am suffering a similar problem, but I think the problem is that my
> URLConf is improperly configured to display the images.
> Could somebody direct me to the proper documentation for displaying
> static images with the dev server?
>
>
http://docs.djangoproject.com/en/dev/howto/static-files/

Karen

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django pagination

2009-09-05 Thread Karen Tracey
On Sat, Sep 5, 2009 at 4:52 PM, Michael Ralan  wrote:

>
> Hi,
>
> Apologies if this question has been asked before but I was not able to
> find a satisfactory answer.
>
> In the django admin app there is a capability to have a pagination
> object that lists the number of pages that can be paged.
>
> I have found code that uses the django Paginator object which builds a
> navbar that looks like this
>
>  previous
>
> The documentation for the Paginator tag (seems to be non-native) on
> the django site shows what I want. But is an example that uses a
> custom template. This is also clearly a custom tag.
>
> How do I use the django admin navbar in my app? I want it to display
> something like
>
> [1] [2] [3] [...] [30]
>
> and do it natively.
>
>
I don't know what you mean by native and non-native.  Admin builds that list
of possible pages you can jump to using its own custom tag, the heart of the
code is here:


http://code.djangoproject.com/browser/django/tags/releases/1.1/django/contrib/admin/templatetags/admin_list.py#L28

The tags used by the admin are generally not documented for use by other
apps.  Thus there is no direct way to "paginate like admin", but the source
is freely available so you can certainly borrow it.

Karen

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: PostgreSQL or MySQL, What are the +'s and -'s?

2009-09-05 Thread Joshua Russo
Thanks, that is a good example.
Back to the original point of the post. It looks like I'm going to be doing
a lot more work with PgSQL. I see they are working to put replication in the
core in the next major subversion (which honestly I rarely need). The real
kicker for me is that PgSQL seems to have all of the query features I've
been missing in MySQL. I'm generally creating CRUD applications and then
data reporting. It seems like the combo of Django and PgSQL is really where
it's at for me.

I just completed the bulk of my first Django app and I'm eating it up. So
much so that I almost immediately jumped into the core to see how I could
help. It's like this entire new world of speed and efficiency was just
dropped in my lap and I only want to help make it better. I have both
Practical Django and Pro Django on their way. :o)

Thanks for this thread. This group has always been a great help!


On Sun, Sep 6, 2009 at 2:31 AM, Siemster wrote:

>
> ++ Zberteoc for the link to the comparison.
>
> w.r.t. using triggers/procedures. If a database is getting updated by
> multiple applications then using triggers/procedures to move
> duplicated business rules into the database starts to make some
> sense-- even more so if you don't have good control over all the
> applications that are doing the updating.
>
>
> On Sep 5, 6:25 am, Joshua Russo  wrote:
> > Great site! thanks
> >
> > With my SQL experience, your comment about database coding seems to ring
> > true. The database is a much different environment, with
> > different paradigms, than a standard application environment. When you
> > really need database coding you know it (kind of like meta programming).
> >
> > So far from my experience has been, the times I found we needed database
> > programming were pretty simply speed related, so difficult to distinguish
> > from application logic. What types of situations do others find useful
> for
> > stored procedures and triggers?
> >
> > On Sat, Sep 5, 2009 at 9:57 AM, Zberteoc  wrote:
> >
> > > This is a common mistake almost all non SQL developers make thinking
> > > in procedural/programming language terms in regards wit SQL and
> > > database coding. If you're asking me there is nothing cool in the
> > > feature of creating stored procedures in other than the SQL language.
> > > MS-SQL introduced that with 2005 version, CLR integration, but I is
> > > hardly used for one very simple reason it is NOT really necessary. SQL
> > > code needs to be understood first and only then look elsewhere.
> > > Anyways, in terms of comparison PgSQL vs MySQL here is a very detailed
> > > wiki:
> >
> > >http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL
> >
> > > I have never used PgSQL but i wouldn't hesitate to use it if I needed
> > > it. All DBMS these days are robust and mature enough to be able to
> > > rely on them. It comes in the end to what you prefer, how comfortable
> > > you feel and ease of use, rather than how many terrabytes they can
> > > deal with as the features lists are more and more the same for all of
> > > them. Support and online community is also very important, probably
> > > the most if you're novice in both, and here MySQL prevails as it is
> > > far more popular.
> >
> > > Cheers.
> >
> > > On Sep 4, 10:46 pm, Joshua Russo  wrote:
> > > > Wow, that's a cool trick to be able to implement stored procedures in
> > > > different languages. I might actually use them more if I could do
> > > everything
> > > > in the same language as the application.
> > > > I only looked quickly through the PostgreSQL docs for subqueries.
> Thanks
> > > for
> > > > the heads up.
> >
> > > > As far as the Gis functionality goes, I could see a database like
> that
> > > > needing some serious horse power if it became popular. Any thoughts
> on
> > > how
> > > > that would reconcile with the weakness in replication? I suppose most
> Gis
> > > > systems are more for out put than input so the slow replication might
> not
> > > > really matter that much.
> >
> > > > On Sat, Sep 5, 2009 at 1:17 AM, Siemster <
> gregory.si...@pca.state.mn.us
> > > >wrote:
> >
> > > > > PostgreSQL does support subqueries in the from clause, however
> iirc,
> > > > > the subquerys require an alias.
> >
> > > > > If you decide to do geo then the PostGis addon to Postgres is very
> > > > > nice.
> >
> > > > > Another nice capability in PostgreSQL is that you can use different
> > > > > languages for writing your stored procedures (should you wish to
> use
> > > > > them). Some of the available languages (in addition to PL/pgSQL)
> are
> > > > > Perl, Python, Tcl, PHP, Ruby, R, Scheme, and Java.
> >
> > > > > Whether you choose to use Postgres or not, I'd recommend at least
> > > > > looking at it. There is even a live cd (which I have not tried) at
> > > > >http://www.postgresql.org/download/whichlets you try PostgreSQL out
> > > > > without having to install it.
> >
> > > > > On Sep 4, 7:38 pm, Joshua Russo  wrote:
> > > > > > On Fri, Sep 4, 2009 at 1

Re: Django remove value from field with attrs disabled="disabled"

2009-09-05 Thread Karen Tracey
On Sat, Sep 5, 2009 at 1:52 PM, eli  wrote:

>
> Hi,
>
> I have problem with Django Forms and field with set attrs to
> disabled="disabled"
>
> [snip]
> And now, Django remove values form field with attrs 'disabled':
> 'disabled' ("readonly" without "disabled" works fine, but I need
> disabled option in my html output). Why Django do that?
>
>
Django is not removing the values.  Rather the browser does not send to the
server values for form elements that are disabled when the form is
submitted. The HTML 4 spec here:
http://www.w3.org/TR/REC-html40/interact/forms.html#disabled notes in
discussing an example "Therefore, it cannot receive user input nor will its
value be submitted with the form."

By setting the element to disabled you have done essentially the same thing
as excluding it from the from (as far as Django can see), and you are
similarly responsible for supplying values for fields that are not contained
in the submitted form.  See the note here:

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form

Karen

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-05 Thread Jim Myers

Hi, I'm using this regex in urls.py:

r'^portal/student/(?P\S+)/profile_edit$'

to try to match this url:

http://dd..org/portal/student/xx.yy/profile_edit/

It's supposed to put "xx.yy" into userid parameter and match and use
the associated view.

But it doesn't match. I've banged my head for hours with regexes and
don't see why not.

Why won't this work?  Should I be doing this a better way?

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: PostgreSQL or MySQL, What are the +'s and -'s?

2009-09-05 Thread Siemster

++ Zberteoc for the link to the comparison.

w.r.t. using triggers/procedures. If a database is getting updated by
multiple applications then using triggers/procedures to move
duplicated business rules into the database starts to make some
sense-- even more so if you don't have good control over all the
applications that are doing the updating.


On Sep 5, 6:25 am, Joshua Russo  wrote:
> Great site! thanks
>
> With my SQL experience, your comment about database coding seems to ring
> true. The database is a much different environment, with
> different paradigms, than a standard application environment. When you
> really need database coding you know it (kind of like meta programming).
>
> So far from my experience has been, the times I found we needed database
> programming were pretty simply speed related, so difficult to distinguish
> from application logic. What types of situations do others find useful for
> stored procedures and triggers?
>
> On Sat, Sep 5, 2009 at 9:57 AM, Zberteoc  wrote:
>
> > This is a common mistake almost all non SQL developers make thinking
> > in procedural/programming language terms in regards wit SQL and
> > database coding. If you're asking me there is nothing cool in the
> > feature of creating stored procedures in other than the SQL language.
> > MS-SQL introduced that with 2005 version, CLR integration, but I is
> > hardly used for one very simple reason it is NOT really necessary. SQL
> > code needs to be understood first and only then look elsewhere.
> > Anyways, in terms of comparison PgSQL vs MySQL here is a very detailed
> > wiki:
>
> >http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL
>
> > I have never used PgSQL but i wouldn't hesitate to use it if I needed
> > it. All DBMS these days are robust and mature enough to be able to
> > rely on them. It comes in the end to what you prefer, how comfortable
> > you feel and ease of use, rather than how many terrabytes they can
> > deal with as the features lists are more and more the same for all of
> > them. Support and online community is also very important, probably
> > the most if you're novice in both, and here MySQL prevails as it is
> > far more popular.
>
> > Cheers.
>
> > On Sep 4, 10:46 pm, Joshua Russo  wrote:
> > > Wow, that's a cool trick to be able to implement stored procedures in
> > > different languages. I might actually use them more if I could do
> > everything
> > > in the same language as the application.
> > > I only looked quickly through the PostgreSQL docs for subqueries. Thanks
> > for
> > > the heads up.
>
> > > As far as the Gis functionality goes, I could see a database like that
> > > needing some serious horse power if it became popular. Any thoughts on
> > how
> > > that would reconcile with the weakness in replication? I suppose most Gis
> > > systems are more for out put than input so the slow replication might not
> > > really matter that much.
>
> > > On Sat, Sep 5, 2009 at 1:17 AM, Siemster  > >wrote:
>
> > > > PostgreSQL does support subqueries in the from clause, however iirc,
> > > > the subquerys require an alias.
>
> > > > If you decide to do geo then the PostGis addon to Postgres is very
> > > > nice.
>
> > > > Another nice capability in PostgreSQL is that you can use different
> > > > languages for writing your stored procedures (should you wish to use
> > > > them). Some of the available languages (in addition to PL/pgSQL) are
> > > > Perl, Python, Tcl, PHP, Ruby, R, Scheme, and Java.
>
> > > > Whether you choose to use Postgres or not, I'd recommend at least
> > > > looking at it. There is even a live cd (which I have not tried) at
> > > >http://www.postgresql.org/download/whichlets you try PostgreSQL out
> > > > without having to install it.
>
> > > > On Sep 4, 7:38 pm, Joshua Russo  wrote:
> > > > > On Fri, Sep 4, 2009 at 11:07 PM, Tim Chase
> > > > > wrote:
>
> > > > > > > I personally don't have any experience with PostgreSQL and I'm
> > > > generally
> > > > > > > working in a mixed MS and Linux environment. I'm interested to
> > hear
> > > > > > peoples
> > > > > > > views on the pluses and minuses of the two different systems. I'm
> > a
> > > > bit
> > > > > > of a
> > > > > > > query geek too. How does that play in? I know in MySQL there are
> > > > > > limitations
> > > > > > > on where you can use subqueries. Is that true with PostgreSQL?
> > (Ya I
> > > > > > could
> > > > > > > just look that one up but it's just an example.)
>
> > > > > > I did a writeup of MySQL vs. PostgreSQL a while back:
>
> >http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html
>
> > > > > > Most of the issues still stand -- though I understand MySQL now
> > > > > > has native(ish) support for Geo information (check the GeoDjango
> > > > > > code to see if it supports the MySQL Geo implementation -- last I
> > > > > > checked the source it was Oracle & PostgreSQL only).
>
> > > > > > To answer your direct question, PostgreSQL has long-standing
> > > > > > support for all kin

Re: Image Location

2009-09-05 Thread A. Rossi

I am suffering a similar problem, but I think the problem is that my
URLConf is improperly configured to display the images.
Could somebody direct me to the proper documentation for displaying
static images with the dev server?


On Aug 23, 9:18 am, "J. Cliff Dyer"  wrote:
> On Sun, 2009-08-23 at 06:54 -0700, When ideas fail wrote:
> > Hello, i'm having a problem getting images todisplayso I was
> > wondering if someone would be kind enough to help?
>
> > I have my settings.py set up as follows (content is the folder where
> > my static images are stored):
>
> > MEDIA_ROOT = '/home/mysite/content/'
> > MEDIA_URL = 'http://www.mysites.net/content/'
>
> > Then my template is like so:
>
> > 
>
> > where object.post_img = imgs/newMessage.jpg
>
> > but if i load the page up it doesn't appear. I checked the error log
> > it says:
>
> > File does not exist: /home/mysite/public_html/content, referer:
> >http://www.mysite.net
>
> 1.  Check what's getting rendered in your HTML file for the src of that
> img.
>
> 2. Make sure you're using a RequestContext, otherwise you won't have
> MEDIA_URL available to your templates.
>
> 3. Figure out why public_html is showing up in the path reported by the
> error log.
>
> Some information that will help with debugging:
>
>  * Are you using apache, the dev server, or something else?
>  * If the dev server, where does your URLConf point to for
>    static images?
>  * What does the URLConf and view look like for the page that's
>    getting rendered?
>
> 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Parsing / Deserializing a JSON String

2009-09-05 Thread Eric

Thank you for your input.  I tried what you suggested by first just
trying to loop through the data like so:

"
test_output = 0
for obj in serializers.deserialize('json', gantt_data)['ganttgroups']:
test_output = test_output + 1
"

This generated the following error:

 "'generator' object is unsubscriptable"

I tried changing it slightly,  moving "['ganttgroups']" inside the
brackets, to this:

"
test_test_output = 0
for obj in serializers.deserialize('json', gantt_data['ganttgroups']):
test_output = test_output + 1
"

This generated the error I originally received:

"string indices must be integers"

I am just so new to this that I'm not sure where to go from here. Do
you have any other suggestions as to what I may be doing wrong?
Again, any help with this would be greatly appreciated.




On Sep 3, 1:09 pm, "J. Cliff Dyer"  wrote:
> I suspect your error is hiding in .  What do you expect
> obj to be?  Your JSON should return a big dictionary with one key
> ("ganttgroups").  When you iterate over a dictionary in python, you get
> the keys of that dictionary.  In this case, the string "ganttgroups".
> You may be doing the following:
>
> for obj in serializers.deserialize("json", gantt_data):
>     do_something_to(obj['gantts'])
>
> which returns an error, because it evaluates to "ganttgroups"['gantts']
> (which would give you the error you see.
>
> What you want is more like:
>
> for obj in serializers.deserialize('json', gantt_data)['ganttgroups']:
>     start = obj['start']
>     for gantt in obj['gantts']:
>         for row in gantt['rows']:
>             print row['own']
>
> In short, you're getting your dicts and lists mixed up, or your keys and
> values.
>
> Cheers,
> Cliff
>
> On Wed, 2009-09-02 at 10:40 -0700, Eric wrote:
> > I forgot to mention that I am trying to deserialize the data as
> > follows:
>
> > "
> > ...
> > gantt_data = request.POST.get('ganttdata')
>
> > for obj in serializers.deserialize("json", gantt_data):
> >     
> > ...
> > "
>
> > On Sep 2, 10:37 am, Eric  wrote:
> > > Hi,
> > > I am attempting to parse a json string passed to my view via a form
> > > post.   A simple example of my json structure is as follows (indented
> > > for readability):
>
> > > {
> > >     "ganttgroups":[
> > >         {
> > >             "gantts":[
> > >                 {
> > >                     "rows":[
> > >                         {"stt":1, "end":2, "ttl":"test row - gr1 ga1
> > > ta1",  "own":"Tim Johnson"},
> > >                         {"stt":2, "end":3, "ttl":"my row (g1 t2)",
> > > "own":"John Doe"},
> > >                         {"stt":1, "end":2, "ttl":"test row - gr1 ga1
> > > ta3", "own":"Mary Smith"}
> > >                     ]
> > >                 },
> > >                 {
> > >                     "rows":[
> > >                         {"stt":1, "end":2, "ttl":"My 4th task",
> > > "own":"Eric Johnson"},
> > >                         {"stt":1, "end":2, "ttl":"my row (g2 t2)",
> > > "own":"Jeff Smith"},
> > >                         {"stt":1, "end":2, "ttl":"test row - gr1 ga2
> > > t3", "own":"Bill Baker"}
> > >                     ]
> > >                 }
> > >             ],
> > >             "start":"2009-1-01"
> > >         }
> > >         ,{
> > >             "gantts":[
> > >                 {
> > >                     "rows":[
> > >                         {"stt":1, "end":2, "ttl":"row - gr2 ga1 t1",
> > > "own":"Ted Tillman"},
> > >                         {"stt":1, "end":2, "ttl":"row - gr2 ga1 t2",
> > > "own":"Kim Crane"},
> > >                         {"stt":1, "end":2, "ttl":"row - gr2 ga1 t3",
> > > "own":"Bob Barker"}
> > >                     ]
> > >                 }
> > >             ],
> > >             "start":"2009-1-01"
> > >         }
> > >     ]
>
> > > }
>
> > > I would like to parse it so that I can loop over the pairs/arrays to
> > > access the data. When I try to deserialize the data, I get the django
> > > error "string indices must be integers". Can anybody please help me
> > > determine what exactly this means and how I may fix this?  Is there
> > > another method I should be using? I am obviously a bit of a newbie at
> > > this so any help would be greatly appreciated.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pytz time conversion issue

2009-09-05 Thread zweb

I figured it out.

 I should be using pytz localize function and not passing tzinfo to
datetime.
WRONG: local_dt = datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,tzinfo=local_timezone)
RIGHT:local_dt = local_timezone.localize(datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second))

On Sep 5, 2:47 pm, zweb  wrote:
> Converting from local to utc:
>
> local Timzone: America/Los_Angeles
> local_dt 2009-09-17 00:00:00-08:00
> utc_dt 2009-09-17 08:00:00+00:00 ( after converting from local to utc)
>
> when I convert back from UTC to America/Los_Angeles, I get back
> local_dt 2009-09-24 01:00:00
>
> which is one hour from where I started. Any clues how to fix it?
>
> My code below:
>
> From Local to UTC:
>     local_timezone = timezone(local_tz)
>     local_dt = datetime
> (dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,
> tzinfo=local_timezone)
>     utc_dt = utc.normalize(local_dt.astimezone(pytz.utc))
>
> From UTC to Local:
>     utc_dt = datetime
> (dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second, tzinfo=pytz.utc)
>     local_tz1 = timezone(local_tz)
>     loc_dt = local_tz1.normalize(utc_dt.astimezone(timezone(local_tz)))
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DST or not

2009-09-05 Thread Brian Neal

On Sep 5, 4:03 pm, zweb  wrote:
> Is there any way to know if for a timezone , on a praticular date
> time, is DST active or not?
> it is required by localize command of pytz. How to find it
> programatically?
>
> >>> est_dt = eastern.localize(loc_dt, is_dst=True)
> >>> edt_dt = eastern.localize(loc_dt, is_dst=False)

I think normally you let pytz figure that out for you. That is_dst
parameter is not required by the localize function. I think it is only
used if you are doing tricky things.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pytz time conversion issue

2009-09-05 Thread zweb

Converting from local to utc:

local Timzone: America/Los_Angeles
local_dt 2009-09-17 00:00:00-08:00
utc_dt 2009-09-17 08:00:00+00:00 ( after converting from local to utc)

when I convert back from UTC to America/Los_Angeles, I get back
local_dt 2009-09-24 01:00:00

which is one hour from where I started. Any clues how to fix it?

My code below:

>From Local to UTC:
local_timezone = timezone(local_tz)
local_dt = datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second,
tzinfo=local_timezone)
utc_dt = utc.normalize(local_dt.astimezone(pytz.utc))

>From UTC to Local:
utc_dt = datetime
(dt.year,dt.month,dt.day,dt.hour,dt.minute,dt.second, tzinfo=pytz.utc)
local_tz1 = timezone(local_tz)
loc_dt = local_tz1.normalize(utc_dt.astimezone(timezone(local_tz)))
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



DST or not

2009-09-05 Thread zweb

Is there any way to know if for a timezone , on a praticular date
time, is DST active or not?
it is required by localize command of pytz. How to find it
programatically?

>>> est_dt = eastern.localize(loc_dt, is_dst=True)
>>> edt_dt = eastern.localize(loc_dt, is_dst=False)
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django pagination

2009-09-05 Thread Michael Ralan

Hi,

Apologies if this question has been asked before but I was not able to
find a satisfactory answer.

In the django admin app there is a capability to have a pagination
object that lists the number of pages that can be paged.

I have found code that uses the django Paginator object which builds a
navbar that looks like this

  previous

The documentation for the Paginator tag (seems to be non-native) on
the django site shows what I want. But is an example that uses a
custom template. This is also clearly a custom tag.

How do I use the django admin navbar in my app? I want it to display
something like

[1] [2] [3] [...] [30]

and do it natively.

Thanks, and regards


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pytz time conversion issue

2009-09-05 Thread zweb

When I convert from Pacific time to UTC
to db local Timzone: America/Los_Angeles
 to db local_dt 2009-09-07 00:00:00-08:00
 to db utc_dt 2009-09-07 08:00:00+00:00

when convert from UTC to Pacific time
utc_dt 2009-09-07 08:00:00+00:00
local_tz America/Los_Angeles
local_dt 2009-09-07 01:00:00 America/Los_Angeles


I see that I started with
local time 2009-09-07 00:00:00 to
 utc = 2009-09-07 08:00:00+00:00 and back to
local time = 2009-09-07 01:00:00

what did I miss?
Is it a DST issue?


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



iceweasel 3.0.6 create unser cache problem

2009-09-05 Thread Manuel Ignacio

Hi, when i store my password on icewasel 3.0.6 private data, and  i
want to create a new user, the new user form is preloaded with the
current user's username and password
regards
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



TIME_ZONE = 'UTC' how does it work?

2009-09-05 Thread zweb

I am on mac os x and linux. I use mysql

How does the TIME_ZONE='UTC" in django settings.py work?

If i enter date time from web page and store it in mysql db. And no
timezone is associated with the datetime, does django assumes datetime
is in UTC and saves it without changing or does it assume it is in
local timezone of the server django is running on and converts it in
to utc?

Can anyone explain how does django use TIME_ZONE in settings.py. I
have read the documentation.

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django remove value from field with attrs disabled="disabled"

2009-09-05 Thread eli

Hi,

I have problem with Django Forms and field with set attrs to
disabled="disabled"

# forms.py

class EditForm(forms.ModelForm):

def __init__(self, *args, **kwargs):
super(EditForm, self).__init__(*args, **kwargs)
self.fields['title'].widget.attrs.update({'readonly':
'readonly', 'disabled': 'disabled'})

class Meta:
model = MyModel
fields = ('title', 'tagline')

# views.py

form = EditForm(request.POST, instance=my_instance)
if form.is_valid():
form.save()

# models.py

class MyModel(models.Model):
title = models.CharField(max_length=120, db_index=True)
tagline = models.TextField(, max_length=500, db_index=True)

And now, Django remove values form field with attrs 'disabled':
'disabled' ("readonly" without "disabled" works fine, but I need
disabled option in my html output). Why Django do that?

Thanks for help.

regards.

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



when browser store user password, create user fail s

2009-09-05 Thread Manuel Ignacio

hi, when i loggin for first time in django admin interface, the
browser ask me if i want to store the password, if i say yes, later
when i want create a new user, the form is preloaded whit the logged
user info

any ideas?
regards
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: webcam in a web page

2009-09-05 Thread bittin
Webcam XP or Stickam

On Fri, Aug 21, 2009 at 2:02 AM, Lic. José M. Rodriguez Bacallao <
jmr...@gmail.com> wrote:

>
> hi folks, I need to show a live web cam in my site, does anyone know
> how to do that?
>
> --
> Lic. José M. Rodriguez Bacallao
> Centro de Biofisica Medica
> -
> Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
> mismo.
>
> Recuerda: El arca de Noe fue construida por aficionados, el titanic
> por profesionales
> -
>
> >
>

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ReST and path issues

2009-09-05 Thread TiNo
On Thu, Sep 3, 2009 at 00:38, TiNo  wrote:

> Hi,
> I am trying to set up a sort of smal CMS where the input is
> RestructuredText. The restructured text is parsed by a templatetag with the
> following code (taken from the PyCon rst project):
>
> @register.filter
> def restructuredparts(value, **overrides):
> """return the restructured text parts"""
> try:
> from docutils.core import publish_parts
> except ImportError:
> if settings.DEBUG:
> raise template.TemplateSyntaxError, "Error in {%
> restructuredtext %} filter: The Python docutils library isn't installed."
> return value
> else:
> docutils_settings = dict(getattr(settings,
> "RESTRUCTUREDTEXT_FILTER_SETTINGS", {}))
> docutils_settings.update(overrides)
> if 'halt_level' not in docutils_settings:
> docutils_settings['halt_level'] = 6
> return publish_parts(source=value, writer_name="html4css1",
> settings_overrides=docutils_settings)
>
>
> On my local machine everything works fine, but on my deployment server it
> gives this error:
>
> [Errno 2] No such file or directory:
> '/lib/python2.5/docutils-0.5-py2.5.egg/docutils/writers/html4css1/html4css1.css'
>
> This only happens when django is running. In django shell or python shell
> everything works fine. The correct css file is located at
> /home/tinodb/lib/python2.5/docutils-0.5-py2.5.egg/docutils
> /writers/html4css1/html4css1.css
>
> There is a default docutils installed on the server (webfaction), but by
> checking in the shell the correct docutils is imported. Shell and fastfcgi
> deamons are run under the same user.
>
> Does anybody knows why my fastcgi deamon want to import a stylesheet from
> this location?
>

Nobody any idea?

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django unicode user name

2009-09-05 Thread joymax

You have to create custom authentication backend (more about it here
http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend).


On Sep 5, 12:42 pm, Казбек  wrote:
> Good day. How can i make django to register and use unicode usernames?
> When i try to register one (russian symbols username) i get an error
> says that the username must not contain such symbols. I try to
> register username in admin panel. 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: PostgreSQL or MySQL, What are the +'s and -'s?

2009-09-05 Thread Joshua Russo
Great site! thanks

With my SQL experience, your comment about database coding seems to ring
true. The database is a much different environment, with
different paradigms, than a standard application environment. When you
really need database coding you know it (kind of like meta programming).

So far from my experience has been, the times I found we needed database
programming were pretty simply speed related, so difficult to distinguish
from application logic. What types of situations do others find useful for
stored procedures and triggers?


On Sat, Sep 5, 2009 at 9:57 AM, Zberteoc  wrote:

>
> This is a common mistake almost all non SQL developers make thinking
> in procedural/programming language terms in regards wit SQL and
> database coding. If you're asking me there is nothing cool in the
> feature of creating stored procedures in other than the SQL language.
> MS-SQL introduced that with 2005 version, CLR integration, but I is
> hardly used for one very simple reason it is NOT really necessary. SQL
> code needs to be understood first and only then look elsewhere.
> Anyways, in terms of comparison PgSQL vs MySQL here is a very detailed
> wiki:
>
> http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL
>
> I have never used PgSQL but i wouldn't hesitate to use it if I needed
> it. All DBMS these days are robust and mature enough to be able to
> rely on them. It comes in the end to what you prefer, how comfortable
> you feel and ease of use, rather than how many terrabytes they can
> deal with as the features lists are more and more the same for all of
> them. Support and online community is also very important, probably
> the most if you're novice in both, and here MySQL prevails as it is
> far more popular.
>
> Cheers.
>
> On Sep 4, 10:46 pm, Joshua Russo  wrote:
> > Wow, that's a cool trick to be able to implement stored procedures in
> > different languages. I might actually use them more if I could do
> everything
> > in the same language as the application.
> > I only looked quickly through the PostgreSQL docs for subqueries. Thanks
> for
> > the heads up.
> >
> > As far as the Gis functionality goes, I could see a database like that
> > needing some serious horse power if it became popular. Any thoughts on
> how
> > that would reconcile with the weakness in replication? I suppose most Gis
> > systems are more for out put than input so the slow replication might not
> > really matter that much.
> >
> > On Sat, Sep 5, 2009 at 1:17 AM, Siemster  >wrote:
> >
> >
> >
> >
> >
> > > PostgreSQL does support subqueries in the from clause, however iirc,
> > > the subquerys require an alias.
> >
> > > If you decide to do geo then the PostGis addon to Postgres is very
> > > nice.
> >
> > > Another nice capability in PostgreSQL is that you can use different
> > > languages for writing your stored procedures (should you wish to use
> > > them). Some of the available languages (in addition to PL/pgSQL) are
> > > Perl, Python, Tcl, PHP, Ruby, R, Scheme, and Java.
> >
> > > Whether you choose to use Postgres or not, I'd recommend at least
> > > looking at it. There is even a live cd (which I have not tried) at
> > >http://www.postgresql.org/download/which lets you try PostgreSQL out
> > > without having to install it.
> >
> > > On Sep 4, 7:38 pm, Joshua Russo  wrote:
> > > > On Fri, Sep 4, 2009 at 11:07 PM, Tim Chase
> > > > wrote:
> >
> > > > > > I personally don't have any experience with PostgreSQL and I'm
> > > generally
> > > > > > working in a mixed MS and Linux environment. I'm interested to
> hear
> > > > > peoples
> > > > > > views on the pluses and minuses of the two different systems. I'm
> a
> > > bit
> > > > > of a
> > > > > > query geek too. How does that play in? I know in MySQL there are
> > > > > limitations
> > > > > > on where you can use subqueries. Is that true with PostgreSQL?
> (Ya I
> > > > > could
> > > > > > just look that one up but it's just an example.)
> >
> > > > > I did a writeup of MySQL vs. PostgreSQL a while back:
> >
> > > > >
> http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html
> >
> > > > > Most of the issues still stand -- though I understand MySQL now
> > > > > has native(ish) support for Geo information (check the GeoDjango
> > > > > code to see if it supports the MySQL Geo implementation -- last I
> > > > > checked the source it was Oracle & PostgreSQL only).
> >
> > > > > To answer your direct question, PostgreSQL has long-standing
> > > > > support for all kinds of crazy sub-queries.  MySQL has added most
> > > > > of those abilities over time.  This used to be a deal-breaker for
> > > > > me, making Postgres the clear winner.  Now they're about even.
> >
> > > > > Lastly, my closing arguments in that link still stand -- if you
> > > > > don't have a pressing need to choose one or the other, code &
> > > > > test for both.
> >
> > > > Good point on geo side side of things.
> >
> > > > One place I have found subqueries very useful is in the From.
> > > Fu

Re: PostgreSQL or MySQL, What are the +'s and -'s?

2009-09-05 Thread Zberteoc

This is a common mistake almost all non SQL developers make thinking
in procedural/programming language terms in regards wit SQL and
database coding. If you're asking me there is nothing cool in the
feature of creating stored procedures in other than the SQL language.
MS-SQL introduced that with 2005 version, CLR integration, but I is
hardly used for one very simple reason it is NOT really necessary. SQL
code needs to be understood first and only then look elsewhere.
Anyways, in terms of comparison PgSQL vs MySQL here is a very detailed
wiki:

http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL

I have never used PgSQL but i wouldn't hesitate to use it if I needed
it. All DBMS these days are robust and mature enough to be able to
rely on them. It comes in the end to what you prefer, how comfortable
you feel and ease of use, rather than how many terrabytes they can
deal with as the features lists are more and more the same for all of
them. Support and online community is also very important, probably
the most if you're novice in both, and here MySQL prevails as it is
far more popular.

Cheers.

On Sep 4, 10:46 pm, Joshua Russo  wrote:
> Wow, that's a cool trick to be able to implement stored procedures in
> different languages. I might actually use them more if I could do everything
> in the same language as the application.
> I only looked quickly through the PostgreSQL docs for subqueries. Thanks for
> the heads up.
>
> As far as the Gis functionality goes, I could see a database like that
> needing some serious horse power if it became popular. Any thoughts on how
> that would reconcile with the weakness in replication? I suppose most Gis
> systems are more for out put than input so the slow replication might not
> really matter that much.
>
> On Sat, Sep 5, 2009 at 1:17 AM, Siemster wrote:
>
>
>
>
>
> > PostgreSQL does support subqueries in the from clause, however iirc,
> > the subquerys require an alias.
>
> > If you decide to do geo then the PostGis addon to Postgres is very
> > nice.
>
> > Another nice capability in PostgreSQL is that you can use different
> > languages for writing your stored procedures (should you wish to use
> > them). Some of the available languages (in addition to PL/pgSQL) are
> > Perl, Python, Tcl, PHP, Ruby, R, Scheme, and Java.
>
> > Whether you choose to use Postgres or not, I'd recommend at least
> > looking at it. There is even a live cd (which I have not tried) at
> >http://www.postgresql.org/download/which lets you try PostgreSQL out
> > without having to install it.
>
> > On Sep 4, 7:38 pm, Joshua Russo  wrote:
> > > On Fri, Sep 4, 2009 at 11:07 PM, Tim Chase
> > > wrote:
>
> > > > > I personally don't have any experience with PostgreSQL and I'm
> > generally
> > > > > working in a mixed MS and Linux environment. I'm interested to hear
> > > > peoples
> > > > > views on the pluses and minuses of the two different systems. I'm a
> > bit
> > > > of a
> > > > > query geek too. How does that play in? I know in MySQL there are
> > > > limitations
> > > > > on where you can use subqueries. Is that true with PostgreSQL? (Ya I
> > > > could
> > > > > just look that one up but it's just an example.)
>
> > > > I did a writeup of MySQL vs. PostgreSQL a while back:
>
> > > >http://www.mail-archive.com/django-users@googlegroups.com/msg70188.html
>
> > > > Most of the issues still stand -- though I understand MySQL now
> > > > has native(ish) support for Geo information (check the GeoDjango
> > > > code to see if it supports the MySQL Geo implementation -- last I
> > > > checked the source it was Oracle & PostgreSQL only).
>
> > > > To answer your direct question, PostgreSQL has long-standing
> > > > support for all kinds of crazy sub-queries.  MySQL has added most
> > > > of those abilities over time.  This used to be a deal-breaker for
> > > > me, making Postgres the clear winner.  Now they're about even.
>
> > > > Lastly, my closing arguments in that link still stand -- if you
> > > > don't have a pressing need to choose one or the other, code &
> > > > test for both.
>
> > > Good point on geo side side of things.
>
> > > One place I have found subqueries very useful is in the From.
> > Functionally
> > > identical to a view but you don't need to clutter the database with
> > rarely
> > > used views. That and you can use variables. If you really wanted to get
> > > fancy you can even nest them. It can save a lot on application logic and
> > > produce some interesting reports. I don't believe either of our friends
> > here
> > > support them though. That is one feature I would love to see.
>
> > > I tend to agree with your closing arguments. I try to stay away from any
> > > DBMS unique functionality. I very rarely even find much of a need for
> > > triggers and/or stored procedures. (But they can come in exceptionally
> > handy
> > > when turning 10s of 1000s of rows of un-normalized data, into close to a
> > > million rows of normalized. Done in a matter of minutes!)
--~--~

Re: Same application with different URLs

2009-09-05 Thread Graham Dumpleton



On Sep 5, 6:54 am, Petr Tuma  wrote:
> One more note, just if somebody else runs into this.
>
> Apparently, the problem with this solution is that under certain
> conditions, SetEnv from one virtual host can be visible inside the
> Python interpreter associated with another virtual host. Since
> mod_python suggests not to use SetEnv, one should probably not be
> surprised all that much.
>
> A working solution is to branch on something else than the environment
> variable in urls.py. Using apache.interpreter imported from mod_python
> seems to work just fine.

It should be pointed at that the leakage of environment variables
between sub interpreters is not actually mod_python's fault. It is a
combination of an issue with Python itself triggered by what the
mod_python handler for Django does. In other words, not the fault of
mod_python itself.

The underlying issue is that when os.environ is set, this triggers a
call of putenv() in C library to promote the variable to a process
wide variable. A Python sub interpreter created after that point, will
have that environment variable copied into its os.environ.

Normally, for SetEnv directive this wouldn't make the least bit of
difference because SetEnv directive normally doesn't promote the set
values to process wide environment variables in the Apache server
child processes themselves. Normally they would only be set up in sub
processes created specifically for CGI scripts.

The table of such SetEnv variables is though still available to
mod_python, but in a distinct data structure. Django unwisely copies
those variables in its mod_python handler and promotes them to process
wide environment variables. This was done so that SetEnv could be used
to set DJANGO_SETTINGS_MODULE.

Django should really only have promoted that single variable and
better still should never have relied on process environment variables
to begin with. Unfortunately, not something that can easily be changed
now.

Anyway, you will not have an issue if instead of using differently
named environment variables for each site, you use the same
environment variable name and just set them different. That is, use
the value of the single environment variable to distinguish rather
than the name of the variable.

Better still, stop using mod_python. Instead, use mod_wsgi and its
daemon mode to separate the two instances in completely different
processes and therefore never risk environment variable leakage or any
of the other issues arising from running multiple Python web
applications in different sub interpreters of the same process.

Graham
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: xgettext under osx

2009-09-05 Thread Hinnack
gettext should come with apples developer tools - otherwise install them
using fink or port
-- Hinnack

2009/9/2 Ramiro Morales 

>
> On Wed, Sep 2, 2009 at 12:32 PM, arbi wrote:
> >
> > As for the PATH I thought it was for compilation and not for make
> > message.
> > Should I write this for make message ?
> >
> > PATH=$PATH:/Applications/Poedit.app/Contents/MacOS/
> > python /Library/python/2.5/site-packages/django/bin/make-messages.py
> > ?
> > And then I do django-admin.py makemessages -l fr ?
> > thx (I am a newb)
>
> The blog post talks about the django/bin/make-messages.py
> script has been replaced by the django-admin.py makemessages -l fr
>
> And yes, you need to have the GNU gettext command line tools
> (xgettext, msgmerge, msgfmt) available when running the different
> i18n-related django-admin.py commands (makemessages,
> compilemessages)
>
> --
> Ramiro Morales
> http://rmorales.net
>
> >
>

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django, Blueprintcss and a data array

2009-09-05 Thread Antoni Aloy

2009/9/5 adelaide_mike :
>
> I (newbie) am looking at using Blueprintcss to display a 7 column
> array of data. The data is passed to the template in "dataarray".  I
> have tested the code below without the  section and the column
> headings display correctly.
>
> Adding the  section to the code causes an error at {% for row
> in dataarray %}:
>   Caught an exception while rendering: 'int' object is not iterable
>
> Very similar code in a template that uses a simple table (without
> Blueprint) does not throw an error.
>
> {% extends "base.html" %}
> {% block content %}
>
> 
> 
>            Agent summary report
>        The most recent listing for each property listed within the
> past 12 weeks
>       
>               Address
>               Date
>               Price
>               Method
>               Agent
>                 
>               Mobile
>       
>
>       
>           {% for row in dataarray %}
>
>                
>                    {% for item in row %}
>                        {{ item }}
>                    {% endfor %}
>                 
>
>           {% endfor %}
>        
> 
>
> 
>
> {% endblock %}
>
I would add  surronding the table code, but I can't see
any problem. Please post the error. In my oppinion you'll have to
check the dataarray as it seems that one of the rows in now a list.


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---