[Checkins] SVN: five.pt/trunk/ Return the class itself, if called without an instance (class-attribute access).

Malthe Borch mborch at gmail.com
Mon Feb 16 05:11:45 EST 2009


Log message for revision 96578:
  Return the class itself, if called without an instance (class-attribute access).

Changed:
  U   five.pt/trunk/CHANGES.txt
  U   five.pt/trunk/src/five/pt/patches.py

-=-
Modified: five.pt/trunk/CHANGES.txt
===================================================================
--- five.pt/trunk/CHANGES.txt	2009-02-16 07:21:48 UTC (rev 96577)
+++ five.pt/trunk/CHANGES.txt	2009-02-16 10:11:44 UTC (rev 96578)
@@ -1,6 +1,9 @@
 Changelog
 =========
 
+- If the ``__get__`` method is called uninstantiated, just return the
+  class itself. [malthe]
+
 five.pt 0.4 (released 2/13/2009)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Modified: five.pt/trunk/src/five/pt/patches.py
===================================================================
--- five.pt/trunk/src/five/pt/patches.py	2009-02-16 07:21:48 UTC (rev 96577)
+++ five.pt/trunk/src/five/pt/patches.py	2009-02-16 10:11:44 UTC (rev 96578)
@@ -44,6 +44,9 @@
 _marker = object()
 
 def get_bound_template(self, instance, type):
+    if instance is None:
+        return self
+    
     template = getattr(self, '_template', _marker)
     if template is _marker:
         self._template = template = ViewPageTemplateFile(self.filename)



More information about the Checkins mailing list