Skip to content

Commit

Permalink
Merge pull request #76 from akretion/revert-75-develop
Browse files Browse the repository at this point in the history
Revert "1.5"
  • Loading branch information
hparfr committed May 2, 2017
2 parents aee6c0e + f287739 commit c51f6f7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ Roadmap / TODO:
- Support additionnal methods of api
- Write tests

# 0.1.5 2017-05-02
- fix escaping issue in DPD
- fix output of DPD (now always base64 decoded)

# 0.1.4 2017-03-20
- Automatic deployment to pypi

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.5
0.1.4
9 changes: 3 additions & 6 deletions roulier/carriers/dpd/dpd_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from lxml import objectify
from roulier.codec import Decoder
from roulier import ws_tools as tools
import base64


class DpdDecoder(Decoder):
Expand All @@ -20,8 +19,6 @@ def create_shipment_with_labels(msg):
label, attachment = labels.getchildren()
label_data = self.handle_zpl(label.label.text, output_format)
# .text because we want str instead of objectify.StringElement
summary_data = base64.b64decode(attachment.label.text)
summary_format = output_format == 'ZPL' and 'png' or output_format
x = {
"tracking": {
'number': shipment.barcode.text,
Expand All @@ -33,9 +30,9 @@ def create_shipment_with_labels(msg):
"type": output_format,
},
"annexes": [{
"data": summary_data,
"data": attachment.label.text,
"name": "Summary",
"type": summary_format
"type": output_format
}]
}
return x
Expand All @@ -57,4 +54,4 @@ def handle_zpl(self, png, label_format):
if label_format == 'ZPL':
return tools.png_to_zpl(png, True)
else:
return base64.b64decode(png)
return png
3 changes: 1 addition & 2 deletions roulier/carriers/dpd/dpd_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def encode(self, api_input, action):

env = Environment(
loader=PackageLoader('roulier', '/carriers/dpd/templates'),
extensions=['jinja2.ext.with_', 'jinja2.ext.autoescape'],
autoescape=True)
extensions=['jinja2.ext.with_'])

template = env.get_template("dpd_%s.xml" % action)
return {
Expand Down

0 comments on commit c51f6f7

Please sign in to comment.