Merge branch 'master' of github.com:webnotes/wnframework
This commit is contained in:
commit
bce7333c08
7 changed files with 26 additions and 21 deletions
|
|
@ -116,7 +116,6 @@ class DuplicateEntryError(Exception): pass
|
|||
class ValidationError(Exception): pass
|
||||
class AuthenticationError(Exception): pass
|
||||
class PermissionError(Exception): pass
|
||||
class OutgoingEmailError(ValidationError): pass
|
||||
class UnknownDomainError(Exception): pass
|
||||
class SessionStopped(Exception): pass
|
||||
class MappingMismatchError(ValidationError): pass
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ class Bean:
|
|||
|
||||
if self.doc.fields.get("__islocal"):
|
||||
# set name before validate
|
||||
self.doc.set_new_name()
|
||||
self.doc.set_new_name(self.get_controller())
|
||||
self.run_method('before_insert')
|
||||
|
||||
if method != "cancel":
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ def make_autoname(key, doctype=''):
|
|||
def getseries(key, digits, doctype=''):
|
||||
# series created ?
|
||||
current = webnotes.conn.sql("select `current` from `tabSeries` where name=%s for update", key)
|
||||
if current and current[0][0]:
|
||||
if current and current[0][0] is not None:
|
||||
current = current[0][0]
|
||||
# yes, update it
|
||||
webnotes.conn.sql("update tabSeries set current = current+1 where name=%s", key)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ from webnotes import conf
|
|||
from webnotes import msgprint
|
||||
from webnotes.utils import cint, expand_partial_links
|
||||
|
||||
class OutgoingEmailError(webnotes.ValidationError): pass
|
||||
|
||||
def get_email(recipients, sender='', msg='', subject='[No Subject]', text_content = None, footer=None):
|
||||
"""send an html email as multipart with attachments and all"""
|
||||
email = EMail(sender, recipients, subject)
|
||||
|
|
@ -108,7 +110,7 @@ class EMail:
|
|||
try:
|
||||
import startup
|
||||
footer += getattr(startup, 'mail_footer', '')
|
||||
except ImportError, e:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
return footer
|
||||
|
|
@ -225,12 +227,12 @@ class EMail:
|
|||
|
||||
except smtplib.SMTPSenderRefused:
|
||||
webnotes.msgprint("""Invalid Outgoing Mail Server's Login Id or Password. \
|
||||
Please rectify and try again.""",
|
||||
raise_exception=webnotes.OutgoingEmailError)
|
||||
Please rectify and try again.""")
|
||||
raise
|
||||
except smtplib.SMTPRecipientsRefused:
|
||||
webnotes.msgprint("""Invalid Recipient (To) Email Address. \
|
||||
Please rectify and try again.""",
|
||||
raise_exception=webnotes.OutgoingEmailError)
|
||||
Please rectify and try again.""")
|
||||
raise
|
||||
|
||||
class SMTPServer:
|
||||
def __init__(self, login=None, password=None, server=None, port=None, use_ssl=None):
|
||||
|
|
@ -308,17 +310,16 @@ class SMTPServer:
|
|||
|
||||
return self._sess
|
||||
|
||||
except _socket.error, e:
|
||||
except _socket.error:
|
||||
# Invalid mail server -- due to refusing connection
|
||||
webnotes.msgprint('Invalid Outgoing Mail Server or Port. Please rectify and try again.')
|
||||
raise webnotes.OutgoingEmailError, e
|
||||
except smtplib.SMTPAuthenticationError, e:
|
||||
raise
|
||||
except smtplib.SMTPAuthenticationError:
|
||||
webnotes.msgprint("Invalid Outgoing Mail Server's Login Id or Password. \
|
||||
Please rectify and try again.")
|
||||
raise webnotes.OutgoingEmailError, e
|
||||
except smtplib.SMTPException, e:
|
||||
raise
|
||||
except smtplib.SMTPException:
|
||||
webnotes.msgprint('There is something wrong with your Outgoing Mail Settings. \
|
||||
Please contact us at support@erpnext.com')
|
||||
raise webnotes.OutgoingEmailError, e
|
||||
|
||||
raise
|
||||
|
||||
|
|
|
|||
|
|
@ -14,12 +14,14 @@ class PageNotFoundError(Exception): pass
|
|||
|
||||
def render(page_name):
|
||||
"""render html page"""
|
||||
if not page_name:
|
||||
page_name = "index"
|
||||
try:
|
||||
html = render_page(page_name or "index")
|
||||
html = render_page(page_name)
|
||||
except PageNotFoundError:
|
||||
html = render_page("404")
|
||||
except webnotes.DoesNotExistError:
|
||||
if not page_name or page_name=="index":
|
||||
if page_name in ("index", "index.html"):
|
||||
html = render_page("login")
|
||||
else:
|
||||
html = render_page("404")
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
{% include "lib/website/doctype/website_slideshow/templates/includes/slideshow.html" %}
|
||||
<div class="web-page-content" id="{{ name }}">
|
||||
{{ main_section }}
|
||||
{{ main_section or "" }}
|
||||
</div>
|
||||
|
||||
{# toc, parent, child, next sibling #}
|
||||
|
|
@ -64,4 +64,4 @@ $(function() {
|
|||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ $.extend(wn, {
|
|||
wn.process_response(opts, data);
|
||||
},
|
||||
error: function(response) {
|
||||
NProgress.done();
|
||||
if(!opts.no_spinner) NProgress.done();
|
||||
console.error ? console.error(response) : console.log(response);
|
||||
}
|
||||
});
|
||||
|
|
@ -75,7 +75,9 @@ $.extend(wn, {
|
|||
}
|
||||
});
|
||||
|
||||
NProgress.start();
|
||||
if(!opts.no_spinner) {
|
||||
NProgress.start();
|
||||
}
|
||||
},
|
||||
process_response: function(opts, data) {
|
||||
NProgress.done();
|
||||
|
|
@ -158,6 +160,7 @@ $.extend(wn, {
|
|||
has_permission: function(doctype, docname, perm_type, callback) {
|
||||
return wn.call({
|
||||
method: "webnotes.client.has_permission",
|
||||
no_spinner: true,
|
||||
args: {doctype: doctype, docname: docname, perm_type: perm_type},
|
||||
callback: function(r) {
|
||||
if(!r.exc && r.message.has_permission) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue