[Moin-user] setting variables depeding if a user is logged in.
Adam Shand
adam at personaltelco.net
Wed Apr 10 16:04:58 EDT 2002
On Wed, 2002-04-10 at 02:28, Juergen Hermann wrote:
> It has to be
>
> from MoinMoin import config
> config.sitename = ...
>
> you're setting a LOCAL variable in your code. And to check whether the
> user is logged in, use "user.valid".
Okay, this is making me feel really stupid. I know I'm a bad programmer
but I'm not normally *this* bad. As soon as I add any of this stuff I
get an internal server error.
This is what I put in my moin_config.py (and many combinations of):
# security (deactivated by default)
if 1:
allowed_actions = ['AttachFile']
from MoinMoin.security import Permissions
class SecurityPolicy(Permissions):
edit = 1
delete = 0
def __init__(self, user):
self.user = user
self.edit = self.edit and user.valid
from MoinMoin import config
config.sitename = "test"
Then I decided that since there isn't a "config" beneath security.py and
it should go outside the "if 1:" stanza, but that didn't work either.
If someone could give me a codeblock to set variables based on whether a
user is actually logged in that would be great.
If not I'll go home and bust out the python book and see if I can wrap
my head around how classes work. :)
thanks,
Adam.
More information about the Moin-user
mailing list