Quellcode durchsuchen

validate criteria name

version-14
Rushabh Mehta vor 14 Jahren
Ursprung
Commit
923a1e5447
3 geänderte Dateien mit 21 neuen und 5 gelöschten Zeilen
  1. +3
    -0
      .gitignore
  2. +3
    -0
      cgi-bin/core/doctype/search_criteria/search_criteria.py
  3. +15
    -5
      cgi-bin/webnotes/install_lib/install.py

+ 3
- 0
.gitignore Datei anzeigen

@@ -0,0 +1,3 @@
*.pyc
*.comp.js
*.DS_Store

+ 3
- 0
cgi-bin/core/doctype/search_criteria/search_criteria.py Datei anzeigen

@@ -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()


+ 15
- 5
cgi-bin/webnotes/install_lib/install.py Datei anzeigen

@@ -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)


Laden…
Abbrechen
Speichern