ImpPySqlFunctions.py

From SemanticLab

Jump to: navigation, search
 import re
 import bibnew.bibliographystyle as bibliographystyle
 import bibnew.database as database
 
 bst = 'abbrv'
 fobj = open("pySqlFnc_"+bst+".py", "r")
 db = database.database() 
 
 bst = bibliographystyle.bibliographystyle(bst, db)
 bstName = bst.getName()
 bstId =bst.getId()
 sFnc = bibliographystyle.sfunction(bstId,db)
 sFnc.delFunction()
 
 
 fText=fobj.read()
 fText = fText.replace('\n','/n')
 fTextList = fText.split('#END')
 #print fText
 reName =  re.compile(r"(NAME)\s*=\s*'([\w\. ]+?)'\s*\/n[^\s]")
 reFBst =  re.compile(r"(FUNCTION_BST)\s*=\s*'([\w\. ]+?)'\s*\/n[^\s]")
 reFsql =  re.compile(r"(FUNCTION_SQL)\s*=\s*'([\w\. ]+?)'\s*\/n[^\s]")
 reFunction = re.compile(r"(def)(.+?)(\(FieldValue\).+)")
 
 action = 'compUserSQLPython' 
 for fncText in fTextList:
     NAME =
     FUNCTION_BST =
     FUNCTION_SQL =
     FUNCTION =
     FUNCTION_PYTHON=
 
     for f in reName.findall(fncText):
         NAME              =f[1]
     for f in reFBst.findall(fncText):
         FUNCTION_BST =f[1]
     for f in reFsql.findall(fncText):
         FUNCTION_SQL  =f[1] 
     for f in reFunction.findall(fncText):
        FUNCTION = f[1]
        FUNCTION_PYTHON = f[0]+f[1]+f[2]       
 
     if NAME !=:
         sFnc.insDB(NAME,  FUNCTION_BST, FUNCTION_SQL, FUNCTION_PYTHON, action, 0, FUNCTION)
 
 db.close()
 fobj.close
Personal tools