[minor] fixes for import conf
This commit is contained in:
parent
0eb811a518
commit
de8b6aadaf
@ -33,7 +33,7 @@ def update_profile(fullname, password=None, company_name=None, mobile_no=None, p
|
|||||||
return _("Name is required")
|
return _("Name is required")
|
||||||
|
|
||||||
webnotes.conn.set_value("Profile", webnotes.session.user, "first_name", fullname)
|
webnotes.conn.set_value("Profile", webnotes.session.user, "first_name", fullname)
|
||||||
webnotes.add_cookies["full_name"] = fullname
|
webnotes._response.set_cookie("full_name", fullname)
|
||||||
|
|
||||||
return _("Updated")
|
return _("Updated")
|
||||||
|
|
@ -12,8 +12,8 @@ class WebsitePriceListMissingError(webnotes.ValidationError): pass
|
|||||||
def set_cart_count(quotation=None):
|
def set_cart_count(quotation=None):
|
||||||
if not quotation:
|
if not quotation:
|
||||||
quotation = _get_cart_quotation()
|
quotation = _get_cart_quotation()
|
||||||
webnotes.add_cookies["cart_count"] = cstr(len(quotation.doclist.get(
|
cart_count = cstr(len(quotation.doclist.get({"parentfield": "quotation_details"})))
|
||||||
{"parentfield": "quotation_details"})) or "")
|
webnotes._response.set_cookie("cart_count", cart_count)
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_cart_quotation(doclist=None):
|
def get_cart_quotation(doclist=None):
|
||||||
@ -47,7 +47,7 @@ def place_order():
|
|||||||
sales_order.ignore_permissions = True
|
sales_order.ignore_permissions = True
|
||||||
sales_order.insert()
|
sales_order.insert()
|
||||||
sales_order.submit()
|
sales_order.submit()
|
||||||
webnotes.add_cookies["cart_count"] = ""
|
webnotes._response.set_cookie("cart_count", "")
|
||||||
|
|
||||||
return sales_order.doc.name
|
return sales_order.doc.name
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ def get_gdrive_flow():
|
|||||||
from oauth2client.client import OAuth2WebServerFlow
|
from oauth2client.client import OAuth2WebServerFlow
|
||||||
from webnotes import conf
|
from webnotes import conf
|
||||||
|
|
||||||
if not hasattr(conf, "gdrive_client_id"):
|
if not "gdrive_client_id" in conf:
|
||||||
webnotes.msgprint(_("Please set Google Drive access keys in") + " conf.py",
|
webnotes.msgprint(_("Please set Google Drive access keys in") + " conf.py",
|
||||||
raise_exception=True)
|
raise_exception=True)
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ def send():
|
|||||||
now_date = now_datetime().date()
|
now_date = now_datetime().date()
|
||||||
|
|
||||||
from webnotes import conf
|
from webnotes import conf
|
||||||
if hasattr(conf, "expires_on") and now_date > getdate(conf.expires_on):
|
if "expires_on" in conf and now_date > getdate(conf.expires_on):
|
||||||
# do not send email digests to expired accounts
|
# do not send email digests to expired accounts
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def boot_session(bootinfo):
|
|||||||
# load subscription info
|
# load subscription info
|
||||||
from webnotes import conf
|
from webnotes import conf
|
||||||
for key in ['max_users', 'expires_on', 'max_space', 'status', 'commercial_support']:
|
for key in ['max_users', 'expires_on', 'max_space', 'status', 'commercial_support']:
|
||||||
if hasattr(conf, key): bootinfo[key] = getattr(conf, key)
|
if key in conf: bootinfo[key] = conf.get(key)
|
||||||
|
|
||||||
bootinfo['docs'] += webnotes.conn.sql("""select name, default_currency, cost_center
|
bootinfo['docs'] += webnotes.conn.sql("""select name, default_currency, cost_center
|
||||||
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
|
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
|
||||||
|
@ -35,13 +35,13 @@ def on_login_post_session(login_manager):
|
|||||||
set_cart_count()
|
set_cart_count()
|
||||||
|
|
||||||
def on_logout(login_manager):
|
def on_logout(login_manager):
|
||||||
webnotes.add_cookies["cart_count"] = ""
|
webnotes._response.set_cookie("cart_count", "")
|
||||||
|
|
||||||
def check_if_expired():
|
def check_if_expired():
|
||||||
"""check if account is expired. If expired, do not allow login"""
|
"""check if account is expired. If expired, do not allow login"""
|
||||||
from webnotes import conf
|
from webnotes import conf
|
||||||
# check if expires_on is specified
|
# check if expires_on is specified
|
||||||
if not hasattr(conf, 'expires_on'): return
|
if not 'expires_on' in conf: return
|
||||||
|
|
||||||
# check if expired
|
# check if expired
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
|
@ -91,7 +91,7 @@ class DocType():
|
|||||||
raise_exception=1)
|
raise_exception=1)
|
||||||
|
|
||||||
from webnotes import conf
|
from webnotes import conf
|
||||||
if getattr(conf, "status", None) == "Trial":
|
if (conf.get("status") or None) == "Trial":
|
||||||
webnotes.msgprint(_("""Sending newsletters is not allowed for Trial users, \
|
webnotes.msgprint(_("""Sending newsletters is not allowed for Trial users, \
|
||||||
to prevent abuse of this feature."""), raise_exception=1)
|
to prevent abuse of this feature."""), raise_exception=1)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
def on_login(self):
|
def on_login(self):
|
||||||
from webnotes.utils import validate_email_add
|
from webnotes.utils import validate_email_add
|
||||||
from webnotes import conf
|
from webnotes import conf
|
||||||
if hasattr(conf, "demo_notify_url"):
|
if "demo_notify_url" in conf:
|
||||||
if webnotes.form_dict.lead_email and validate_email_add(webnotes.form_dict.lead_email):
|
if webnotes.form_dict.lead_email and validate_email_add(webnotes.form_dict.lead_email):
|
||||||
import requests
|
import requests
|
||||||
response = requests.post(conf.demo_notify_url, data={
|
response = requests.post(conf.demo_notify_url, data={
|
||||||
|
@ -36,11 +36,15 @@ def make(reset=False, simulate=True):
|
|||||||
|
|
||||||
if reset:
|
if reset:
|
||||||
setup()
|
setup()
|
||||||
|
else:
|
||||||
|
webnotes.connect()
|
||||||
|
|
||||||
if simulate:
|
if simulate:
|
||||||
_simulate()
|
_simulate()
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
install()
|
install()
|
||||||
|
webnotes.connect()
|
||||||
complete_setup()
|
complete_setup()
|
||||||
make_customers_suppliers_contacts()
|
make_customers_suppliers_contacts()
|
||||||
make_items()
|
make_items()
|
||||||
|
@ -5,9 +5,9 @@ if __name__=="__main__":
|
|||||||
import webnotes, os
|
import webnotes, os
|
||||||
import utilities.demo.make_demo
|
import utilities.demo.make_demo
|
||||||
|
|
||||||
def make_demo_app():
|
def make_demo_app(site=None):
|
||||||
webnotes.mute_emails = 1
|
webnotes.mute_emails = 1
|
||||||
webnotes.connect()
|
webnotes.connect(site)
|
||||||
utilities.demo.make_demo.make(reset=True, simulate=False)
|
utilities.demo.make_demo.make(reset=True, simulate=False)
|
||||||
# setup demo user etc so that the site it up faster, while the data loads
|
# setup demo user etc so that the site it up faster, while the data loads
|
||||||
make_demo_user()
|
make_demo_user()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user