this might just be my misunderstanding of decorators...but I am adding a custom decorator to a view function and made a reference to 'request.user.username'. However, I get the error "global name 'request' is not defined"
schinckel
toothe: you'll need to paste your decorator and view
the decorator is literally just "@check_Permission"
SmileyChris
toothe: your validate function doesn't take a request argument, so of course it's not defined
schinckel
toothe: There are already decorators for checking if a user has a specific permission.
SmileyChris
and what's with that capitazilation? :P
toothe
it doesn't inherit that variable?
SmileyChris
toothe: inherit it from where?
toothe
schinckel: yse, but I plan to do something unique
SmileyChris: nevermind...
so, I need to pass the request variable to the decorator?
d0ngz
when i do heroku open i get: /usr/local/heroku/lib/heroku/helpers.rb:93: warning: Insecure world writable dir /home/d0ng/local/bin in PATH, mode 040777
toothe
ie @check_Permission(request=request)
SmileyChris
toothe: it's the receiving end that's the problem
atm, it'd be args[0]
you need to explicitly specify it in your definition if you want it
is there a setting that will allow for non-unique email addresses in django.contrib.auth.models.User?
nownot joined the channel
faldridge has quit
nownot
does anyone have any experince with python-social-auth?
monokrome
jwhite007: Provide your own AUTH_USER_MODEL that makes it optional
aminho has quit
nownot
im able to login with tiwtter, it writes the user to the db and populates the password field, but how to do I login with that user thereafter. and after login and redirect request.user is AnonymousUser
snurfery has quit
toothe
okay, why does the decorator not get the request variable?
jwhite007
monokrome: ok. thanks. i thought there might be something that i could add to settings.py.
toothe
because Django's decorators seem to have access to the request variable.
daidoji has quit
il_ joined the channel
daidoji joined the channel
SmileyChris: I'm still confused, it works in my sample code.
SmileyChris: when I pass a function, the decorator is able to get it.
naro joined the channel
il has quit
cbsw joined the channel
daidoji has quit
dray3 has quit
nimomo joined the channel
daidoji joined the channel
warehouse13 joined the channel
I don't get this, why is request not defined.
how does the source do it then
Left_Turn has quit
naro has quit
yeukhon joined the channel
nimomo has quit
ovnicraft joined the channel
royendgel joined the channel
how in the world did this variable come into scope?
in the Django source?
kenbolton has quit
arlefreak has quit
hyperair has quit
sjaak_trekhaak has quit
josePhoenix
toothe: decorators return a callable... so you can define an inner function that gets request
jcvfen: run "manage.py shell" and then type "frim signup import views" ... what does it show?
vbabiy has quit
jcvfen
>>> from signups import views
/home/vv/skillshare/src/signups/forms.py:5: RemovedInDjango18Warning: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is deprecated - form SignUpForm needs updating