Re: Countdown to 1.0 alpha

2008-07-17 Thread Jacob Kaplan-Moss

On Thu, Jul 17, 2008 at 9:20 AM, Dan <[EMAIL PROTECTED]> wrote:
> I was wondering when the 1.0alpha was due so I went to Trac and found this
> page:
>
> http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&milestone=1.0+alpha
>
> There is only 10 tickets left before alpha is complete. I don't know for
> you, but I'm going to check this page every morning from now :)

You can see the schedule for the 1.0 release at
http://code.djangoproject.com/wiki/VersionOneRoadmap#schedule --
you'll see that 1.0 alpha is due early next week.

The tickets don't tell the *entire* story, but yes, we're very close!

Jacob

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



Re: ANNOUNCE: Django 1.0 released

2008-09-05 Thread Jacob Kaplan-Moss

On Fri, Sep 5, 2008 at 3:10 AM, Matic Žgur <[EMAIL PROTECTED]> wrote:
> I would have one question though. What will the releases look from now
> on? I mean, will 1.x contain only security/bug fixes or new features
> as well? And how long will it stay supported? I know that these
> questions may not yet have the answers but I was just wondering what
> the situation will be from now on.

This is covered in our contributors guide:
http://docs.djangoproject.com/en/dev/internals/contributing/#official-releases

Jacob

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



[ANN] Call for proposals: PyCon 2009

2008-10-09 Thread Jacob Kaplan-Moss

Howdy folks --

It's that time of year again: PyCon 2009 is accepting proposals for
talks and tutorials. PyCon 2009 will be held in Chicago, Illinois from
March 27 - 29; there will be two tutorial days before and four
development sprint days after.

PyCon has special meaning to Django: we first demoed Django at PyCon
in 2005, and the positive response of the Python community was our
first real impetus towards releasing Django as open source. PyCon has
always felt like a sort of birthday for Django, then, so please join
me in helping make sure Django is well represented at PyCon again this
year.

Talk proposals are open through November 3rd; tutorial proposals close
October 31st.

To find out more, read the detailed call for talk proposals:



or the detailed call for tutorials:



Thanks!

Jacob

PS: I'm on the program committee, but to avoid any conflict of
interest I won't be personally reviewing any Django-related proposals.
However, I'm happy to assist with proposals if you'd like an
experienced set of eyes to look yours over before you turn it in; feel
free to drop send me a draft.

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



Re: Customizing Admin for Large Data Sets

2009-02-17 Thread Jacob Kaplan-Moss

On Tue, Feb 17, 2009 at 12:15 PM, mermer  wrote:
> Does anybody have any advise on how best to customize the Admin to
> cope with large data sets.
>
> We need to deal with 500K plus records - and the loading times are
> just too slow.

You might want to clarify a bit more what you're doing -- what's your
ModelAdmin look like, what database engine, etc -- because the admin
works just fine with data sets that big (and larger). To pick just one
example, I've seen the admin resting on top of a database of around 20
million rows. It was plenty snappy (though searching took a while :)

If you give more details someone might be able to point you in the
right direction.

Jacob

--~--~-~--~~~---~--~~
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: linking to files from database

2009-02-17 Thread Jacob Kaplan-Moss

On Tue, Feb 17, 2009 at 1:15 PM, Tonu Mikk  wrote:
> Looking at the database, I see a photo and thumbnail columns, but there
> is no data.  Do I need to write code to store a link to images in the
> photo and thumbnail columns?

Yes, that's it. Read the section of the file reference titled
"Additional methods on files attached to objects"
(http://docs.djangoproject.com/en/dev/ref/files/file/#additional-methods-on-files-attached-to-objects).

You'll want code that looks something like
`my_bookmark.photo.save('file_name'.jpg, file_contents)`.

Jacob

--~--~-~--~~~---~--~~
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: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Jacob Kaplan-Moss

On Wed, Feb 18, 2009 at 11:12 AM, Deniz Dogan  wrote:
> Let's say I have a model called Bike with a DateField called
> "production_date". Now I want to get all of the Bikes and group them
> by their production date. How would I do this in Django? I can't seem
> to figure it out.

For this type of query, you need to ask yourself two things:

The first question is easy: What kind of aggregate do I want? You want
a count, so you'd use the ``Count()`` aggregate (i.e.
``django.db.models.Count``). That's simple; I'll bet you already
figured that part out.

The second part is more tricky: what is the set of fields I'm grouping
over? By default, it's all the fields on the model, so a simple
``aggregate(Count(production_date))`` basically is the same as a
``COUNT(*)``, which you don't want::

>>> Bike.objects.aggregate(Count('production_date'))
{'production_date__count': 7}

So you need to change the list of fields you're grouping over. You do
this by using ``values()``; the important part of the docs to read is
http://docs.djangoproject.com/en/dev/topics/db/aggregation/#values;
make sure to pay attention to the part about the order of
``annotate()`` and ``values()``.

If you read that carefully, you'll see that to change the set of
grouped fields you'll want to call ``values()`` before calling
``annotate()``::

>>> qs = Bike.objects.values('production_date') \
...  .annotate(count=Count('production_date')) \
>>> for r in qs:
...print "%(production_date)s: %(count)s bikes" % r
2008-01-01 2 bikes
2008-01-02 1 bikes
2008-01-03 1 bikes
2008-01-04 2 bikes
2008-01-05 1 bikes

Hope that helps!

Jacob

--~--~-~--~~~---~--~~
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: Simply adding GROUP BY to a QuerySet

2009-02-18 Thread Jacob Kaplan-Moss

On Wed, Feb 18, 2009 at 12:24 PM, Deniz Dogan  wrote:
> I'm sorry about that, I meant something like this:
>
> { 2008-01-02 : [Bike 1, Bike 2],
>  2008-02-09 : [Bike 7, Bike 4] }

Well, you can't do this with the aggregation API because you can't do
that is SQL. Remember: there's no such thing as a "list" in a
relational database.

However, this is pretty easy to do just in Python using
``itertools.groupby`` (see
http://docs.python.org/library/itertools.html#itertools.groupby)::

>>> bikes = Bike.objects.all()
>>> for d, bl in itertools.groupby(bikes, lambda b: b.production_date):
...print d, list(bl)

2008-01-01 [, ]
2008-01-02 []
2008-01-03 []
2008-01-04 [, ]
2008-01-05 []

The ORM's not a crutch; it doesn't bother with tasks you can easily do
using the tools Python gives you. Mm, and in case you're keeping
track, this is quite easy on the database; just a single query.

Hope that's closer to what you had in mind,

Jacob

--~--~-~--~~~---~--~~
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 "tracking" app

2009-02-18 Thread Jacob Kaplan-Moss

On Wed, Feb 18, 2009 at 6:10 PM, DougC  wrote:
> Any thoughts from experienced Django developers?

Two things you might want to look into:

The first is model inheritance
(http://docs.djangoproject.com/en/dev/topics/db/models/#id4). You
could, for example, have an abstract ``TrackedObject`` model and a set
of concrete subclasses for each type of thing to be tracked.

Or, you might want to look at ``django.contrib.contenttypes``
(http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/),
paying careful attention to generic relations
(http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1).
This would let you have a generic ``TrackedObject`` object with a
(sort of) foreign key to *any* other object of any type.

Jacob

--~--~-~--~~~---~--~~
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: how to save a file from a remote server?

2009-02-20 Thread Jacob Kaplan-Moss

On Fri, Feb 20, 2009 at 9:25 AM, ondrey  wrote:
> In my view I need to save locally a file (image) from a different
> server so I can further process it. But I can't figure out how to do
> it. Can someone help me with that?

http://docs.python.org/library/urllib.html#urllib.urlretrieve

Jacob

--~--~-~--~~~---~--~~
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: Query over related models

2009-02-20 Thread Jacob Kaplan-Moss

On Fri, Feb 20, 2009 at 9:43 AM, Peter Müller
 wrote:
> I want to select all Posts where text contains "Some Text" or
> Attachment.name (which is related to one post) contains "Some Text".
> Is there a way to do this with Django's ORM?

This is covered in the "Making queries" documentation
(http://docs.djangoproject.com/en/dev/topics/db/queries/).
Specifically, you'll want to look at the sections about related
objects 
(http://docs.djangoproject.com/en/dev/topics/db/queries/#related-objects)
and complex lookups
(http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects).

Read through that, and hopefully you'll understand the answer, which
looks something like::

Post.objects.filter(Q(text__contains='some text') |
Q(attachment__name__contains='some text'))

Jacob

--~--~-~--~~~---~--~~
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: Using a community Django Development system

2009-02-20 Thread Jacob Kaplan-Moss

On Fri, Feb 20, 2009 at 12:09 PM, DoJoe  wrote:
> Can anyone share their experiences and setup details for using a
> Django development server?

I just ran across
http://lethain.com/entry/2009/feb/13/the-django-and-ubuntu-intrepid-almanac/
the other day; maybe it'll help you out a bit.

Jacob

--~--~-~--~~~---~--~~
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: Is safe unsafe?

2009-02-23 Thread Jacob Kaplan-Moss

On Mon, Feb 23, 2009 at 3:50 PM, Andy Mckay  wrote:
> You want to use a script to only allow certain HTML tags and enforce a
> whitelist. Don't be naive and just use string or regular expression to
> strip only a few, there's lots of hacks that can be done. I use the
> SGMLParser in Plone, here's an old one: 
> http://code.activestate.com/recipes/52281/
>  some googling will probably find you more.

Please don't use this. It's very insecure.

Use html5lib (http://code.google.com/p/html5lib/wiki/UserDocumentation)
and the sanitizing tokenizer instead.

If you want to understand *why* something based on sgmllib isn't
secure, and generally why stripping HTML is so amazingly hard, please
read http://wiki.whatwg.org/wiki/Sanitization_rules (which appears to
be down atm, but Google's got a cache.)

Generally, stripping HTML of anything dangerous is *very*, *very*
difficult to get right. In fact, it's so hard you shou;d try to avoid
it if at all possible -- markup languages like markdown, texttile, and
restructured text are a good choice as a replacement.

However, if you insist on allowing untrusted users to submit HTML,
html5lib is the only game in town.

Jacob

PS: As a general introduction to web security in Django, I'd suggest
reading http://djangobook.com/en/1.0/chapter19/.

--~--~-~--~~~---~--~~
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: Is safe unsafe?

2009-02-23 Thread Jacob Kaplan-Moss

On Mon, Feb 23, 2009 at 4:04 PM, Michael Repucci  wrote:
> While we're on the general topic of security, I've got another
> question. In my application, users are also allowed to upload a file,
> which will be served (to allow other users or visitors to download
> it). I've used a clean_() method on the form to scan the
> file name for disallowed extensions (using the regexp r"(?i)(?P
> (?:cgi|htaccess|php[0-9s]?|[ps]html?|pl|pyc?|rb)(?:\..+)?)$"), and add
> ".txt" if such an extension is found. Is this sufficient, or should I
> come up with a whitelist for uploads too? Obviously the latter would
> be safer, but there's worth in having the added flexibility, provided
> I haven't left a huge hole open.

Anything based on checking extensions -- whitelist or blacklist -- can
be insecure. If you want to allow untrusted users to upload files, you
*must* verify the file's content and type, and you must make sure your
server correctly serves uploaded files using their "advertised"
content type.

Internet Explorer -- of course -- doesn't trust the file information
given by the server, and instead "sniff" the first few bytes of the
file and try to guess its type. This means that a malicious attacker
could upload a carefully-formed "image" that actually contains
JavaScript; IE will actually execute that JS when the image is loaded!
See 
http://www.h-online.com/security/Risky-MIME-sniffing-in-Internet-Explorer--/features/112589
for details.

The best, most secure approach, is to actually parse the uploaded
content and verify that it's what it claims to be. So for images this
might mean opening the image with PIL and making sure that it parses
correctly.

Jacob

--~--~-~--~~~---~--~~
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: Is safe unsafe?

2009-02-23 Thread Jacob Kaplan-Moss

On Mon, Feb 23, 2009 at 7:49 PM, Brian Neal  wrote:
> Interesting, I've also come across this:
>
> http://codespeak.net/lxml/lxmlhtml.html#cleaning-up-html
>
> I've heard it is very fast as it is just a python binding to a C-
> library...?

Short version: don't use lxml.html.clean, either.

Long version: yes, lxml is built on top of libxml2 so it is indeed
*very* fast. Probably as much as an order of magnitude faster than
html5lib.

However, if you look at the source of lxml.html.clean
(http://codespeak.net/lxml/api/lxml.html.clean-pysrc.html) you'll see
its implemented in terms of a blacklist. This is almost always a bad
idea: you only have to miss *one thing* on your blacklist to make your
site as insecure as if you'd not bothered escaping HTML at all. IOW,
with a blacklist you'd be on constant defense. Remember how early spam
protection systems just blocked spammers email addresses? How'd that
work out, anyway?

Also... the FIXMEs in that code doesn't exactly inspire confidence.

No nock against lxml here -- it's an incredible toolkit, and I use it
all of the place for general XML and HTML parsing. But security is
*hard* stuff; it's worth being paranoid about your tools.

Jacob

--~--~-~--~~~---~--~~
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: Anybody had any problems increasing the length of a varchar field in PostgreSQL?

2009-02-25 Thread Jacob Kaplan-Moss

On Wed, Feb 25, 2009 at 5:16 PM, bobhaugen  wrote:
> This is probably something that lots of people do all the time, but
> this will be my first such change on a production Django + PostgreSQL
> installation, so I thought I'd ask.

For the record, it works fine.

However, you really shouldn't be making this sort of change on a
production database without testing it on a development/staging
environment first. That's why people make those sorts of
pre-production systems, in fact; if you've not got one you'll be stuck
trusting strangers on mailing lists :)

Jacob

--~--~-~--~~~---~--~~
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: checking if db is empty

2009-02-25 Thread Jacob Kaplan-Moss

On Wed, Feb 25, 2009 at 5:23 PM, Russell Keith-Magee
 wrote:
> There isn't a simple 'is_my_database_empty' command that returns
> true/false.

Actually, "SELECT COUNT(*) FROM pg_tables WHERE schemaname = 'public'"
does pretty well. But Russ is right that this isn't the type of
question Django's going to help you answer; I'm just being pedantic
here :)

Jacob

--~--~-~--~~~---~--~~
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: lighty vs. nginx for deploying Django

2009-02-26 Thread Jacob Kaplan-Moss

On Thu, Feb 26, 2009 at 2:46 AM, Gour  wrote:
> Although I'm still fiddling on my 'localhost', I'd like to know which
> web server you recommend to settle on between lighty and nginx (Apache
> excluded) so I can be clear in the future when choosing hosting/VPS for
> Django sites and can learn about it on my localhost?

The best thing you can do is try both and pick the one that works
better for you. Me, I generally try to pick the software that's got
better documentation so that I spend less time fussing with it, but
other folks might want to choose the faster tool, or the one with more
features, or ...

Set them both up, run some tests/benchmarks, and pick what you think works best.

> The 'django' book and official docs gives example of lighty, but I'm not
> sure it is due whether it is due to it advantage over nginx or something
> else...

That's really just because when I wrote the docs and that part of the
book I didn't know nginx existed -- no other reason.

Jacob

--~--~-~--~~~---~--~~
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: Module not found

2009-03-05 Thread Jacob Kaplan-Moss

On Thu, Mar 5, 2009 at 2:44 PM, neri...@gmail.com  wrote:
>    (r'^$', include('dzopastudio.views.current_datetime')),

There's the bug. ``include()`` does what the name suggests: it
includes another urlconf. Drop the include and it should work.

Jacob

--~--~-~--~~~---~--~~
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: template include and for loop speed

2009-03-06 Thread Jacob Kaplan-Moss

On Fri, Mar 6, 2009 at 4:25 AM, Thierry  wrote:
> Why is an include tag so much heavier on the template system?

Because it has to search for the given template on the file system.
Depending on how you've got TEMPLATE_LOADERS and TEMPLATE_DIRS set,
this could search in dozens of places.

Jacob

--~--~-~--~~~---~--~~
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 and Python Warnings

2009-03-06 Thread Jacob Kaplan-Moss

On Fri, Mar 6, 2009 at 9:46 AM, Brian Neal  wrote:
> I updated my working copy of Django after a long period and was
> browsing the source and noticed it was taking advantage of the Python
> warnings module. What is the best way to "see" such warnings when
> doing development? Is it possible to configure Python or the Django
> development server to display such warning messages?

You want the ``-W`` flag to the python binary; see ``python --help``
for more. Essentially, you'll do::

python -Wall manage.py runserver

Jacob

--~--~-~--~~~---~--~~
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: Why are views not called controllers?

2009-03-06 Thread Jacob Kaplan-Moss

Also see: 
http://www.pointy-stick.com/blog/2008/11/30/removing-model-view-controller-straitjacket/

Jacob

--~--~-~--~~~---~--~~
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 and Python Warnings

2009-03-06 Thread Jacob Kaplan-Moss

On Fri, Mar 6, 2009 at 5:56 PM, Graham Dumpleton
 wrote:
> Anyway, the issue is that at the moment mod_wsgi doesn't have an
> equivalent for the command line -W option. Do people feel it would be
> useful to have a directive in mod_wsgi which allows one to control the
> warnings mechanism, ie., does the same as -W?

It's probably useful. Frankly, though, I'm only using mod_wsgi for
production, not development, and I'd never let code spewing warnings
make its way into production. So doesn't help/hurt me personally, but
it's probably useful for less strict development environments.

Jacob

--~--~-~--~~~---~--~~
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 and Python Warnings

2009-03-07 Thread Jacob Kaplan-Moss

On Sat, Mar 7, 2009 at 12:50 AM, Graham Dumpleton
 wrote:
> BTW, if there is anything else you would like to see in mod_wsgi, now
> is the time to speak up as am close to point where can wrap up work on
> mod_wsgi 3.0.

For the sites I work on, mod_wsgi is already basically perfect (to the
point that I usually don't bother reading the release notes when I
upgrade since I've already got everything I need).

The only exception would be, yes, X-Sendfile support -- I have a
number of apps that need to allow some sort of authenticated file
downloads. Over time I've played with mod_xsendfile, lighttpd's
mod_secdownload, Perlbal's X-Reproxy-* stuff, and nothing really beats
the convenience of X-Sendfile, including mod_python's direct
``req.sendfile`` thing.

Yes, the security concerns you mention are a possible concern,
especially for folks on shared hosts, and I'd completely understand
leaving the feature out because of those concerns -- in my book,
security trumps features every day. There's enough other ways of
accomplishing the same task that I don't see it as a hugely important
feature, but there's no denying that it'd be convenient.

Jacob

[And thanks for your comments on #2131; I hadn't thought fully through
all the different options there, so it's good to have the refresher.]

--~--~-~--~~~---~--~~
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: Best practice for a site-wide form (ie: search)?

2009-03-07 Thread Jacob Kaplan-Moss

On Sat, Mar 7, 2009 at 5:25 PM, Alex Gaynor  wrote:
> My strategy would be to make a template tag that was passed the variable and
> rendered that if there was data, else created and rendered a blank form.

Or, you know, you could just put a form in the base template. You
know, `...`. Really, don't overthink
stuff like this -- the easy way is easy for a reason.

Jacob

--~--~-~--~~~---~--~~
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: Trouble passing keyword arg to post_save signal

2009-03-07 Thread Jacob Kaplan-Moss

On Sat, Mar 7, 2009 at 11:14 PM, Brandon Taylor  wrote:
> When I attempt to pass a keyword arg to it:
>
> models.signals.post_save.connect(scrub_directory, sender=TheModel,
> {'my_kwarg' : 'some_value'})
>
> I get a syntax error: keyword argument appeared after a non-keyword
> argument.

Well, you're getting a syntax error because, erm, you have a syntax error.

What you've got in that line is a positional argument
(`scrub_directory`) followed by a keyword argument
(`sender=TheModel`), followed by a positional argument (the dictionary
`{'my_kwarg' : 'some_value'}`). You can't intersperse keyword and
positional arguments like that.

You probably want `connect(scrub_directory, sender=TheModel,
my_kwarg='some_value')` or, if you've got a dictionary of arbitrary
arguments, `connect(..., **mydict)`.

If you want to understand what's going on there, spend some time
brushing up on defining and calling functions in Python.
http://martyalchin.com/2007/nov/22/dynamic-functions/ is a good place
to start, and the complete, in-depth guide is at
http://docs.python.org/tutorial/controlflow.html#more-on-defining-functions.

Jacob

--~--~-~--~~~---~--~~
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: Encode Html for correct display in tags?

2009-03-10 Thread Jacob Kaplan-Moss

On Tue, Mar 10, 2009 at 8:55 AM, jago  wrote:
> Can this be done automatically in Python or Django?

Yes; Django automatically escapes HTML values in templates:
http://docs.djangoproject.com/en/dev/topics/templates/#id2

Jacob

--~--~-~--~~~---~--~~
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 blog for google app engine

2009-03-12 Thread Jacob Kaplan-Moss

On Tue, Mar 10, 2009 at 12:20 PM, Flank  wrote:
> where can i get open source blog on django for GAE?

App Engine is new enough you'll probably have better luck writing one
yourself. Here's a place to start:
http://www.42topics.com/dumps/appengine/doc.html

Jacob

--~--~-~--~~~---~--~~
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: Using Model name in the url

2009-03-12 Thread Jacob Kaplan-Moss

On Tue, Mar 10, 2009 at 9:44 PM, Michael Strickland  wrote:
> So I've actually run into a new problem: declaring the permalink for
> only the inherited models works fine, but whenever I query the
> database using the base model's manager (so I can get results from all
> of the inherited models), the resulting objects that are returned use
> the base model's permalink method, instead of the appropriate
> inherited model's method.

This is a small variation on a common question, usually phrased as
"how do I get a base class's manager to return instances of
subclasses?" If you look through the archives, you'll see this comes
up every few days or so.

The short answer is that for a number of reasons, most notably
performance, managers always return instances of their associated
models, regardless of class hierarchy. So `Base.objects.all()` always
returns `Base` instances, and `Child.objects.all()` always returns
`Child` instances. Again, search the archives if you want more details
of why this is.

Now, the long answer is that there are a number of ways to track which
"type" of child class a base class "really" is. I've used a variation
of http://www.djangosnippets.org/snippets/1187/ in the past and been
relatively happy with it. You might also try just doing that kind of
work in your base class's `get_absolute_url()` method if that's the
only bit you need.

Jacob

--~--~-~--~~~---~--~~
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: Posted data limits in django?

2009-03-12 Thread Jacob Kaplan-Moss

On Tue, Mar 10, 2009 at 11:22 PM, Greg  wrote:
> I've checked the actual posted data and it is all being posted
> correctly, which leads me to the conclusion that something in django
> itself is choking...? Can anyone help me with this? Is there a limit
> as to how many form fields you can have?

There's absolutely no limit that Django has in regards to the number
of form fields; there's got to be something else going on.

One thing I'd check: what form method are you using -- `GET`, or
`POST`? Remember that there's a limit on the length of the query
string used by `GET` (RFC 2068 suggests that anything over 255
characters is a bad idea), so double-check that you're using `POST`
here.

If it's not that, you should probably post more information -- your
form class, view, and template would help us figure out what's going
on.

Jacob

--~--~-~--~~~---~--~~
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: Simple Dynamic Form Problem

2009-03-12 Thread Jacob Kaplan-Moss

On Wed, Mar 11, 2009 at 11:30 AM, Alex G  wrote:
>
> Having referenced http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/,
> I set about in an attempt to make a dynamic form through a simple
> change to __init__, but not all is well...
>
[snip]
> .        super(RFSInputForm, self).__init__(self, *args, **kwargs)

That's your bug -- you don't need `self` in there -- see
http://docs.python.org/library/functions.html#super for more
information on how `super()` works. That line should
read`super(RFSInputForm, self).__init__(*args, **kwargs)`

Jacob

--~--~-~--~~~---~--~~
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: Question regarding post_save signal

2009-03-12 Thread Jacob Kaplan-Moss

On Wed, Mar 11, 2009 at 10:05 AM, uno...@gmail.com  wrote:
> is there a way that i can pass the user that generated the signal to
> my signal handler ?

No.

The `post_save` signal is a feature of the model API, which doesn't
know anything about these "users" of which you speak. Consider: if I
drop into a Python prompt, and type::

>>> YourModel.objects.create(**some_data)

... a `post_save` signal will be fired. Which user should that be
associated with?

Users -- and authentication in general -- are a feature of the view
layer, which is higher level than the model level the save signals
live at. If you need to associate a user with some object, you need to
do it at the view level where `request.user` is available.

Jacob

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

2009-03-12 Thread Jacob Kaplan-Moss

On Wed, Mar 11, 2009 at 7:10 PM, juanefren  wrote:
> Few times when I open any page in my site this error appears.
> Caught an exception while rendering: name 'login_required' is not
> defined.

Somewhere in your app you're missing an import. Try grepping your
source for "login_required" and check that every single place you
reference it you've also imported it.

Jacob

--~--~-~--~~~---~--~~
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: redirect module...

2009-03-12 Thread Jacob Kaplan-Moss

On Wed, Mar 11, 2009 at 2:50 PM, RavenJade2006  wrote:
> Is it because I did not put it in through the admin section?  Or is it
> because the page I am trying to redirect from still actually exists?

Assuming you're using Django's built-in redirect app
(http://docs.djangoproject.com/en/dev/ref/contrib/redirects/), it's
the later: that app doesn't redirect away from pages that exist.

>From the docs: "Each time any Django application raises a 404 error,
this middleware checks the redirects database for the requested URL as
a last resort." Notice that this only happens when an application's
already raised a 404 error, i.e. already reported an invalid URL.

Jacob

--~--~-~--~~~---~--~~
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: Getting stuck in transactions

2009-03-12 Thread Jacob Kaplan-Moss

On Tue, Mar 10, 2009 at 5:10 PM, Tom Davis  wrote:
> I have a command-line script that uses Django's ORM. For reasons
> beyond my comprehension, it has a tendency to get "stuck" in
> transactions. When I check the postgre server status, it simply shows
> a connection that is "idle in transaction" and never completes.

I'm pretty sure this is related to a know bug:
http://code.djangoproject.com/ticket/9964.

This'll be fixed in Django 1.1.

Jacob

--~--~-~--~~~---~--~~
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: Mac Django Docs: Fluid Icon

2009-03-12 Thread Jacob Kaplan-Moss

On Thu, Mar 12, 2009 at 5:47 AM, Idan Gazit  wrote:
> http://www.flickr.com/photos/idangazit/3348201897/in/pool-fluid_icons

Hey, that's slick -- thanks!

Jacob

--~--~-~--~~~---~--~~
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: How to submit a documentation patch

2009-03-13 Thread Jacob Kaplan-Moss

Hey Bayo --

To expand a bit on what Alex said, the relevant bit of the
documentation is
http://docs.djangoproject.com/en/dev/internals/contributing/#patch-style.
In essence, what you'll do is:

- Make an SVN checkout of Django.
- Make whatever doc edits you want to submit in the `docs/` directory.
- Generate a diff by running `svn diff` in the top-level of your
checkout (i.e. the directory with the `django`, `docs, `tests`, etc.
directories).
- Upload that diff to a ticket on code.djangoproject.com.

You can find a bit more information about the documentation markup
itself at http://docs.djangoproject.com/en/dev/internals/documentation/.

Thanks!

Jacob

--~--~-~--~~~---~--~~
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: Simple Dynamic Form Problem

2009-03-13 Thread Jacob Kaplan-Moss

On Fri, Mar 13, 2009 at 12:04 PM, Alex G  wrote:
> I knew it was going to be something like this.  I'm sorry to have
> troubled you :-/.

No worries at all. `super()` confuses the hell out of me, too :)

Jacob

--~--~-~--~~~---~--~~
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: Development server starting two processes

2009-03-14 Thread Jacob Kaplan-Moss

On Sat, Mar 14, 2009 at 5:53 AM, Guillermo
 wrote:
> Should I be seeing only one process instead of two when I start the
> dev server?

Nope -- two is normal behavior. One's the server itself, and the other
is the process that monitors your code on disk and reloads the server
when you make code changes.

>From 
>http://docs.djangoproject.com/en/dev/ref/django-admin/#runserver-optional-port-number-or-ipaddr-port:
"The development server automatically reloads Python code for each
request, as needed. You don't need to restart the server for code
changes to take effect."

To disable this, see the `--noreload` option:
http://docs.djangoproject.com/en/dev/ref/django-admin/#noreload

Jacob

--~--~-~--~~~---~--~~
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: Model problem, default not propagating to SQL

2009-03-15 Thread Jacob Kaplan-Moss

On Sat, Mar 14, 2009 at 11:56 PM, kpeters  wrote:
> default (active field) does not seem to propagate - see below
> (Postgres 8.3.6 - current Django as of yesterday)
>
> Any ideas?

This is expected behavior: the `default` argument can be things that
can't properly be represented in a database. Consider::

def tomorrow():
return datetime.date.today() + datetime.timedelta(days=1)

pub_date = models.DateField(default=tomorrow)

This creates a `DateField` that defaults to "tomorrow"; that can't
easily be represented in a database.

Jacob

--~--~-~--~~~---~--~~
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: Snap and SCT - any reviews?

2009-03-15 Thread Jacob Kaplan-Moss

On Sun, Mar 15, 2009 at 5:40 PM, John Crawford  wrote:
> Anyone? Anyone? Bueller?

That's rude.

Please don't take the amazing work of the volunteers on this board for
granted. Nobody here is required to update your question, and if you
don't get an answer that's just the way it goes. Further, you posted
your on Friday afternoon; expecting to hear back by Sunday ignores the
fact that many of us like to experience that place called "outdoors"
or at least "away from the keyboard" for the weekend.

Jacob

--~--~-~--~~~---~--~~
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: Memcache unstable under consistent heavy load

2009-03-15 Thread Jacob Kaplan-Moss

On Sun, Mar 15, 2009 at 7:42 PM, meppum  wrote:
> I've created a small script that *should* cause this error on any
> machine running memcached. Any thoughts would be appreciated.

Not for me -- the given script completes (quickly) without error on
every memcached installation I've got access to.

What's the error you're getting?

> memcached  -m 8 -c 1024 -v -l 127.0.0.1 -d

Note that you're allocating memcached a whopping 8 MB of RAM. That's
really not very much at all -- 1984 called and wants its hard drive
back.

Jacob

--~--~-~--~~~---~--~~
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: Memcache unstable under consistent heavy load

2009-03-15 Thread Jacob Kaplan-Moss

On Sun, Mar 15, 2009 at 8:43 PM, meppum  wrote:
> Did you run the script on the same machine as the memcached
> installation or did you do it across the wire?

Both; I can't seem to find any problems.

Again, what's the error you're getting?

Jacob

--~--~-~--~~~---~--~~
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 bug that should be addressed: Idle timeouts do not clear session information

2009-03-16 Thread Jacob Kaplan-Moss

On Mon, Mar 16, 2009 at 4:46 PM, Huuuze  wrote:
> Does anyone else agree with my viewpoints on this matter?  If so,
> please post your comments in the ticket.

Actually, the right way to get your viewpoint heard is to take the
matter to the django-developers mailing list, where topics related to
Django's development are discussed. You'll have more luck posting
suggestions and criticism there than here or on the ticket tracker.

However, please keep in mind that we're currently running up to Django
1.1, so it's likely that anything that's not an outright bug might be
left by the wayside while we close bugs for the final release. If you
don't get an immediate response, be patient and wait until a bit after
the release when we all have a bit more time.

Jacob

--~--~-~--~~~---~--~~
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: Numbering of items in template

2009-03-17 Thread Jacob Kaplan-Moss

On Tue, Mar 17, 2009 at 12:46 PM, Jesse  wrote:
> I'm please to know of such a tag.  Do you know of a good example of
> how it is used with the sum filter?  Otherwise, I will try.

I don't know why you'd need the sum filter; the for tag does
everything you'd want. See
http://docs.djangoproject.com/en/1.0/ref/templates/builtins/#for for
details of the {% for %} tag. You want something like::

{% for record in record_list %}
{{ forloop.counter }}: {{ record }}
{% endfor %}

Jacob

--~--~-~--~~~---~--~~
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 first app doubt

2009-03-17 Thread Jacob Kaplan-Moss

On Tue, Mar 17, 2009 at 12:53 PM, Gustavo Senise
 wrote:
> I am trying to access http://localhost:8000/polls/admin/ and getting a error
> 'MediaDefiningClass' object is not iterable.
>
> Can anyone help!?

Can you post the full traceback?

I suspect it might be a bug with a change in Django I made today --
are you running Django out of SVN?

Jacob

--~--~-~--~~~---~--~~
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 first app doubt

2009-03-17 Thread Jacob Kaplan-Moss

> I suspect it might be a bug with a change in Django I made today --
> are you running Django out of SVN?

Er, no, the bug I thought was there isn't. Still, it'll always help to
tell us what version of Django you're running.

Jacob

--~--~-~--~~~---~--~~
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: allowing a user to delete their own account and associated data.

2009-03-17 Thread Jacob Kaplan-Moss

On Tue, Mar 17, 2009 at 8:34 PM, tristan  wrote:
> A pointer to where I might find the python that deletes an account in
> the "Auth" admin app would be great, because then I could just copy
> that... I've found that does everything I need, but I need to expose
> it to my users so they can do it themselves...

Remember that the auth app is not anything special -- it's an app just
like any of the apps you'd write. It contains a model called `User`
which is, again, a normal Django model, with all the normal Django
model methods -- specifically, `delete()`.

>From the interactive shell, it's easy to delete a user::

>>> from django.contrib.auth.models import User
>>> u = User.objects.get(username='jacob')
>>> u.delete()

So, you'd need to write a view that essentially does the above.
Remember that in views, the currently-logged-in user is available as
`request.user`, so::

def delete_me(request):
request.user.delete()
return render_to_response('youve_been_deleted.html')

You'll probably want to implement some sort of "are you sure?"
confirmation page, but I'll leave that up to you.

Good luck,

Jacob

--~--~-~--~~~---~--~~
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 bug that should be addressed: Idle timeouts do not clear session information

2009-03-17 Thread Jacob Kaplan-Moss

On Tue, Mar 17, 2009 at 8:55 PM, Huuuze  wrote:
> 7.  Django detects the missing cookie

I think this is where you're getting hung up. Django doesn't "detect"
a "missing" cookie; Django sees a request from a browser that doesn't
include a cookie. Nothing's missing; it's just a new browser without a
cookie.

To Django, there's *no difference* between a user browsing a site
until his cookie expires then coming back, and the same user browsing
until the cookie expires and then a *second* user visiting without a
cookie. There's no "I used to have a cookie but now I don't" header;
there's either a session cookie, or there isn't.

Huuuze, I can appreciate that this is an infuriating aspect of HTTP --
statelessness is a real bitch sometimes. But you need to accept that
you're asking the impossible here and move on.

Jacob

--~--~-~--~~~---~--~~
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: My web page can not be Internationalized

2009-03-18 Thread Jacob Kaplan-Moss

On Wed, Mar 18, 2009 at 9:35 PM, Eric  wrote:
> Can anyone help me ? Tks

Malcolm tried. He wrote:

> Constructing a very small example, with, say, a form containing only the
> dropdown box, that demonstrates the problem you're seeing would be a
> reasonable start.

We can't read your mind; if you want help, you need to help us help you.

Jacob

--~--~-~--~~~---~--~~
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: Test Client doesn't populate request.META["HTTP_HOST"] ...

2009-03-19 Thread Jacob Kaplan-Moss

On Thu, Mar 19, 2009 at 9:40 AM, Johan  wrote:
> Am I using the wrong construct? If so how do I get around this
> problem?

::

>>> c.post('/register/', data, HTTP_HOST='example.com')

Jacob

--~--~-~--~~~---~--~~
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: ImageFile bug? (Re: ImageField questions)

2009-07-24 Thread Jacob Kaplan-Moss

On Fri, Jul 24, 2009 at 8:23 AM, Rusty Greer wrote:
> from what i can tell, get_image_dimensions in
> django/core/files/images.py seems to open the files but never closes
> them.  is this a bug?

Yes, it was #8817 (http://code.djangoproject.com/ticket/8817) which
was fixed a few months ago
(http://code.djangoproject.com/changeset/10708).

So the fix is in the 1.1 release candidate released earlier this week,
and will be in the 1.1 final and also in the next release of the 1.0.X
series.

Jacob

--~--~-~--~~~---~--~~
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: html text field ...disabled in form?

2009-07-24 Thread Jacob Kaplan-Moss

On Fri, Jul 24, 2009 at 8:57 AM, Asinox wrote:
> how ill make a html text field with attr disabled?

See the ``attrs`` argument to widgets:
http://docs.djangoproject.com/en/dev/ref/forms/widgets/#customizing-widget-instances

Jacob

--~--~-~--~~~---~--~~
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: ImageFile bug? (Re: ImageField questions)

2009-07-26 Thread Jacob Kaplan-Moss

2009/7/24 Rusty Greer :
> that bug actually doesn't fix my case.  if i alter the patch to just
> do a file.close() in all cases, it works.  is there another patch to
> close the file opened outside of this class?

I'm not sure I follow; let me make sure I understand you:

* You've verified that you're still having problems when running under
Django 1.1 RC 1?

* If you're opening the image file yourself, you need to make sure you
also close it. Django can't "guess" whether you want to leave the
image open or not, so you'll need to make sure any files you open are
closed.

Jacob

--~--~-~--~~~---~--~~
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: ImageFile bug? (Re: ImageField questions)

2009-07-28 Thread Jacob Kaplan-Moss

On Sun, Jul 26, 2009 at 11:10 PM, Rusty Greer wrote:
> i applied the patch you mentioned before (to my 1.0.2 release):

Yeah, the fix is predicated on some file storage refactoring that's
too intensive to reach the 1.0.X series. You'll need to upgrade to 1.1
to get the fix.

Jacob

--~--~-~--~~~---~--~~
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 infinite loop with 100% cpu use in django.forms.fields.email_re - DOS hole?

2009-10-09 Thread Jacob Kaplan-Moss

Just as an update for anyone following this thread:

This was indeed a security exploit, and it has been fixed. See
http://www.djangoproject.com/weblog/2009/oct/09/security/ for details.

Jacob

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



Call for proposals -- PyCon 2011

2010-09-23 Thread Jacob Kaplan-Moss
Call for proposals -- PyCon 2011 -- 
===

Proposal Due date: November 1st, 2010

PyCon is back! With a rocking new website, a great location and
more Python hackers and luminaries under one roof than you could
possibly shake a stick at. We've also added an "Extreme" talk
track this year - no introduction, no fluff - only the pure
technical meat!

PyCon 2011 will be held March 9th through the 17th, 2011 in Atlanta,
Georgia. (Home of some of the best southern food you can possibly
find on Earth!) The PyCon conference days will be March 11-13,
preceded by two tutorial days (March 9-10), and followed by four
days of development sprints (March 14-17).

PyCon 2011 is looking for proposals for the formal presentation
tracks (this includes "extreme talks"). A request for proposals for
poster sessions and tutorials will come separately.

Want to showcase your skills as a Python Hacker? Want to have
hundreds of people see your talk on the subject of your choice? Have
some hot button issue you think the community needs to address, or have
some package, code or project you simply love talking about? Want to
launch your master plan to take over the world with Python?

PyCon is your platform for getting the word out and teaching something
new to hundreds of people, face to face.

In the past, PyCon has had a broad range of presentations, from reports
on academic and commercial projects, tutorials on a broad range of
subjects, and case studies. All conference speakers are volunteers and
come from a myriad of backgrounds: some are new speakers, some have been
speaking for years. Everyone is welcome, so bring your passion and your
code! We've had some incredible past PyCons, and we're looking to you to
help us top them!

Online proposal submission is open now! Proposals  will be accepted
through November 10th, with acceptance notifications coming out by
January 20th. To get started, please see:

   

For videos of talks from previous years - check out:

   

For more information on "Extreme Talks" see:

   

We look forward to seeing you in Atlanta!

Please also note - registration for PyCon 2011 will also be capped at a
maximum of 1,500 delegates, including speakers. When registration opens
(soon), you're going to want to make sure you register early! Speakers
with accepted talks will have a guaranteed slot.

Important Dates:
   * November 1st, 2010: Talk proposals due.
   * December 15th, 2010: Acceptance emails sent.
   * January 19th, 2010: Early bird registration closes.
   * March 9-10th, 2011: Tutorial days at PyCon.
   * March 11-13th, 2011: PyCon main conference.
   * March 14-17th, 2011: PyCon sprints days.

Contact Emails:
   Van Lindberg (Conference Chair) - v...@python.org
   Jesse Noller (Co-Chair) - jnol...@python.org
   PyCon Organizers list: pycon-organiz...@python.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Setting initial data for an M2M field

2010-02-16 Thread Jacob Kaplan-Moss
On Tue, Feb 16, 2010 at 10:01 AM, Tom  wrote:
> I can set other initial data, for example to the 'notes' CharField
> fine.  I guess my question boils down to: how do you set initial data
> for a many-to-many field?

The initial data for a many to many field needs to be a list. So::

f = EmailForm(initial={'contacts': [contact.id]})

Remember: it's a *many-to-many* field, which means that the field has
*many* values.

Also notice the error message: "'long' object is not iterable". This
is telling you that someone, somewhere, has tried to iterate (treat as
a list) something (a long integer) that isn't a list object.

Jacob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: The going rate for Django-based web developers ...

2007-06-08 Thread Jacob Kaplan-Moss

On 6/8/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> to elaborate, i dont think such skill sets are available on the
> market. People who have them are all happily employed or are self-
> mployed

No shit; I have trouble finding people like that at *any* price.

[Shameless plug: if *you* have a price, email me; we're hiring.]

Jacob

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



Re: Scalability where file uploads are involved

2007-06-08 Thread Jacob Kaplan-Moss

On 6/7/07, Nimrod A. Abing <[EMAIL PROTECTED]> wrote:
> The only thing I can think of right now is to share a directory on the
> dedicated media server and have each server in the Django cluster
> mount that share either through NFS or Samba. But I don't think it's a
> good idea to do it this way.

We do it this way, and it works just fine. NFS over a dedicated GigE
link is nearly indistinguishable from a local drive.

Jacob

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



Re: Django datestyle

2007-06-13 Thread Jacob Kaplan-Moss

On 6/13/07, Mario Gonzalez <[EMAIL PROTECTED]> wrote:
> I'm getting some problems with style DateTime field because in my
> country we don't use ISO style, we use ISO, DMY instead.

Have you tried the DATE_FORMAT setting
(http://www.djangoproject.com/documentation/settings/#date-format)? It
doesn't change the representation stored in the DB, but *does* change
how Django displays the date.

Jacob

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



Re: multiple databases

2007-06-26 Thread Jacob Kaplan-Moss

On 6/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Ben Ford is working on merging in changes from the trunk in with the
> branch... at this time neither he or myself ( I had planned on doing
> this but found he was farther ahead of me ) have commit permissions to
> the project... but hopefully if he gets finished with it..and we can
> test it out... someone will give him permissions to commit.

Email me and I'll give you guys commit privs.

Jacob

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



Re: nasa site on django

2007-06-28 Thread Jacob Kaplan-Moss

On 6/27/07, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> Moved http://opensource.arc.nasa.gov to django a couple of weeks ago.
> Thought ya'll might want to know that.

Congrats :)

> Also thought you might want to know the site was running on Tomcat/Mysql and
> the performance difference is mind blowing.   Unfortunately the actual
> server specs and benchmarks can't be released without going through a nasty
> ball of red tape but let's just say django is ALOT more resource intensive
> and ALOT slower.

I (and many others, I'm sure) would love to help, but without details
it's basically impossible. Tuning hardware for Java is a great deal
different than tuning it for LAMPish stuff like Django.

Like Jeremy, though, I'd suspect a software problem: most code ported
from one language to another suffers the idioms of the old language.
Python isn't Java, but if you've coding like it is you're gonna have
issues.

If you can/want to share any additional details, we can try to help you out.

Jacob

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



Re: nasa site on django

2007-06-28 Thread Jacob Kaplan-Moss

On 6/28/07, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> Django suffers from running under mod_python in
> a prefork environment  where every process loads a full copy of django. So
> as I'm sure you can imagine RAM gets chewed up very quickly.

Are you running Django behind a load balancer like Perlbal or nginx?
One side-effect of propper LB is that you can drastically lower
MaxClients (because each backend client spends less time serving a
request). Look up "spoonfeeding" for more about this problem.

Even if you've only got a single web server you should always use
Perlbal or friends.

Jacob

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



Re: Accessing Web Services using Django

2007-07-03 Thread Jacob Kaplan-Moss

Hey Roboto --

There isn't anything Django-specific about consuming web services;
it's just Python. You might want to check out the section of Dive Into
Python that covers web services:
http://diveintopython.org/http_web_services/index.html

God luck,

Jacob

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



Re: YUI tags

2007-07-05 Thread Jacob Kaplan-Moss

Hi Todd --

You might find writing those "nested" template tags a bit tricky;
there's a not-very-well-documented method you'll need to pull out the
sub-tags.

I've got an example of how you can do these types of nested tags here:
http://www.djangosnippets.org/snippets/300/

Good luck!

Jacob

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



Re: one to many

2007-07-07 Thread Jacob Kaplan-Moss

On 7/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I'm curious about the use of instance._set. If I have models:
>
> class Foo(models.Model):
>   # something
>
> class Bar(models.Model):
>   myFoo = models.ForeignKey(Foo)
>
> ...would I be able to say barInstance.myFoo_set.[] ?

By default, it would be ``bar_set`` (i.e. the lower-cased version of
``Bar``, plus ``_set``).  You can change the name of this attribute by
setting the ``related_name`` attribute::

class Bar(models.Model):
foo = models.ForeignKey(Foo, related_name="bars")

This lets you say::

foo_instance.bars.all()

For example.

More here: http://www.djangoproject.com/documentation/db-api/#related-objects

Jacob

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



Re: Eclipse and PyDev setup

2007-07-11 Thread Jacob Kaplan-Moss

HI Fred --

In the future, please don't cross-post to django-users and django-dev;
django-dev is used to discuss the development of Django itself, not to
answer usage questions.

Thanks!

Jacob

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



Re: little problem

2007-07-13 Thread Jacob Kaplan-Moss

On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote:
>
> if getattr(model_instance, 'id', None) is None:
>   model_instance.created_by = whatever
>

Also take a look at ``hasattr()``:
http://docs.python.org/lib/built-in-funcs.html#l2h-35

Jacob

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



Re: flatpages issues

2007-07-13 Thread Jacob Kaplan-Moss

Hi John-Scott --

Did you add 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
to your ``MIDDLEWARE_CLASSES`` setting?

Jacob

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



Re: flatpages issues

2007-07-16 Thread Jacob Kaplan-Moss

On 7/16/07, John-Scott <[EMAIL PROTECTED]> wrote:
> Can someone in the know confirm or deny that adding the catch-all line
> to urls.py is in fact required to invoke flatpages?

No, it's not; the fallback middleware works fine for me. If it's not
working for you, chances are you've got something misconfigured; why
don't you post your settings.py and we'll take a look?

Jacob

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



Re: regex in url

2007-07-17 Thread Jacob Kaplan-Moss

On 7/16/07, james_027 <[EMAIL PROTECTED]> wrote:
> Yes I am looking for the explanation of ?P syntax, is this
> something related to python's regex or django's own regex.

Ned's quick answer below is quite clear, I think, but if you'd like
more details from the horse's mouth (as it were), the official Python
docs on regular expressions can be found here:
http://docs.python.org/lib/re-syntax.html

Jacob

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



Re: Bulk data upload

2007-07-18 Thread Jacob Kaplan-Moss

On 7/18/07, Tim Chase <[EMAIL PROTECTED]> wrote:
> I dislike CSV because it takes extra overhead to
> synchronize the flavors of them (how are quotes quoted?  are
> values quoted? etc).

Psst! Check out Python's built-in ``csv`` module
(http://docs.python.org/lib/module-csv.html); it handles all that
nastiness for you.

Jacob

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



Re: Django on a shared host. The docs are scaring me ;)

2007-07-19 Thread Jacob Kaplan-Moss

On 7/19/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> Gypsy is run by Jacob, so naturally ... - afaik they have a waiting
> list.

Actually, "they", err... me, are basically defunct; turned out running
a hosting company is a lot more work than I thought 

Jacob

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



Re: How to do not escape a unicode string in Django

2007-07-23 Thread Jacob Kaplan-Moss

Hi David --

It's probably just your shell; try ``print myobject`` instead.

Jacob

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



Re: Displaying the contents of a Dict (Using POST)...showing 'x' and 'y' keys?

2007-07-27 Thread Jacob Kaplan-Moss

On 7/27/07, Greg <[EMAIL PROTECTED]> wrote:
> It should only have 8 keys (1 through 8).  Instead I see the keys 'x'
> and 'y'?  It's causing a problem when I try to loop through my POST
> data.
>
> Does anybody know why this is happening?

You're probably using an  - those send along x/y
coords of the image click.

As a matter of general principle, though, you shouldn't assume
*anything* about the contents of data that comes from the web browser.
The browser could be a robot posting data automatically, or you could
be dealing with a greasemonkey script that's changing your markup, or
whatever. You need to write your code to deal with extra and/or
missing fields.

Jacob

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



Re: newforms: common constraints

2007-07-27 Thread Jacob Kaplan-Moss

On 7/27/07, james_027 <[EMAIL PROTECTED]> wrote:
> but those min max constraints are so common? why not include it?

Because "common" is different for any given user and/or site. I think
*I've* only written a single form with min/max validation, FWIW.
Designing a framework is hard; you've got to search for things that
are as close to truly universal as possible. Otherwise you end up
including every little pet feature that someone asks for, and that's
known as "PHP".

A good programmer will keep around his/her own library of common code
and break it out whenever needed. If you need min/max validation
often, you should make that the start of your own personal toolkit.

Jacob

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



Re: edit_inline following multiple relations in the admin site

2007-07-27 Thread Jacob Kaplan-Moss

On 7/27/07, Jos Houtman <[EMAIL PROTECTED]> wrote:
> Is this possible without denormalization of the data model or is my only
> viable option in writing a separate view?

edit_inline doesn't nest, so those are (unfortunately) your only two choices.

Jacob

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



Re: Wrong assertion in __init__ of ValidationError?

2007-07-30 Thread Jacob Kaplan-Moss

Hi Gilbert --

Yeah, this is a bug; it's on my shortlist to fix.

Jacob

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



Re: Problem with __setattr__ and __getattribute__

2007-08-01 Thread Jacob Kaplan-Moss

Hi Dave --

I'm not sure what's going on in your code example, but there's a
*much* easier way of copying an object::

>>> o = MyModel.objects.get(pk=1)
>>> o.id = None
>>> o.save()

By setting the ID (or whatever your primary key is called) to ``None``
and calling save() you'll force Django to insert a new object instead
of updating the existing one. All that monkeying with ``__dict__``
isn't really needed.

/me makes note to think about adding an ``obj.copy()`` method...

Jacob

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



Re: Firebird support

2007-08-02 Thread Jacob Kaplan-Moss

On 8/2/07, james_027 <[EMAIL PROTECTED]> wrote:
> anybody here heard of firebird database? how can I get support from
> django?

This has been discussed before on django-dev; please search the archives.

Jacob

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



Re: django app for managing sending email to users...

2007-08-03 Thread Jacob Kaplan-Moss

On 8/3/07, James Tauber <[EMAIL PROTECTED]> wrote:
> I was thinking of developing a django app for this with support for
> queuing and throttling of sends, scheduled sends, and logging of mail
> failures. I'm NOT interested at all in using it for unsolicited email
> (although unfortunately there's nothing in the design I have in mind
> that would prevent its use for that, I don't think)
>
> But I wanted to check first if anyone has developed something like this?

We've got something internally (as part of Ellington) that handles
these sorts of tasks, but it's somewhat half-assed. If you wanted to
start a public project, I can probably kick in some of the more
fully-assed parts of our code.

I'd have to check with management, of course, but given our track
record and our need for a robust email system I'm pretty sure the
answer'll be yes.

Jacob

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



Re: mod_python/django problems

2007-08-03 Thread Jacob Kaplan-Moss

On 8/3/07, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote:
> on few blogs/web sites it is stated that > 30 django sites on one
> server running apache/mod_python have some issues, like untraceable
> errors and wrong site displaying for some domain.
> any comments on this?

When something like this happens, it's usually because of a missing
PythonInterpreter and/or DJANGO_SETTINGS_MODULE directive.

We've had far more than 30 sites on a single Apache, no problems. I
use the past-tense since we've started running multiple instances of
Apache (instead of one monolithic one with many vhosts) so that we
have greater granular control over each individual site.

Jacob

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



Re: Launchpad - Community for free projects

2007-08-10 Thread Jacob Kaplan-Moss

On 8/10/07, Jonas <[EMAIL PROTECTED]> wrote:
> I found a great service to hosting free projects of software that let
> a great relation with the community and integration with Bazaar
> control version. Its name is launchpad.net, and the company behind is
> Canonical, the Ubuntu's creator.

I'm not entirely clean why you posted this here -- are you proposing
that Django switch to Launchpad (hint: don't).

Jacob

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



Re: Presentations about Django?

2007-08-10 Thread Jacob Kaplan-Moss

Hi Horst --

See http://www.djangoproject.com/community/logos/ -- that page has
downloadable high-res logos, along with some pretty simple usage
guidlines. In general, as long as you're using the Django logo to
promote Django itself (and not some other project/product), nobody's
going to come down on you.

Jacob

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



Re: Presentations about Django?

2007-08-10 Thread Jacob Kaplan-Moss

On 8/10/07, Vincent Foley <[EMAIL PROTECTED]> wrote:
> Has your "Django Master Class" at OSCON 07 been taped?

It wasn't, but the handouts contain nearly all the info, and you can
find 'em here: http://toys.jacobian.org/presentations/2007/oscon/tutorial/

Jacob

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



Re: Presentations about Django?

2007-08-10 Thread Jacob Kaplan-Moss

On 8/10/07, Brian Rosner <[EMAIL PROTECTED]> wrote:
> I saw the video of you presenting Django to Google at one of their Tech
> Talks and I am not sure if I read/heard this somewhere, but is that
> presentation freely available under the Creative Commons license or
> something?

It's at http://video.google.com/videoplay?docid=-70449010942275062. I
don't think the video itself is CC licensed, but as far as I'm
concerned, anyone who wants to use the content in their own Django
talks can certainly do so.

The slides themselves are at
http://toys.jacobian.org/presentations/2006/baypiggies/, btw, and a
similar offer applies to them.

Jacob

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



Re: Launchpad - Community for free projects

2007-08-10 Thread Jacob Kaplan-Moss

On 8/10/07, Jonas <[EMAIL PROTECTED]> wrote:
> I posted it here bacause I have been that there are many projects
> based on Python/Django hosted on Google Code and as found a better
> service where the community can integrate and participate better then
> I said it.

Fair enough; I'm just *extremely* suspicious of Cannonical's motives
and overall plans for Launchpad. To each their own, I suppose.

Jacob

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



Re: Django Book Site is down

2007-08-15 Thread Jacob Kaplan-Moss

On 8/15/07, eriku777 <[EMAIL PROTECTED]> wrote:
> Its back up.  My apologies for the thread but I could not figure out
> how to get in touch with the server admins.

[EMAIL PROTECTED] will do it.

FYI, my colo facility is having routing issues; might be a bit more
downtime in the next day or so.

Jacob

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



Re: mutual exclusion

2007-08-17 Thread Jacob Kaplan-Moss

On 8/17/07, Derek Anderson <[EMAIL PROTECTED]> wrote:
> this means 16 mailer threads  (or 32, if two machines).  but i only want
> one mailer thread running at a time.  (to avoid sending duplicate emails
> during a race condition)  but apache kills and restarts processes, so i
> can't just randomly pick one.  all processes must collude and elect one
> and only process as "it".  and they need to detect when the "it" thread
> has died because apache killed it's parent process, and elect a new one.

Were I in your place, I'd do one of two things:

* Look at a message broker like ActiveMQ (http://activemq.apache.org/)
and run the sender process(es) as consumers on the queue.
* Use a multi-process-safe queue and do the sending in-process.
zc.queue (http://pypi.python.org/pypi/zc.queue) would probably be best
for this.

Jacob

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



ANN: Making some changes to djangoproject.com

2007-09-07 Thread Jacob Kaplan-Moss

Howdy folks --

A quick announcement:

I'm going to be making some changes to djangoproject.com over the next
week or so.

The first of those changes are done and don't appear to have broken
anything, but if you notice anything busted, please send me an email
([EMAIL PROTECTED]).

These changes are in preparation of some exciting news, but I'll leave
y'all in suspense until next week.

Jacob

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



Re: Django Book

2007-09-07 Thread Jacob Kaplan-Moss

On 9/7/07, Griffin Caprio <[EMAIL PROTECTED]> wrote:
> This may have been answered already, but I couldn't find it.  What's
> the status of www.djangobook.com?  The last update is dated Jan 24
> 2007 and two chapters are still TBA.  Has the book been abandoned ?

No, we're finishing up the book for publication, which'll happen just
as soon as possible.

> There is a Django book coming from APress (http://www.amazon.com/
> Definitive-Guide-Django-Development-Right/dp/1590597257/ ) and one of
> the authors is a developer for django.  Is this the print incarnation
> of the site?

Yup.

Jacob

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



Re: ANN: Making some changes to djangoproject.com

2007-09-07 Thread Jacob Kaplan-Moss

On 9/7/07, ToddG <[EMAIL PROTECTED]> wrote:
> You're rewriting Django in Java! Finally, enterprise capability!

Dammit, that news wasn't supposed to leak! Who told you!?

Jacob

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



Re: *Occasional* PostgreSQL Error

2008-01-25 Thread Jacob Kaplan-Moss

Hi Doug --

On 1/24/08, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> OperationalError: could not connect to server: No such file or
> directory
>Is the server running locally and accepting
>connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> 5432"?

This means that, for some reason, a connection to the database
couldn't be established. You'll get this error if the database isn't
running, but since you only get it under load I'd guess that you're
hitting PostgreSQL's max connection limit (see the max_connections
setting in postgresql.conf). You can tell for sure by checking your
Postgres log; it'll have a message about reaching the connection
limit.

Jacob

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



Re: Iterating over very large queryset

2008-01-30 Thread Jacob Kaplan-Moss

On 1/30/08, James Bennett <[EMAIL PROTECTED]> wrote:
> On Jan 30, 2008 10:21 AM, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> > Can you share any hints on how to reduce the memory usage in such
> > situation? The underlying database structure is rather complicated and I
> > would like to not do all queries manually.
>
> At this level -- hundreds of thousands of objects per query -- I doubt
> that any ORM solution is going to deliver decent performance.

That may be true, but in this case it's actually a bug in Django:
under some (many?) circumstances QuerySets load the entire result set
into memory even when used with an iterator. The good news is that
this has been fixed; the bad news is that the fix is on the
queryset-refactor branch, which likely won't merge to trunk for at
least a few more weeks, if not longer. Also note that values() won't
really help you, either: the overhead for a model instance isn't all
that big; the problem you're running into is simply the shear number
of results.

In your situation, I'd do one of two things: either switch to the qsrf
branch if you're a living-on-the-edge kind of guy, or else look into
using an ObjectPaginator to churn through results in chunks.

Jacob

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



Re: sort order

2008-01-31 Thread Jacob Kaplan-Moss

On 1/31/08, Nianbig <[EMAIL PROTECTED]> wrote:
> I would like to add the functionality to be able to manually sort
> these objects in the Django-admin... I´ve tried doing this by just
> adding a integerfield... but it is not so user friendly... are there
> any built-in functions for this in Django ?

Nothing built-in, though this is a common need and will likely get
added to the admin at some point in the future.

In the meantime, you may want to check out
http://www.djangosnippets.org/snippets/568/ -- it's a clever little
hack to expose an ordering field in the changelist view. I've not
tried it myself, but it looks like it'd work.

Jacob

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



Re: Accessing the Admin class

2008-02-04 Thread Jacob Kaplan-Moss

On 2/4/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Anyone know what I'm doing wrong?

It's really not you: Django does some magic with the inner Admin class
and stuffs it away elsewhere. You can get at it via
``Model._meta.admin``.

However, before you do, I'd recommend at least looking at the
newforms-admin branch: it removes this magic and changes the way
objects are registered with the admin. There's also many more hooks
for customization, so chances are whatever you're working on will be
easier on that branch.

Jacob

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



Re: Unicode error

2008-02-05 Thread Jacob Kaplan-Moss

On 2/5/08, Kristian Øllegaard <[EMAIL PROTECTED]> wrote:
> Is there an obvious thing i did wrong? Have you heard about this error
> before?

This is because of the changes in Unicode handling after 0.96; read
more here: 
http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist

In general, if you've upgraded from 0.96 you *need* to read the
backwards-incompatible changes list:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges. When
we release new versions, that list becomes the release notes, but if
you're running off a trunk checkout you need to be aware of the
changes.

Jacob

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



Re: Improperly configured exception

2008-02-05 Thread Jacob Kaplan-Moss

On 2/5/08, Schmoopie <[EMAIL PROTECTED]> wrote:
> Improperly configured
> Error while importing URLconf 'mysite.urls'
>
> but there is no explanation here as to what is wrong with the
> configuration. What could be causing this?

It probably means that your ROOT_URLCONF, `mysite.urls`, is missing or
has a syntax error. Try importing it from the shell:

$ ./manage.py shell
>>> import mysite.urls

And see what happens. That should show you the error.

Jacob

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



Re: Questions related to testing Django application using Sqlite

2008-02-05 Thread Jacob Kaplan-Moss

On 2/5/08, Manoj Govindan <[EMAIL PROTECTED]> wrote:
> Recently I tried using Sqlite instead of Postgres as the database
> engine for testing one of my django applications.
> My observations follow:
>
> 1) Tests ran significantly faster[1].

Under Sqlite tests run in an in-memory database, so this is perfectly
normal. Like you, I see about a 10x speedup running tests against
Sqlite.

> 4) I don't have any explanation for why some tests failed only in
> Windows.

That's... bad :( Can you please open a ticket
(http://code.djangoproject.com/simpleticket) with your trimmed-down
app and test case? That's the best way to ensure it gets looked at and
fixed.

> Also, is there a way to examine the data in an Sqlite test
> database[2] while running tests?

Set TEST_DATABASE_NAME to the path to the sqlite database you'd like
to create, then hit the breakpoint like you're doing with Postgres.
Setting TEST_DATABASE_NAME will force the test harness to create a
real database instead of running the tests in-memory.

You also might want to look at the "testserver" management comment:
http://www.djangoproject.com/documentation/django-admin/#testserver-fixture-fixture

Jacob

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



Re: User permissions

2008-02-06 Thread Jacob Kaplan-Moss

On 2/6/08, James Bennett <[EMAIL PROTECTED]> wrote:
> Some amount of time between "now" and "the heat death of the
> universe". There is no estimate, no timeline, no schedule, no ETA, no
> guess, nor any other synonym of any of those words.

... though given the choices, I'd be inclined to wager that it's
closer to "now" than to "the heat death of the universe"...

Jacob

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



  1   2   3   4   5   6   >