mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
fixes for unicode
This commit is contained in:
@@ -37,20 +37,20 @@ class DocType:
|
|||||||
Checks incoming email settings
|
Checks incoming email settings
|
||||||
"""
|
"""
|
||||||
if self.doc.outgoing_mail_server:
|
if self.doc.outgoing_mail_server:
|
||||||
from webnotes.utils import cint
|
from webnotes.utils import cint, get_encoded_string
|
||||||
import _socket
|
import _socket
|
||||||
from webnotes.utils.email_lib.send import EMail
|
from webnotes.utils.email_lib.send import EMail
|
||||||
import smtplib
|
import smtplib
|
||||||
out_email = EMail()
|
out_email = EMail()
|
||||||
out_email.server = self.doc.outgoing_mail_server.encode('utf-8')
|
out_email.server = get_encoded_string(self.doc.outgoing_mail_server)
|
||||||
out_email.port = cint(self.doc.mail_port)
|
out_email.port = cint(self.doc.mail_port)
|
||||||
out_email.use_ssl = self.doc.use_ssl
|
out_email.use_ssl = self.doc.use_ssl
|
||||||
try:
|
try:
|
||||||
err_msg = "Login Id or Mail Password missing. Please enter and try again."
|
err_msg = "Login Id or Mail Password missing. Please enter and try again."
|
||||||
if not (self.doc.mail_login and self.doc.mail_password):
|
if not (self.doc.mail_login and self.doc.mail_password):
|
||||||
raise AttributeError, err_msg
|
raise AttributeError, err_msg
|
||||||
out_email.login = self.doc.mail_login.encode('utf-8')
|
out_email.login = get_encoded_string(self.doc.mail_login)
|
||||||
out_email.password = self.doc.mail_password.encode('utf-8')
|
out_email.password = get_encoded_string(self.doc.mail_password)
|
||||||
except AttributeError, e:
|
except AttributeError, e:
|
||||||
webnotes.msgprint(err_msg)
|
webnotes.msgprint(err_msg)
|
||||||
raise e
|
raise e
|
||||||
@@ -72,15 +72,17 @@ class DocType:
|
|||||||
from webnotes.utils.email_lib.receive import POP3Mailbox
|
from webnotes.utils.email_lib.receive import POP3Mailbox
|
||||||
from webnotes.model.doc import Document
|
from webnotes.model.doc import Document
|
||||||
import _socket, poplib
|
import _socket, poplib
|
||||||
|
from webnotes.utils import get_encoded_string
|
||||||
|
|
||||||
inc_email = Document('Incoming Email Settings')
|
inc_email = Document('Incoming Email Settings')
|
||||||
inc_email.host = self.doc.support_host.encode('utf-8')
|
inc_email.host = get_encoded_string(self.doc.support_host)
|
||||||
inc_email.use_ssl = self.doc.support_use_ssl
|
inc_email.use_ssl = self.doc.support_use_ssl
|
||||||
try:
|
try:
|
||||||
err_msg = 'User Name or Support Password missing. Please enter and try again.'
|
err_msg = 'User Name or Support Password missing. Please enter and try again.'
|
||||||
if not (self.doc.support_username and self.doc.support_password):
|
if not (self.doc.support_username and self.doc.support_password):
|
||||||
raise AttributeError, err_msg
|
raise AttributeError, err_msg
|
||||||
inc_email.username = self.doc.support_username.encode('utf-8')
|
inc_email.username = get_encoded_string(self.doc.support_username)
|
||||||
inc_email.password = self.doc.support_password.encode('utf-8')
|
inc_email.password = get_encoded_string(self.doc.support_password)
|
||||||
except AttributeError, e:
|
except AttributeError, e:
|
||||||
webnotes.msgprint(err_msg)
|
webnotes.msgprint(err_msg)
|
||||||
raise e
|
raise e
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
|
|
||||||
cur_frm.cscript.hide_website_fields = function(doc) {
|
cur_frm.cscript.hide_website_fields = function(doc) {
|
||||||
var website_fields_list = ['page_name', 'website_image', 'web_short_description',
|
var website_fields_list = ['page_name', 'website_image', 'web_short_description',
|
||||||
'web_long_description']
|
'web_long_description'];
|
||||||
if (cint(doc.show_in_website)) {
|
if (doc && cint(doc.show_in_website)) {
|
||||||
unhide_field(website_fields_list);
|
unhide_field(website_fields_list);
|
||||||
} else {
|
} else {
|
||||||
hide_field(website_fields_list);
|
hide_field(website_fields_list);
|
||||||
|
|||||||
@@ -1844,7 +1844,7 @@ newdoc.amendment_date=dateutil.obj_to_str(new Date());}
|
|||||||
this.copy_doc(fn,1);}
|
this.copy_doc(fn,1);}
|
||||||
_f.get_value=function(dt,dn,fn){if(locals[dt]&&locals[dt][dn])
|
_f.get_value=function(dt,dn,fn){if(locals[dt]&&locals[dt][dn])
|
||||||
return locals[dt][dn][fn];}
|
return locals[dt][dn][fn];}
|
||||||
_f.Frm.prototype.set_value_in_locals=function(dt,dn,fn,v){var d=locals[dt][dn];var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))
|
_f.Frm.prototype.set_value_in_locals=function(dt,dn,fn,v){var d=locals[dt][dn];if(!d)return;var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))
|
||||||
changed=false;if(changed){d[fn]=v;if(d.parenttype)
|
changed=false;if(changed){d[fn]=v;if(d.parenttype)
|
||||||
d.__unsaved=1;this.set_unsaved();}}
|
d.__unsaved=1;this.set_unsaved();}}
|
||||||
_f.Frm.prototype.set_unsaved=function(){if(cur_frm.doc.__unsaved)return;cur_frm.doc.__unsaved=1;cur_frm.frm_head.refresh_labels()}
|
_f.Frm.prototype.set_unsaved=function(){if(cur_frm.doc.__unsaved)return;cur_frm.doc.__unsaved=1;cur_frm.frm_head.refresh_labels()}
|
||||||
|
|||||||
@@ -39,11 +39,13 @@ import webnotes
|
|||||||
import webnotes.handler
|
import webnotes.handler
|
||||||
import webnotes.auth
|
import webnotes.auth
|
||||||
|
|
||||||
|
from webnotes.utils import cstr
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
# make the form_dict
|
# make the form_dict
|
||||||
webnotes.form = cgi.FieldStorage(keep_blank_values=True)
|
webnotes.form = cgi.FieldStorage(keep_blank_values=True)
|
||||||
for key in webnotes.form.keys():
|
for key in webnotes.form.keys():
|
||||||
webnotes.form_dict[key] = webnotes.form.getvalue(key)
|
webnotes.form_dict[key] = cstr(webnotes.form.getvalue(key))
|
||||||
|
|
||||||
# init request
|
# init request
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ def init():
|
|||||||
|
|
||||||
def respond():
|
def respond():
|
||||||
import webnotes
|
import webnotes
|
||||||
|
from webnotes.utils import get_encoded_string
|
||||||
try:
|
try:
|
||||||
if 'page' in webnotes.form_dict:
|
if 'page' in webnotes.form_dict:
|
||||||
html = get_html(webnotes.form_dict['page'])
|
html = get_html(webnotes.form_dict['page'])
|
||||||
@@ -52,7 +53,7 @@ def respond():
|
|||||||
|
|
||||||
print "Content-Type: text/html"
|
print "Content-Type: text/html"
|
||||||
print
|
print
|
||||||
print html.encode('utf-8')
|
print get_encoded_string(html)
|
||||||
|
|
||||||
def get_html(page_name):
|
def get_html(page_name):
|
||||||
import website.utils
|
import website.utils
|
||||||
|
|||||||
Reference in New Issue
Block a user