Merge pull request #5072 from achillesrasquinha/py3

[PY3] Added input compat with six
This commit is contained in:
Achilles Rasquinha 2018-02-23 18:18:09 +05:30 committed by GitHub
commit 8de4ebe7fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -6,6 +6,8 @@
from __future__ import unicode_literals, print_function
import six
import os, json, sys, subprocess, shutil
import frappe
import frappe.database
@ -178,7 +180,7 @@ def remove_app(app_name, dry_run=False, yes=False):
"""Delete app and all linked to the app's module with the app."""
if not dry_run and not yes:
confirm = input("All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue (y/n) ? ")
confirm = six.input("All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue (y/n) ? ")
if confirm!="y":
return
@ -302,7 +304,7 @@ def get_site_config_path():
def get_conf_params(db_name=None, db_password=None):
if not db_name:
db_name = input("Database Name: ")
db_name = six.input("Database Name: ")
if not db_name:
raise Exception("Database Name Required")

View file

@ -3,6 +3,8 @@
from __future__ import unicode_literals, print_function
import six
import frappe, os, re
from frappe.utils import touch_file, encode, cstr
@ -25,7 +27,7 @@ def make_boilerplate(dest, app_name):
hook_key = key.split(" (")[0].lower().replace(" ", "_")
hook_val = None
while not hook_val:
hook_val = cstr(input(key + ": "))
hook_val = cstr(six.input(key + ": "))
if not hook_val:
defaults = {

View file

@ -111,7 +111,7 @@ def build_response(path, data, http_status_code, headers=None):
if headers:
for key, val in iteritems(headers):
response.headers[bytes(key)] = val.encode("utf-8")
response.headers[bytes(key.encode("utf-8"))] = val.encode("utf-8")
return response