diff babel/support.py @ 579:99d51589c822 trunk

use decorators (as we require Python 2.4+ anyway)
author fschwarz
date Tue, 31 Jul 2012 08:46:19 +0000
parents 7c81bb0d32e5
children 57a08cc52623
line wrap: on
line diff
--- a/babel/support.py
+++ b/babel/support.py
@@ -194,6 +194,7 @@
         object.__setattr__(self, '_is_cache_enabled', is_cache_enabled)
         object.__setattr__(self, '_value', None)
 
+    @property
     def value(self):
         if self._value is None:
             value = self._func(*self._args, **self._kwargs)
@@ -201,7 +202,6 @@
                 return value
             object.__setattr__(self, '_value', value)
         return self._value
-    value = property(value)
 
     def __contains__(self, key):
         return key in self.value
@@ -298,6 +298,7 @@
         self.domain = domain
         self._domains = {}
 
+    @classmethod
     def load(cls, dirname=None, locales=None, domain=DEFAULT_DOMAIN):
         """Load translations from the given directory.
 
@@ -320,7 +321,6 @@
         if not filename:
             return gettext.NullTranslations()
         return cls(fileobj=open(filename, 'rb'), domain=domain)
-    load = classmethod(load)
 
     def __repr__(self):
         return '<%s: "%s">' % (type(self).__name__,
Copyright (C) 2012-2017 Edgewall Software