[minor] start file watcher only in developer mode

This commit is contained in:
Rushabh Mehta 2017-05-09 18:03:59 +05:30
parent c0ac513244
commit 974559cef1
3 changed files with 18 additions and 10 deletions

View file

@ -868,5 +868,5 @@ def extract_mentions(txt):
def handle_password_test_fail(result):
suggestions = result['feedback']['suggestions'][0] if result['feedback']['suggestions'] else ''
warning = result['feedback']['warning'] if 'warning' in result['feedback'] else ''
suggestions += _("{0} Hint : Include Underscores, Numbers and Capital Letters in the password {0} Example : Eastern_43A1W").format("<br/>")
suggestions += "<br>" + _("Hint: Include symbols, numbers and capital letters in the password") + '<br>'
frappe.throw(_('Invalid Password: ' + ' '.join([warning, suggestions])))

View file

@ -196,16 +196,18 @@ frappe.socket = {
},
setup_file_watchers: function() {
var host = window.location.origin;
if(window.dev_server) {
var port = '6787';
var parts = host.split(":");
// remove the port number from string if exists
if (parts.length > 2) {
host = host.split(':').slice(0, -1).join(":");
}
host = host + ':' + port;
if(!window.dev_server) {
return;
}
var port = '6787';
var parts = host.split(":");
// remove the port number from string if exists
if (parts.length > 2) {
host = host.split(':').slice(0, -1).join(":");
}
host = host + ':' + port;
frappe.socket.file_watcher = io.connect(host);
// css files auto reload
frappe.socket.file_watcher.on('reload_css', function(filename) {

View file

@ -40,7 +40,13 @@ class WebsiteGenerator(Document):
self.route = self.route.strip('/.')[:139]
def make_route(self):
return self.scrubbed_title()
'''Returns the default route. If `route` is specified in DocType it will be
route/title'''
from_title = self.scrubbed_title()
if self.meta.route:
return self.meta.route + '/' + from_title
else:
return from_title
def scrubbed_title(self):
return self.scrub(self.get(self.get_title_field()))