This (possible backwards incompatible) change means subclassing and
customising shipping methods becomes much easier. Now that shipping
methods are stateless, we can instantiate at compile time and assign
them to the repository instance.
This commit also renames internal methods of the shipping repository
in as the 'prime' notion is no longer valid (as we're not injecting a
basket into each method).
It now takes the shipping charge rather than the method. This makes
sense as the shipping charge has normally been calculated before we need
the order total so there is no point in calculating it twice.
Align options for Partner.name and order's Line.partner_name field
Partner name's are allowed to be empty, but Line.partner_name wasn't.
This caused orders to fail when the partner name was indeed empty, as
reported in #1206.
So the field options for both have to be identical. Unfortunately, that
means allowing null=True for Line.partner_name. But dropping null=True
from CharFields should be done as a separate effort all over Oscar's
codebase.
Fixes #1206.
Adjust how shipping methods are handled in the repository class
The old Repository class wasn't thread safe as the method instances were
created at compile time. Since the instance is configured by setting
the basket for each request, this poses thread safety issues as two
requests could share the same method instance (one of which would have
the wrong basket assigned).
This change fiddles with how the methods are handled, ensuring that they
are instanciated within the instance methods so that thread-safety
issues go away.
Shipping methods need a gentle rewrite for v0.7 to ensure they aren't
vulnerable to such issues.
This allows different shipping methods to be handled more consistently
in multilingual sites, where same shipping method will be saved with
different names.
Fixes #850
To support multi-currency sites. This commit also made the order totals
a mandatory input for creating an order, which meant quite a few tests
had to change to support the new API.
Use charge_incl_tax instead of basket_charge_incl_tax(). This is
clearer.
Backwards compatible versions of the old methods are kept for now.
Related to #805
Hmmm, this turned out to be a monster commit. This change allows the
basket to be able to correctly calculate prices including tax.
It also requires a whole load of test changes since all baskets now
require a strategy instance to be assigned.
This allows updating code in both places, if necessary. Getting Django
1.5 support would be painful otherwise. This also removes the circular
dependency of django-oscar-testsupport on Oscar.
The requirements were merged. The imports were updated
accordingly. Unused imports in the touched files were removed. No
further changes.