Re: Username Blacklist

2009-03-17 Thread P M
why don't you use
ABSOLUTE_URL_OVERRIDES = {
   'auth.user': lambda o: "/*user*/%s/" % o.username,
}

so username will not collide with application name !!!

Greetings.
Puneet


On Tue, Mar 17, 2009 at 3:14 PM, Andrew Turner  wrote:

>
> Just for the record, I have created the following class (subclassing
> RegistrationFormUniqueEmail):-
>
> class RegistrationFormNonBlacklisted(RegistrationFormUniqueEmail):
>def clean_username(self):
>if self.cleaned_data['username'] in settings.BLACKLISTED_USERNAMES:
>raise forms.ValidationError(_(u'The username you have
> chosen is invalid. Please supply a different username.'))
>return self.cleaned_data['username']
>
> added the following line to my urls.py:-
>
> (r'^accounts/register/$', register, {'form_class':
> RegistrationFormNonBlacklisted}),
>
> and added BLACKLISTED_USERNAMES to my settings.py to check against.
>
> Works a treat!
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

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

2009-03-26 Thread P M
 IronPython is not CPython , i will be amazed if these two works identically
...

On Thu, Mar 26, 2009 at 2:54 PM, Adi Sieker  wrote:

>
> Hi,
>
> On 26.03.2009, at 14:21, Sergey Petrov wrote:
>
> >
> > I've blown my brains away, trying to make django work under IIS7 on
> > Windows Server 2008.
> >
> > I've tried PyISAPIe. I've tried fastcgi module.
> >
> > I'm no guru of windows, not even a expirienced user, though.
> >
> > Google tells nothing about django on IIS7.
> >
> > So, I'm begging you — please, anyone, give me a hint (better — step by
> > step howto) — how to make it work.
> >
> > Performance is not in question — anything that works will do.
> >
> > Thanks a lot.
> >
>
> I have no idea about IIS, but a quick google for django on iis7 turned
> up this:
> http://ironpython-urls.blogspot.com/2008/11/wsgi-on-net-and-in-cloud.html
>
> adi
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

--~--~-~--~~~---~--~~
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: File upload: how to validate file type

2009-03-28 Thread P M
servus,

there are various ways to check, but best will be to use Python-libmagic
interface... it did worked well for me ..

mit freundliche Grüß

On Sat, Mar 28, 2009 at 10:16 PM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

>
> Hallöchen!
>
> I'd like to ensure that people only upload PDF files, so the file
> must start with "%PDF".  If the file starts with something else, the
> form must not validate.
>
> How do I do that?  I though about a clean_... method which reads the
> start of the file and then re-opens it.  Is this a good idea?
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

--~--~-~--~~~---~--~~
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: File upload: how to validate file type

2009-03-28 Thread P M
yes you can, because signature of pdf is in the starting of 1st chunk of
stream... rest of the things are of hardly interest for libmagic
identification...

what ever method you are using to handle the chunks/streams is still the
same, regardless of type of data user is uploading,

one more tip :) libmagic python interface also provide a option to you to
feed in stream/part of chunk... so hack that simple interface and you are
done ;)

greetings,
Puneet


On Sat, Mar 28, 2009 at 10:37 PM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

>
> Hallöchen!
>
> P M writes:
>
> > there are various ways to check, but best will be to use
> > Python-libmagic interface... it did worked well for me ..
>
> Thank for the hint, however, the interesting part is whether I can
> safely tamper with the file object in the clean method, so that the
> actual download with .chunks() afterwards still works correctly.
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

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