diff --git a/oscar_docdata/gateway.py b/oscar_docdata/gateway.py index bdd2f77..d0fa51e 100644 --- a/oscar_docdata/gateway.py +++ b/oscar_docdata/gateway.py @@ -901,6 +901,39 @@ def to_xml(self, factory): class Quantity(object): """ An quantity for Docdata + + + + Quantity of this item that's being ordered. + + + + + + + + + Unit of measurement. + + The attribute can have the + following values: PCS - pieces + SEC- seconds BYT - bytes KB - + kilobytes + + + + + + + + + + + + + + + """ def __init__(self, value, unit='PCS'): """ @@ -917,15 +950,10 @@ def __init__(self, value, unit='PCS'): self.unit = unit def to_xml(self, factory): - # Needs to be an xsd:int with an attribute - # Can't do that with factory.create('ns0:quantity') - #metadata = factory.resolver.find('ns0:quantity') - #ns = metadata.namespace() - - element = Element('ns0:quantity') - element.setText(str(self.value)) - element.set('unitOfMeasure', self.unit) - return element + node = factory.create('ns0:quantity') + node.unitOfMeasure = self.unit + node.int = self.value + return node class Invoice(object):