diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..117b892b34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +*.comp.js +*.DS_Store diff --git a/cgi-bin/core/doctype/search_criteria/search_criteria.py b/cgi-bin/core/doctype/search_criteria/search_criteria.py index 2acbc16c3b..b9b5d3c84c 100644 --- a/cgi-bin/core/doctype/search_criteria/search_criteria.py +++ b/cgi-bin/core/doctype/search_criteria/search_criteria.py @@ -26,6 +26,9 @@ class DocType: doctype_module = sql("select module from tabDocType where name = '%s'" % (self.doc.doc_type)) webnotes.conn.set(self.doc,'module',doctype_module and doctype_module[0][0] or 'NULL') + def validate(self): + sql("select name from `tabSearch Criteria` where criteria_name=%s and name!=%s", (self.doc.criteria_name, self.doc.name)) + def on_update(self): self.set_module() self.export_doc() diff --git a/cgi-bin/webnotes/install_lib/install.py b/cgi-bin/webnotes/install_lib/install.py index 5612f36ce2..c801f4720f 100755 --- a/cgi-bin/webnotes/install_lib/install.py +++ b/cgi-bin/webnotes/install_lib/install.py @@ -57,6 +57,10 @@ class Installer: import_module('core') + def create_users(self): + """ + Create Administrator / Guest + """ webnotes.conn.begin() from webnotes.model.doc import Document @@ -96,10 +100,6 @@ class Installer: a very simplified version, just for the time being..will eventually be deprecated once the framework stabilizes. """ - # get the path of the sql file to import - if not source_path: - source_path = os.path.join(os.path.sep.join(os.path.abspath(webnotes.__file__).split(os.path.sep)[:-3]), 'data', 'Framework.sql') - # delete user (if exists) self.dbman.delete_user(target) @@ -122,10 +122,20 @@ class Installer: # import in target if verbose: print "Starting database import..." + + # get the path of the sql file to import + source_given = True + if not source_path: + source_given = False + source_path = os.path.join(os.path.sep.join(os.path.abspath(webnotes.__file__).split(os.path.sep)[:-3]), 'data', 'Framework.sql') + self.dbman.restore_database(target, source_path, self.root_password) if verbose: print "Imported from database %s" % source_path - self.import_core_module() + if not source_given: + if verbose: print "Importing core module..." + self.import_core_module() + self.create_users() # framework cleanups self.framework_cleanups(target)