2013-05-15 08:59:02 +00:00
|
|
|
def pristinemethod(func):
|
2013-04-30 15:11:29 +00:00
|
|
|
"""
|
|
|
|
|
A decorator for handling pristine settings like callables.
|
|
|
|
|
|
|
|
|
|
Use it like this::
|
|
|
|
|
|
2013-07-27 10:05:39 +00:00
|
|
|
from configurations import Configuration, pristinemethod
|
2013-04-30 15:11:29 +00:00
|
|
|
|
2013-07-27 10:05:39 +00:00
|
|
|
class Develop(Configuration):
|
2013-04-30 15:11:29 +00:00
|
|
|
|
2013-05-15 08:59:02 +00:00
|
|
|
@pristinemethod
|
2013-05-13 08:18:38 +00:00
|
|
|
def USER_CHECK(user):
|
2013-04-30 15:11:29 +00:00
|
|
|
return user.check_perms()
|
|
|
|
|
|
2013-05-15 08:59:02 +00:00
|
|
|
GROUP_CHECK = pristinemethod(lambda user: user.has_group_access())
|
2013-04-30 15:11:29 +00:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
func.pristine = True
|
|
|
|
|
return staticmethod(func)
|