On Mon, Feb 16, 2009 at 2:33 PM, MV <m...@shift.co.nz> wrote:

>
> Hi there,
>
> I have a question about class variables in Django.  If I create a
> custom field, e.g.
>
> class TinyMCEField(models.Field):
>    superadmin = False
>    def formfield(self, **kwargs):
>        if superadmin:
>             defaults = {'widget':TinyMCE(... blah blah blah})}
>        else:
>             defaults = {'widget':TinyMCE(... blah blah blah})}
>
> And if use middleware to change the value of TinyMCEField.superadmin
> to True or False depending on information in request.user, is the
> change to the class variable scoped only to that request? Or am I
> doing something dangerous?
> >
>
Nope, that change will be to the entire python process, so that's not how
you want to handle it.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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

Reply via email to