changeset 9112:54eb3782d32f

util: use propertycache in opener instead of __getattr__
author Simon Heimberg <simohe@besonet.ch>
date Fri, 10 Jul 2009 17:54:04 +0200
parents ac3f1e6696eb
children 72cbbfe6e343
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Jul 10 23:24:35 2009 +0200
+++ b/mercurial/util.py	Fri Jul 10 17:54:04 2009 +0200
@@ -842,11 +842,9 @@
             self.audit_path = always
         self.createmode = None
 
-    def __getattr__(self, name):
-        if name == '_can_symlink':
-            self._can_symlink = checklink(self.base)
-            return self._can_symlink
-        raise AttributeError(name)
+    @propertycache
+    def _can_symlink(self):
+        return checklink(self.base)
 
     def _fixfilemode(self, name):
         if self.createmode is None: