本文整理汇总了Python中webnotes.destroy函数的典型用法代码示例。如果您正苦于以下问题:Python destroy函数的具体用法?Python destroy怎么用?Python destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_admin_password
def set_admin_password(admin_password, site=None):
import webnotes
webnotes.connect(site=site)
webnotes.conn.sql("""update __Auth set `password`=password(%s)
where user='Administrator'""", (admin_password,))
webnotes.conn.commit()
webnotes.destroy()
示例2: clear_web
def clear_web(site=None):
import webnotes.webutils
webnotes.connect(site=site)
from website.doctype.website_sitemap_config.website_sitemap_config import build_website_sitemap_config
build_website_sitemap_config()
webnotes.webutils.clear_cache()
webnotes.destroy()
示例3: patch
def patch(patch_module, site=None, force=False):
import webnotes.modules.patch_handler
webnotes.connect(site=site)
webnotes.local.patch_log_list = []
webnotes.modules.patch_handler.run_single(patch_module, force=force)
print "\n".join(webnotes.local.patch_log_list)
webnotes.destroy()
示例4: mysql
def mysql(site=None):
import webnotes
import commands, os
msq = commands.getoutput('which mysql')
webnotes.init(site=site)
os.execv(msq, [msq, '-u', webnotes.conf.db_name, '-p'+webnotes.conf.db_password, webnotes.conf.db_name, '-h', webnotes.conf.db_host or "localhost", "-A"])
webnotes.destroy()
示例5: make_conf
def make_conf(db_name=None, db_password=None, site=None, site_config=None):
try:
from werkzeug.exceptions import NotFound
import conf
try:
webnotes.init(site=site)
except NotFound:
pass
if not site and webnotes.conf.site:
site = webnotes.conf.site
if site:
# conf exists and site is specified, create site_config.json
make_site_config(site, db_name, db_password, site_config)
elif os.path.exists("conf.py"):
print "conf.py exists"
else:
# pyc file exists but py doesn't
raise ImportError
except ImportError:
if site:
raise Exception("conf.py does not exist")
else:
# create conf.py
with open(os.path.join("lib", "conf", "conf.py"), "r") as confsrc:
with open("conf.py", "w") as conftar:
conftar.write(confsrc.read() % get_conf_params(db_name, db_password))
webnotes.destroy()
webnotes.init(site=site)
示例6: request
def request(args):
import webnotes.handler
webnotes.connect()
webnotes.form_dict = webnotes._dict([a.split("=") for a in args.split("&")])
webnotes.handler.execute_cmd(webnotes.form_dict.cmd)
print webnotes.response
webnotes.destroy()
示例7: reset_perms
def reset_perms(site=None):
webnotes.connect(site=site)
for d in webnotes.conn.sql_list("""select name from `tabDocType`
where ifnull(istable, 0)=0 and ifnull(custom, 0)=0"""):
webnotes.clear_cache(doctype=d)
webnotes.reset_perms(d)
webnotes.destroy()
示例8: domain
def domain(host_url=None, site=None):
webnotes.connect(site=site)
if host_url:
webnotes.conn.set_value("Website Settings", None, "subdomain", host_url)
webnotes.conn.commit()
else:
print webnotes.conn.get_value("Website Settings", None, "subdomain")
webnotes.destroy()
示例9: run_scheduler
def run_scheduler():
from webnotes.utils.file_lock import create_lock, delete_lock
import webnotes.utils.scheduler
if create_lock('scheduler'):
webnotes.connect()
print webnotes.utils.scheduler.execute()
delete_lock('scheduler')
webnotes.destroy()
示例10: run_scheduler
def run_scheduler(site=None):
from webnotes.utils.file_lock import create_lock, delete_lock
import webnotes.utils.scheduler
webnotes.init(site=site)
if create_lock('scheduler'):
webnotes.connect(site=site)
print webnotes.utils.scheduler.execute()
delete_lock('scheduler')
webnotes.destroy()
示例11: python
def python(site):
import webnotes
import commands, os
python = commands.getoutput('which python')
if site:
os.environ["site"] = site
os.environ["PYTHONSTARTUP"] = os.path.join(os.path.dirname(webnotes.__file__), "pythonrc.py")
os.execv(python, [python])
webnotes.destroy()
示例12: install
def install(db_name, root_login="root", root_password=None, source_sql=None,
admin_password = 'admin', verbose=True, force=False, site_config=None, reinstall=False):
print db_name, source_sql
from webnotes.installer import install_db, install_app, make_site_dirs
install_db(root_login=root_login, root_password=root_password, db_name=db_name, source_sql=source_sql,
admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall)
make_site_dirs()
install_app("webnotes", verbose=verbose)
webnotes.destroy()
示例13: get_remote_and_branch
def get_remote_and_branch(remote=None, branch=None):
if not (remote and branch):
if not webnotes.conf.branch:
raise Exception("Please specify remote and branch")
remote = remote or "origin"
branch = branch or webnotes.conf.branch
webnotes.destroy()
return remote, branch
示例14: backup
def backup(site=None, with_files=False, verbose=True, backup_path_db=None, backup_path_files=None):
from webnotes.utils.backups import scheduled_backup
webnotes.connect(site=site)
odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files)
if verbose:
from webnotes.utils import now
print "database backup taken -", odb.backup_path_db, "- on", now()
if with_files:
print "files backup taken -", odb.backup_path_files, "- on", now()
webnotes.destroy()
return odb
示例15: update_site_config
def update_site_config(site_config, verbose=False):
import json
if isinstance(site_config, basestring):
site_config = json.loads(site_config)
config = webnotes.get_site_config()
config.update(site_config)
site_config_path = os.path.join(webnotes.local.site_path, "site_config.json")
with open(site_config_path, "w") as f:
json.dump(config, f, indent=1, sort_keys=True)
webnotes.destroy()