[new-app] [minor] app pre-requisites and requirements fixes

This commit is contained in:
Rushabh Mehta 2015-02-13 10:12:53 +05:30
parent 572ed956a3
commit 494f8274ae
4 changed files with 27 additions and 10 deletions

View file

@ -10,7 +10,7 @@ class FrappeException(Exception):
class FrappeClient(object):
def __init__(self, url, username, password):
self.session = requests.Session()
self.session = requests.session()
self.url = url
self.login(username, password)
@ -47,6 +47,7 @@ class FrappeClient(object):
if limit_page_length:
params["limit_start"] = limit_start
params["limit_page_length"] = limit_page_length
print self.url
res = self.session.get(self.url + "/api/resource/" + doctype, params=params)
return self.post_process(res)

View file

@ -88,17 +88,23 @@ def make_connection(root_login, root_password):
return frappe.database.Database(user=root_login, password=root_password)
def install_app(name, verbose=False, set_as_patched=True):
frappe.flags.in_install = name
frappe.clear_cache()
app_hooks = frappe.get_hooks(app_name=name)
installed_apps = frappe.get_installed_apps()
# install pre-requisites
if app_hooks.required_apps:
for app in app_hooks.required_apps:
install_app(app)
print "Installing {0}...".format(name)
frappe.flags.in_install = name
frappe.clear_cache()
if name not in frappe.get_all_apps(with_frappe=True):
raise Exception("App not in apps.txt")
if name in installed_apps:
print "App Already Installed"
print "Already installed"
frappe.msgprint("App {0} already installed".format(name))
return

View file

@ -14,8 +14,11 @@ def make_boilerplate(dest, app_name):
hooks = frappe._dict()
hooks.app_name = app_name
app_title = hooks.app_name.replace("_", " ").title()
for key in ("App Title (defaut: {0})".format(app_title), "App Description", "App Publisher",
"App Icon (e.g. 'octicon octicon-zap')", "App Color", "App Email", "App License"):
for key in ("App Title (defaut: {0})".format(app_title),
"App Description", "App Publisher", "App Email",
"App Icon (default 'octicon octicon-file-directory')",
"App Color (default 'grey')",
"App License (default 'MIT')"):
hook_key = key.split(" (")[0].lower().replace(" ", "_")
hook_val = None
while not hook_val:
@ -23,8 +26,15 @@ def make_boilerplate(dest, app_name):
if hook_key=="app_name" and hook_val.lower().replace(" ", "_") != hook_val:
print "App Name must be all lowercase and without spaces"
hook_val = ""
elif hook_key=="app_title" and not hook_val:
hook_val = app_title
elif not hook_val:
defaults = {
"app_title": app_title,
"app_icon": "octicon octicon-file-directory",
"app_color": "grey",
"app_license": "MIT"
}
if hook_key in defaults:
hook_val = defaults[hook_key]
hooks[hook_key] = hook_val

View file

@ -17,7 +17,7 @@ termcolor
werkzeug
semantic_version
rauth>=0.6.2
requests==1.2.3
requests>=1.2.3
celery
redis
selenium