Преглед на файлове

Rename all of strategy's methods

This was somehow overlooked. Also added a missing
parent_availability_policy on the Structured base class.
master
Maik Hoepfel преди 11 години
родител
ревизия
b764d9b405
променени са 2 файла, в които са добавени 17 реда и са изтрити 9 реда
  1. 2
    1
      docs/source/releases/v0.8.rst
  2. 15
    8
      oscar/apps/partner/strategy.py

+ 2
- 1
docs/source/releases/v0.8.rst Целия файл

@@ -224,9 +224,10 @@ The following methods and properties have been deprecated:
224 224
 * ``Product.is_variant`` - Use ``is_child`` instead.
225 225
 * ``Product.is_top_level`` - Test for ``is_standalone`` and/or ``is_parent`` instead.
226 226
 * ``Strategy.fetch_for_group`` - Use ``fetch_for_parent`` instead.
227
+* ``Strategy.group_[pricing|availability]_policy`` - Use
228
+  ``parent_[pricing|availability]_policy`` instead.
227 229
 * ``Strategy.select_variant_stockrecords`` - Use
228 230
   ``select_children_stockrecords`` instead.
229
-*
230 231
 
231 232
 Shipping
232 233
 ~~~~~~~~

+ 15
- 8
oscar/apps/partner/strategy.py Целия файл

@@ -128,8 +128,8 @@ class Structured(Base):
128 128
         # Select children and associated stockrecords
129 129
         children_stock = self.select_children_stockrecords(product)
130 130
         return PurchaseInfo(
131
-            price=self.group_pricing_policy(product, children_stock),
132
-            availability=self.group_availability_policy(
131
+            price=self.parent_pricing_policy(product, children_stock),
132
+            availability=self.parent_availability_policy(
133 133
                 product, children_stock),
134 134
             stockrecord=None)
135 135
 
@@ -163,10 +163,11 @@ class Structured(Base):
163 163
             "A structured strategy class must define a "
164 164
             "'pricing_policy' method")
165 165
 
166
-    def group_pricing_policy(self, product, children_stock):
166
+    def parent_pricing_policy(self, product, children_stock):
167 167
         raise NotImplementedError(
168 168
             "A structured strategy class must define a "
169
-            "'group_pricing_policy' method")
169
+            "'parent_pricing_policy' method")
170
+    group_pricing_policy = deprecated(parent_pricing_policy)
170 171
 
171 172
     def availability_policy(self, product, stockrecord):
172 173
         """
@@ -176,6 +177,12 @@ class Structured(Base):
176 177
             "A structured strategy class must define a "
177 178
             "'availability_policy' method")
178 179
 
180
+    def parent_availability_policy(self, product, children_stock):
181
+        raise NotImplementedError(
182
+            "A structured strategy class must define a "
183
+            "'parent_availability_policy' method")
184
+    group_availability_policy = deprecated(parent_availability_policy)
185
+
179 186
 
180 187
 # Mixins - these can be used to construct the appropriate strategy class
181 188
 
@@ -212,7 +219,7 @@ class StockRequired(object):
212 219
             return availability.StockRequired(
213 220
                 stockrecord.net_stock_level)
214 221
 
215
-    def group_availability_policy(self, product, children_stock):
222
+    def parent_availability_policy(self, product, children_stock):
216 223
         # A parent product is available if one of its children is
217 224
         for child, stockrecord in children_stock:
218 225
             policy = self.availability_policy(product, stockrecord)
@@ -237,7 +244,7 @@ class NoTax(object):
237 244
             excl_tax=stockrecord.price_excl_tax,
238 245
             tax=D('0.00'))
239 246
 
240
-    def group_pricing_policy(self, product, children_stock):
247
+    def parent_pricing_policy(self, product, children_stock):
241 248
         stockrecords = [x[1] for x in children_stock if x[1] is not None]
242 249
         if not stockrecords:
243 250
             return prices.Unavailable()
@@ -268,7 +275,7 @@ class FixedRateTax(object):
268 275
             excl_tax=stockrecord.price_excl_tax,
269 276
             tax=tax)
270 277
 
271
-    def group_pricing_policy(self, product, children_stock):
278
+    def parent_pricing_policy(self, product, children_stock):
272 279
         stockrecords = [x[1] for x in children_stock if x[1] is not None]
273 280
         if not stockrecords:
274 281
             return prices.Unavailable()
@@ -297,7 +304,7 @@ class DeferredTax(object):
297 304
             currency=stockrecord.price_currency,
298 305
             excl_tax=stockrecord.price_excl_tax)
299 306
 
300
-    def group_pricing_policy(self, product, children_stock):
307
+    def parent_pricing_policy(self, product, children_stock):
301 308
         stockrecords = [x[1] for x in children_stock if x[1] is not None]
302 309
         if not stockrecords:
303 310
             return prices.Unavailable()

Loading…
Отказ
Запис