コード例 #1
0
ファイル: spyceConfig.py プロジェクト: arunsh-git/xbmc-fork
 def processConfigFile(self):
     # config file
     self.spyce_config = {}
     if not self.file:
         self.file = self.findConfigFile()
     if self.file:
         if not os.path.exists(self.file):
             raise spyceException.spyceNotFound(self.file)
         if not os.access(self.file, os.R_OK):
             raise spyceException.spyceForbidden(self.file)
         self.spyce_config = self.parseConfigFile()
コード例 #2
0
ファイル: spyceConfig.py プロジェクト: Avoidnf8/xbmc-fork
 def processConfigFile(self):
   # config file
   self.spyce_config = {}
   if not self.file:
     self.file = self.findConfigFile()
   if self.file:
     if not os.path.exists(self.file):
       raise spyceException.spyceNotFound(self.file)
     if not os.access(self.file, os.R_OK):
       raise spyceException.spyceForbidden(self.file)
     self.spyce_config = self.parseConfigFile()
コード例 #3
0
ファイル: template.py プロジェクト: arunsh-git/xbmc-fork
def cheetahGenerate(filename):
    # check permissions
    if not os.path.exists(filename):
        raise spyceException.spyceNotFound()
    if not os.access(filename, os.R_OK):
        raise spyceException.spyceForbidden()
    # read the template
    f = None
    try:
        f = open(filename, 'r')
        buf = f.read()
    finally:
        if f: f.close()
    # compile template, get timestamp
    mtime = os.path.getmtime(filename)
    from Cheetah.Compiler import Compiler
    code = Compiler(source=buf).__str__()
    dict = {}
    exec code in dict
    return mtime, dict['GenTemplate']
コード例 #4
0
ファイル: spyce.py プロジェクト: derobert/debianlink-xbmc
def spyceFileCacheGenerate(key):
  "Generate new Spyce wrapper (recompiles)."
  try: 
    filename, sig = key
  except:
    filename, sig = key, ''
  # ensure file exists and we have permissions
  if not os.path.exists(filename):
    raise spyceException.spyceNotFound(filename)
  if not os.access(filename, os.R_OK):
    raise spyceException.spyceForbidden(filename)
  # generate
  mtime = os.path.getmtime(filename)
  f = None
  try:
    f = open(filename)
    code = f.read()
  finally:
    if f: f.close()
  s = spyceCode(code, filename=filename, sig=sig)
  return mtime, s
コード例 #5
0
ファイル: spyce.py プロジェクト: arunsh-git/xbmc-fork
def spyceFileCacheGenerate(key):
  "Generate new Spyce wrapper (recompiles)."
  try: 
    filename, sig = key
  except:
    filename, sig = key, ''
  # ensure file exists and we have permissions
  if not os.path.exists(filename):
    raise spyceException.spyceNotFound(filename)
  if not os.access(filename, os.R_OK):
    raise spyceException.spyceForbidden(filename)
  # generate
  mtime = os.path.getmtime(filename)
  f = None
  try:
    f = open(filename)
    code = f.read()
  finally:
    if f: f.close()
  s = spyceCode(code, filename=filename, sig=sig)
  return mtime, s
コード例 #6
0
def cheetahGenerate(filename):
    # check permissions
    if not os.path.exists(filename):
        raise spyceException.spyceNotFound()
    if not os.access(filename, os.R_OK):
        raise spyceException.spyceForbidden()
    # read the template
    f = None
    try:
        f = open(filename, "r")
        buf = f.read()
    finally:
        if f:
            f.close()
    # compile template, get timestamp
    mtime = os.path.getmtime(filename)
    from Cheetah.Compiler import Compiler

    code = Compiler(source=buf).__str__()
    dict = {}
    exec code in dict
    return mtime, dict["GenTemplate"]