Merge pull request #16599 from adityahase/python3-fix
fix(py3): Use six.text_type instead of unicode
This commit is contained in:
commit
a9f20d801d
@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import json
|
||||
from six import text_type
|
||||
from frappe import _
|
||||
from frappe.utils import flt, get_datetime, getdate, date_diff, cint, nowdate
|
||||
from frappe.model.document import Document
|
||||
@ -591,10 +592,10 @@ def make_timesheet(production_order, company):
|
||||
|
||||
@frappe.whitelist()
|
||||
def add_timesheet_detail(timesheet, args):
|
||||
if isinstance(timesheet, unicode):
|
||||
if isinstance(timesheet, text_type):
|
||||
timesheet = frappe.get_doc('Timesheet', timesheet)
|
||||
|
||||
if isinstance(args, unicode):
|
||||
if isinstance(args, text_type):
|
||||
args = json.loads(args)
|
||||
|
||||
timesheet.append('time_logs', args)
|
||||
|
@ -2,6 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from six import text_type
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
@ -60,7 +61,7 @@ def _make_naming_series_key(prefix):
|
||||
:param prefix: Naming series prefix gotten from Stock Settings
|
||||
:return: The derived key. If no prefix is given, an empty string is returned
|
||||
"""
|
||||
if not unicode(prefix):
|
||||
if not text_type(prefix):
|
||||
return ''
|
||||
else:
|
||||
return prefix.upper() + '.#####'
|
||||
@ -86,7 +87,7 @@ class Batch(Document):
|
||||
def autoname(self):
|
||||
"""Generate random ID for batch if not specified"""
|
||||
if not self.batch_id:
|
||||
create_new_batch, batch_number_series = frappe.db.get_value('Item', self.item,
|
||||
create_new_batch, batch_number_series = frappe.db.get_value('Item', self.item,
|
||||
['create_new_batch', 'batch_number_series'])
|
||||
|
||||
if create_new_batch:
|
||||
|
@ -3,6 +3,7 @@ import frappe, requests
|
||||
from frappe import _
|
||||
from jinja2 import utils
|
||||
from html2text import html2text
|
||||
from six import text_type
|
||||
from frappe.utils import sanitize_html
|
||||
from frappe.utils.global_search import search
|
||||
|
||||
@ -12,7 +13,7 @@ def get_context(context):
|
||||
query = str(utils.escape(sanitize_html(frappe.form_dict.q)))
|
||||
context.title = _('Help Results for')
|
||||
context.query = query
|
||||
|
||||
|
||||
context.route = '/search_help'
|
||||
d = frappe._dict()
|
||||
d.results_sections = get_help_results_sections(query)
|
||||
@ -73,7 +74,7 @@ def prepare_api_results(api, topics_data):
|
||||
for topic in topics_data:
|
||||
route = api.base_url + '/' + (api.post_route + '/' if api.post_route else "")
|
||||
for key in api.post_route_key_list.split(','):
|
||||
route += unicode(topic[key])
|
||||
route += text_type(topic[key])
|
||||
|
||||
results.append(frappe._dict({
|
||||
'title': topic[api.post_title_key],
|
||||
|
Loading…
x
Reference in New Issue
Block a user