Merge pull request #15349 from sagarvora/py3-fixes

[py3] print, StringIO import, and other fixes
This commit is contained in:
Ameya Shenoy 2018-09-09 02:25:10 +05:30 committed by GitHub
commit 8b7fea5a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -3,8 +3,12 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, time, dateutil, math, csv, StringIO import frappe, time, dateutil, math, csv
import amazon_mws_api as mws try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws
from frappe import _ from frappe import _
#Get and Create Products #Get and Create Products
@ -22,7 +26,7 @@ def get_products_details():
listings_response = reports.get_report(report_id=report_id) listings_response = reports.get_report(report_id=report_id)
#Get ASIN Codes #Get ASIN Codes
string_io = StringIO.StringIO(listings_response.original) string_io = StringIO(listings_response.original)
csv_rows = list(csv.reader(string_io, delimiter=str('\t'))) csv_rows = list(csv.reader(string_io, delimiter=str('\t')))
asin_list = list(set([row[1] for row in csv_rows[1:]])) asin_list = list(set([row[1] for row in csv_rows[1:]]))
#break into chunks of 10 #break into chunks of 10

View File

@ -9,7 +9,7 @@ import urllib
import hashlib import hashlib
import hmac import hmac
import base64 import base64
import xml_utils from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils
import re import re
try: try:
from xml.etree.ElementTree import ParseError as XMLError from xml.etree.ElementTree import ParseError as XMLError

View File

@ -7,7 +7,7 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
import dateutil import dateutil
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from amazon_methods import get_products_details, get_orders from erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods import get_products_details, get_orders
class AmazonMWSSettings(Document): class AmazonMWSSettings(Document):
def validate(self): def validate(self):

View File

@ -307,8 +307,8 @@ def manage_fee_validity(appointment_name, method, ref_invoice=None):
fee_validity = create_fee_validity(appointment_doc.practitioner, appointment_doc.patient, appointment_doc.appointment_date, ref_invoice) fee_validity = create_fee_validity(appointment_doc.practitioner, appointment_doc.patient, appointment_doc.appointment_date, ref_invoice)
visited = fee_validity.visited visited = fee_validity.visited
print "do_not_update: ", do_not_update print("do_not_update: ", do_not_update)
print "visited: ", visited print("visited: ", visited)
# Mark All Patient Appointment invoiced = True in the validity range do not cross the max visit # Mark All Patient Appointment invoiced = True in the validity range do not cross the max visit
if (method == "on_cancel"): if (method == "on_cancel"):
@ -410,7 +410,7 @@ def get_children(doctype, parent, company, is_root=False):
lft > %s and rgt < %s""", lft > %s and rgt < %s""",
(each['lft'], each['rgt'])) (each['lft'], each['rgt']))
for child in child_list: for child in child_list:
print child[0], child[1] print(child[0], child[1])
if not occupied: if not occupied:
occupied = 0 occupied = 0
if child[1] == "Occupied": if child[1] == "Occupied":