Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

python 2.5 support

  • Loading branch information...
commit a0d476e5384372890007b35f07fe8fae3970b85c 1 parent 93edd59
Janne Vanhala authored March 10, 2012
3  .gitmodules
... ...
@@ -0,0 +1,3 @@
  1
+[submodule "docs/_themes"]
  2
+	path = docs/_themes
  3
+	url = https://github.com/mitsuhiko/flask-sphinx-themes.git
1  docs/_themes
... ...
@@ -0,0 +1 @@
  1
+Subproject commit 0269f3d188eaff07c44a800f35f7351f9e0aefb0
33  flask_split/models.py
@@ -19,22 +19,28 @@ def __init__(self, name, experiment_name):
19 19
             self.name = name
20 20
             self.weight = 1
21 21
 
22  
-    @property
23  
-    def participant_count(self):
  22
+    def _get_participant_count(self):
24 23
         return int(self.redis.hget(self.key, 'participant_count') or 0)
25 24
 
26  
-    @participant_count.setter
27  
-    def participant_count(self, count):
  25
+    def _set_participant_count(self, count):
28 26
         self.redis.hset(self.key, 'participant_count', int(count))
29 27
 
30  
-    @property
31  
-    def completed_count(self):
  28
+    participant_count = property(
  29
+        _get_participant_count,
  30
+        _set_participant_count
  31
+    )
  32
+
  33
+    def _get_completed_count(self):
32 34
         return int(self.redis.hget(self.key, 'completed_count') or 0)
33 35
 
34  
-    @completed_count.setter
35  
-    def completed_count(self, count):
  36
+    def _set_completed_count(self, count):
36 37
         self.redis.hset(self.key, 'completed_count', int(count))
37 38
 
  39
+    completed_count = property(
  40
+        _get_completed_count,
  41
+        _set_completed_count
  42
+    )
  43
+
38 44
     def increment_participation(self):
39 45
         self.redis.hincrby(self.key, 'participant_count', 1)
40 46
 
@@ -131,16 +137,19 @@ def __init__(self, name, *alternative_names):
131 137
     def control(self):
132 138
         return self.alternatives[0]
133 139
 
134  
-    @property
135  
-    def winner(self):
  140
+    def _get_winner(self):
136 141
         winner = self.redis.hget('experiment_winner', self.name)
137 142
         if winner:
138 143
             return Alternative(winner, self.name)
139 144
 
140  
-    @winner.setter
141  
-    def winner(self, winner_name):
  145
+    def _set_winner(self, winner_name):
142 146
         self.redis.hset('experiment_winner', self.name, winner_name)
143 147
 
  148
+    winner = property(
  149
+        _get_winner,
  150
+        _set_winner
  151
+    )
  152
+
144 153
     def reset_winner(self):
145 154
         self.redis.hdel('experiment_winner', self.name)
146 155
 

0 notes on commit a0d476e

Please sign in to comment.
Something went wrong with that request. Please try again.