Re: Slugify() and Clean form data Questions

2010-02-22 Thread Jon Loeliger
> > Hope this better answers your question, > Matt Matt, Indeed it does. Thank you! I guess a bit of the frustrating part of learning Django here is stumbling across the sites that explain how to do various tidbits of functionality, and then slide in some variant [*1*] of "But one would never

Re: Slugify() and Clean form data Questions

2010-02-22 Thread Matt McCants
Django's database API does a lot of the worrying for you. It will autoescape the more dangerous aspects of user input when executing SQL. You'd have to be more careful if you were executing raw queries and even then you'd have to be running those queries as literal strings instead of parameterized

Re: Slugify() and Clean form data Questions

2010-02-22 Thread Peter Herndon
On Mon, Feb 22, 2010 at 12:32 PM, Jon Loeliger wrote: > I get is_valid() and the notion of cleaned data.  I *think*, > though, that I am asking for something more robust. > > Will some_form.is_valid() will, say, remove (or identify) > embedded SQL hacking attempts from a plain text

Re: Slugify() and Clean form data Questions

2010-02-22 Thread Jon Loeliger
> > Is there a reason why you can't use Form.is_valid()? It's pretty nice. > > http://docs.djangoproject.com/en/dev/ref/forms/api/#accessing-clean-data > > Example: > http://gist.github.com/311192 I get is_valid() and the notion of cleaned data. I *think*, though, that I am asking for

Re: Slugify() and Clean form data Questions

2010-02-22 Thread Matt McCants
Is there a reason why you can't use Form.is_valid()? It's pretty nice. http://docs.djangoproject.com/en/dev/ref/forms/api/#accessing-clean-data Example: http://gist.github.com/311192 On Sat, Feb 20, 2010 at 11:25 AM, Jon Loeliger wrote: > > Folks, > > A few days ago I asked: > >

Re: Slugify() and Clean form data Questions

2010-02-20 Thread Jon Loeliger
> Folks, A few days ago I asked: > Is there a canonical definition or even a reference > implementation of a slug = slugify(str) function somewhere? Thanks for taking the time to answer that for me! We pretty much beat the answer into my thick skull: Use the slugify() function as per "from

Re: Slugify() and Clean form data Questions

2010-02-18 Thread Jon Loeliger
> > from django.template.defaultfilters import slugify > > Every filter you see listed in > http://docs.djangoproject.com/en/dev/ref/templates/builtins/ lives in > django.template.defaultfilters. Awesome! Thanks! And with that in hand, the only place I can find the string

Re: Slugify() and Clean form data Questions

2010-02-18 Thread Matt McCants
Here's a stripped down example. I've messed with using signals instead of overriding the save method for all the models that need a slug. But this is quick and easy. http://gist.github.com/308068 Matt On Thu, 2010-02-18 at 14:53 -0600, Jon Loeliger wrote: > > > > > Is there a canonical

Re: Slugify() and Clean form data Questions

2010-02-18 Thread Jon Loeliger
> Some places say underscores are valid, others say they removed: > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/ > > slugify > > Converts to lowercase, removes non-word characters > (alphanumerics and underscores) and converts spaces to > hyphens.

Re: Slugify() and Clean form data Questions

2010-02-18 Thread Jon Loeliger
> > > Is there a canonical definition or even a reference implementation > > of a slug =3D slugify(str) function somewhere? Yeah, I could go > > grep through the sources and maybe find one? And yes, I see: > >=20 > >http://docs.djangoproject.com/en/dev/ref/models/fields/#slugfield > >=20 >

Re: Slugify() and Clean form data Questions

2010-02-18 Thread Peter Herndon
On Feb 18, 2010, at 3:01 PM, Jon Loeliger wrote: > Folks, > > Quick question or two: > > Is there a canonical definition or even a reference implementation > of a slug = slugify(str) function somewhere? Yeah, I could go > grep through the sources and maybe find one? And yes, I see: > >

Slugify() and Clean form data Questions

2010-02-18 Thread Jon Loeliger
Folks, Quick question or two: Is there a canonical definition or even a reference implementation of a slug = slugify(str) function somewhere? Yeah, I could go grep through the sources and maybe find one? And yes, I see: http://docs.djangoproject.com/en/dev/ref/models/fields/#slugfield