Browse Source

Use property function rather than decorator, so we can support setters in the future.

Jelmer Vernooij 16 years ago
parent
commit
196cce1b31
1 changed files with 18 additions and 12 deletions
  1. 18 12
      dulwich/objects.py

+ 18 - 12
dulwich/objects.py

@@ -172,9 +172,10 @@ class ShaFile(object):
     def id(self):
     def id(self):
         return self.sha().hexdigest()
         return self.sha().hexdigest()
   
   
-    @property
-    def type(self):
+    def get_type(self):
         return self._num_type
         return self._num_type
+
+    type = property(get_type)
   
   
     def __repr__(self):
     def __repr__(self):
         return "<%s %s>" % (self.__class__.__name__, self.id)
         return "<%s %s>" % (self.__class__.__name__, self.id)
@@ -300,33 +301,38 @@ class Tag(ShaFile):
         count += 1
         count += 1
         self._message = text[count:]
         self._message = text[count:]
 
 
-    @property
-    def object(self):
+    def get_object(self):
         """Returns the object pointed by this tag, represented as a tuple(type, sha)"""
         """Returns the object pointed by this tag, represented as a tuple(type, sha)"""
         return (self._object_type, self._object_sha)
         return (self._object_type, self._object_sha)
 
 
-    @property
-    def name(self):
+    object = property(get_object)
+
+    def get_name(self):
         """Returns the name of this tag"""
         """Returns the name of this tag"""
         return self._name
         return self._name
 
 
-    @property
-    def tagger(self):
+    name = property(get_name)
+
+    def get_tagger(self):
         """Returns the name of the person who created this tag"""
         """Returns the name of the person who created this tag"""
         return self._tagger
         return self._tagger
 
 
-    @property
-    def tag_time(self):
+    tagger = property(get_tagger)
+
+    def get_tag_time(self):
         """Returns the creation timestamp of the tag.
         """Returns the creation timestamp of the tag.
 
 
         Returns it as the number of seconds since the epoch"""
         Returns it as the number of seconds since the epoch"""
         return self._tag_time
         return self._tag_time
 
 
-    @property
-    def message(self):
+    tag_time = property(get_tag_time)
+
+    def get_message(self):
         """Returns the message attached to this tag"""
         """Returns the message attached to this tag"""
         return self._message
         return self._message
 
 
+    message = property(get_message)
+
 
 
 def parse_tree(text):
 def parse_tree(text):
     ret = {}
     ret = {}