Merge branch 'wsgi' of github.com:webnotes/erpnext into wsgi

This commit is contained in:
Pratik Vyas 2013-09-25 12:40:16 +05:30
commit abf62eacca
10 changed files with 18 additions and 14 deletions

View File

@ -33,7 +33,7 @@ def update_profile(fullname, password=None, company_name=None, mobile_no=None, p
return _("Name is required")
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")

View File

@ -12,8 +12,8 @@ class WebsitePriceListMissingError(webnotes.ValidationError): pass
def set_cart_count(quotation=None):
if not quotation:
quotation = _get_cart_quotation()
webnotes.add_cookies["cart_count"] = cstr(len(quotation.doclist.get(
{"parentfield": "quotation_details"})) or "")
cart_count = cstr(len(quotation.doclist.get({"parentfield": "quotation_details"})))
webnotes._response.set_cookie("cart_count", cart_count)
@webnotes.whitelist()
def get_cart_quotation(doclist=None):
@ -47,7 +47,7 @@ def place_order():
sales_order.ignore_permissions = True
sales_order.insert()
sales_order.submit()
webnotes.add_cookies["cart_count"] = ""
webnotes._response.set_cookie("cart_count", "")
return sales_order.doc.name

View File

@ -115,7 +115,7 @@ def get_gdrive_flow():
from oauth2client.client import OAuth2WebServerFlow
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",
raise_exception=True)

View File

@ -458,7 +458,7 @@ def send():
now_date = now_datetime().date()
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
return

View File

@ -34,7 +34,7 @@ def boot_session(bootinfo):
# load subscription info
from webnotes import conf
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
from `tabCompany`""", as_dict=1, update={"doctype":":Company"})

View File

@ -35,13 +35,13 @@ def on_login_post_session(login_manager):
set_cart_count()
def on_logout(login_manager):
webnotes.add_cookies["cart_count"] = ""
webnotes._response.set_cookie("cart_count", "")
def check_if_expired():
"""check if account is expired. If expired, do not allow login"""
from webnotes import conf
# check if expires_on is specified
if not hasattr(conf, 'expires_on'): return
if not 'expires_on' in conf: return
# check if expired
from datetime import datetime, date

View File

@ -91,7 +91,7 @@ class DocType():
raise_exception=1)
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, \
to prevent abuse of this feature."""), raise_exception=1)

View File

@ -2,7 +2,7 @@
def on_login(self):
from webnotes.utils import validate_email_add
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):
import requests
response = requests.post(conf.demo_notify_url, data={

View File

@ -36,11 +36,15 @@ def make(reset=False, simulate=True):
if reset:
setup()
else:
webnotes.connect()
if simulate:
_simulate()
def setup():
install()
webnotes.connect()
complete_setup()
make_customers_suppliers_contacts()
make_items()

View File

@ -5,9 +5,9 @@ if __name__=="__main__":
import webnotes, os
import utilities.demo.make_demo
def make_demo_app():
def make_demo_app(site=None):
webnotes.mute_emails = 1
webnotes.connect()
webnotes.connect(site)
utilities.demo.make_demo.make(reset=True, simulate=False)
# setup demo user etc so that the site it up faster, while the data loads
make_demo_user()