util: use propertycache in opener instead of __getattr__
authorSimon Heimberg <simohe@besonet.ch>
Fri, 10 Jul 2009 17:54:04 +0200
changeset 9112 54eb3782d32f
parent 9111 ac3f1e6696eb
child 9114 72cbbfe6e343
util: use propertycache in opener instead of __getattr__
mercurial/util.py
--- 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: