[cli] search frappe, fix bench execute

This commit is contained in:
Rushabh Mehta 2015-03-03 17:05:13 +05:30
parent 2b0a3d8a14
commit 0dc8632063
4 changed files with 10 additions and 7 deletions

View file

@ -349,12 +349,14 @@ def reset_perms(context):
frappe.destroy()
@click.command('execute')
@click.argument('method')
@pass_context
def execute(context):
def execute(context, method):
"execute a function"
for site in context.sites:
try:
frappe.init(site=site)
frappe.connect()
ret = frappe.get_attr(method)()
if frappe.db:

View file

@ -52,7 +52,7 @@ def get_data():
"type": "module"
},
"Installer": {
"color": "#888",
"color": "#5ac8fb",
"icon": "icon-download",
"icon": "octicon octicon-cloud-download",
"link": "applications",

View file

@ -1,5 +1,5 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
@ -9,9 +9,10 @@ Model utilities, unclassified functions
"""
def set_default(doc, key):
"""Set is_default property of given doc and unset all others filtered by given key."""
if not doc.is_default:
frappe.db.set(doc, "is_default", 1)
frappe.db.sql("""update `tab%s` set `is_default`=0
where `%s`=%s and name!=%s""" % (doc.doctype, key, "%s", "%s"),
where `%s`=%s and name!=%s""" % (doc.doctype, key, "%s", "%s"),
(doc.get(key), doc.name))

View file

@ -14,7 +14,7 @@ def main():
def get_app_groups():
ret = {}
for app in get_apps():
for app in ["frappe"]: #get_apps():
app_group = get_app_group(app)
if app_group:
ret[app] = app_group
@ -55,7 +55,7 @@ def get_app_commands(app):
app_command_module = importlib.import_module(app + '.commands')
except ImportError:
return []
ret = {}
for command in getattr(app_command_module, 'commands', []):
ret[command.name] = command