Skip to content

Commit b2bf910

Browse files
committed
Merge branch 'release/0.6dev'
2 parents 1c3b2b0 + 46c4443 commit b2bf910

File tree

6 files changed

+526
-14
lines changed

6 files changed

+526
-14
lines changed

magento/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@
1010
'API', 'Store', 'Magento',
1111
'Customer', 'CustomerGroup', 'CustomerAddress',
1212
'Country', 'Region',
13+
'Cart', 'CartCoupon', 'CartCustomer',
14+
'CartPayment', 'CartProduct', 'CartShipping',
15+
1316
'Category', 'CategoryAttribute', 'Product', 'ProductAttribute',
1417
'ProductAttributeSet', 'ProductTypes', 'ProductImages',
1518
'ProductTierPrice', 'ProductLinks', 'ProductConfigurable',
16-
'Inventory', 'Order', 'Shipment', 'Invoice', '__version__'
19+
'Inventory', 'Order', 'Shipment', 'Invoice', '__version__',
20+
'Client',
1721
]
1822

1923
from .api import API
24+
from .client import Client
25+
from .checkout import Cart, CartCoupon, CartCustomer
26+
from .checkout import CartPayment, CartProduct, CartShipping
2027
from .miscellaneous import Store, Magento
2128
from .customer import Customer, CustomerGroup, CustomerAddress
2229
from .directory import Country, Region

magento/api.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,9 @@ class API(object):
3131
"""
3232
Generic API to connect to magento
3333
"""
34-
__slots__ = (
35-
'url',
36-
'username',
37-
'password',
38-
'session',
39-
'client',
40-
'protocol',
41-
)
4234

4335
def __init__(self, url, username, password,
44-
version='1.3.2.4', full_url=False, protocol='xmlrpc'):
36+
version='1.3.2.4', full_url=False, protocol='xmlrpc', transport=None):
4537
"""
4638
This is the Base API class which other APIs have to subclass. By
4739
default the inherited classes also get the properties of this
@@ -53,8 +45,6 @@ class which will allow the use of the API with the `with` statement
5345
5446
class Core(API):
5547
56-
__slots__ = ( )
57-
5848
def websites(self):
5949
return self.call('ol_websites.list', [])
6050
@@ -106,13 +96,17 @@ def store_views(self):
10696
:param full_url: If set to true, then the `url` is expected to
10797
be a complete URL
10898
:param protocol: 'xmlrpc' and 'soap' are valid values
99+
:param transport: optional xmlrpclib.Transport subclass for
100+
use in xmlrpc requests
109101
"""
110102
assert protocol \
111103
in PROTOCOLS, "protocol must be %s" % ' OR '.join(PROTOCOLS)
112104
self.url = str(full_url and url or expand_url(url, protocol))
113105
self.username = username
114106
self.password = password
115107
self.protocol = protocol
108+
self.version = version
109+
self.transport = transport
116110
self.session = None
117111
self.client = None
118112

@@ -122,7 +116,11 @@ def connect(self):
122116
but does not login. This could be used as a connection test
123117
"""
124118
if self.protocol == 'xmlrpc':
125-
self.client = ServerProxy(self.url, allow_none=True)
119+
if self.transport:
120+
self.client = ServerProxy(
121+
self.url, allow_none=True, transport=self.transport)
122+
else:
123+
self.client = ServerProxy(self.url, allow_none=True)
126124
else:
127125
self.client = Client(self.url)
128126

@@ -171,3 +169,4 @@ def multiCall(self, calls):
171169
return self.client.multiCall(self.session, calls)
172170
else:
173171
return self.client.service.multiCall(self.session, calls)
172+

0 commit comments

Comments
 (0)