Fxed conflict

This commit is contained in:
Nabin Hait 2014-01-31 17:01:20 +05:30
commit bb7fcc30a3
6 changed files with 66 additions and 17 deletions

40
config.json Normal file
View file

@ -0,0 +1,40 @@
{
"base_template": "lib/website/templates/base.html",
"framework_version": "3.9.0",
"modules": {
"Calendar": {
"color": "#2980b9",
"icon": "icon-calendar",
"label": "Calendar",
"link": "Calendar/Event",
"type": "view"
},
"Finder": {
"color": "#14C7DE",
"icon": "icon-folder-open",
"label": "Finder",
"link": "finder",
"type": "page"
},
"Messages": {
"color": "#9b59b6",
"icon": "icon-comments",
"label": "Messages",
"link": "messages",
"type": "page"
},
"To Do": {
"color": "#f1c40f",
"icon": "icon-check",
"label": "To Do",
"link": "todo",
"type": "page"
},
"Website": {
"color": "#16a085",
"icon": "icon-globe",
"link": "website-home",
"type": "module"
}
}
}

View file

@ -389,7 +389,7 @@ $.extend(_p, {
lh = cstr(wn.boot.letter_heads[cur_frm.doc.letter_head]);
} else if (cp.letter_head) {
lh = cp.letter_head;
}
}
return lh;
},

View file

@ -5,9 +5,11 @@
from __future__ import unicode_literals
from werkzeug.test import Client
import os
import re
import urllib
import webnotes
import os
no_value_fields = ['Section Break', 'Column Break', 'HTML', 'Table', 'FlexTable',
'Button', 'Image', 'Graph']
@ -64,7 +66,6 @@ def extract_email_id(email):
def validate_email_add(email_str):
"""Validates the email string"""
email = extract_email_id(email_str)
import re
return re.match("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", email.lower())
def get_request_site_address(full_address=False):
@ -277,7 +278,6 @@ def dict_to_str(args, sep='&'):
"""
Converts a dictionary to URL
"""
import urllib
t = []
for k in args.keys():
t.append(str(k)+'='+urllib.quote(str(args[k] or '')))
@ -670,7 +670,6 @@ def strip_html(text):
"""
removes anything enclosed in and including <>
"""
import re
return re.compile(r'<.*?>').sub('', text)
def escape_html(text):
@ -831,7 +830,6 @@ def get_url(uri=None):
url = "http://" + subdomain
if uri:
import urllib
url = urllib.basejoin(url, uri)
return url
@ -896,14 +894,26 @@ def get_disk_usage():
return 0
err, out = execute_in_shell("du -hsm {files_path}".format(files_path=files_path))
return cint(out.split("\n")[-2].split("\t")[0])
def expand_partial_links(html):
import re
def scrub_urls(html):
html = expand_relative_urls(html)
html = quote_urls(html)
return html
def expand_relative_urls(html):
# expand relative urls
url = get_url()
if not url.endswith("/"): url += "/"
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)/*((?!http)[^\'" >]+)([\'"]?)',
'\g<1>\g<2>{}\g<3>\g<4>'.format(url),
html)
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?!http)[^\'" >]+)([\'"]?)',
'\g<1>\g<2>{}\g<3>\g<4>'.format(url), html)
def quote_urls(html):
def _quote_url(match):
groups = list(match.groups())
groups[2] = urllib.quote(groups[2], safe="/:")
return "".join(groups)
return re.sub('(href|src){1}([\s]*=[\s]*[\'"]?)((?:http)[^\'">]+)([\'"]?)',
_quote_url, html)
def touch_file(path):
with open(path, 'a'):
@ -912,4 +922,4 @@ def touch_file(path):
def get_test_client():
from webnotes.app import application
return Client(application)
return Client(application)

View file

@ -8,7 +8,7 @@ import urllib
from webnotes.utils.email_lib.smtp import SMTPServer, send
from webnotes.utils.email_lib.email_body import get_email, get_formatted_html
from webnotes.utils.email_lib.html2text import html2text
from webnotes.utils import cint, get_url, expand_partial_links, nowdate
from webnotes.utils import cint, get_url, nowdate
class BulkLimitCrossedError(webnotes.ValidationError): pass

View file

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import webnotes
from webnotes.utils import expand_partial_links
from webnotes.utils import scrub_urls
import email.utils
from inlinestyler.utils import inline_css
@ -193,7 +193,7 @@ class EMail:
return self.msg_root.as_string()
def get_formatted_html(subject, message, footer=None):
message = expand_partial_links(message)
message = scrub_urls(message)
return inline_css(webnotes.get_template("templates/emails/standard.html").render({
"content": message,

View file

@ -14,7 +14,6 @@ def send(email, as_bulk=False):
webnotes.msgprint("Emails are muted")
return
try:
smtpserver = SMTPServer()
if hasattr(smtpserver, "always_use_login_id_as_sender") and \