@classmethod
def clsmethod(cls):
print "HERE in", cls
Blows up like this for me:
File "C:\www\django\core\meta\__init__.py", line 490, in __new__
assert callable(v), "%r is an invalid model parameter." % k
AssertionError: 'clsmethod' is an invalid model parameter.
I am also not able to create a 'memoize' decorator for caching method
results in an instance. Instead, I either have to do the "if
_cache_blah: return _cache_blah" pattern in each method I want
cacheable or call out to a non-model function that can be memoized but
using a global LRU dictionary.
While I see both Simon's and Adrian's side in this debate, if my
problem can only be solved by removing the existing modules "magic"
then I have to vote +1 for Simon because I think it is bad form not to
support decorators in django models.
If this suggestion does get approved, is there a way we can make the
current modules methods still work by simply having them reference the
class methods, rather than forcing a re-write of existing applications?
The old pattern could simply be deprecated.