Package: bricks.tools
makesite.py -d "adapter='sqlite', database='data.db'" C:/test2/public C:/test2/private2

API Reference

Modules

Module Attributes

__file__ = 'C:\\Documents and Settings\\James\\Desktop\\PythonWeb\\bricks\\bricks\\tools\\__init__.pyc'

__name__ = 'bricks.tools'

__path__ = ['C:\\Documents and Settings\\James\\Desktop\\PythonWeb\\bricks\\bricks\\tools']

name = 'BrickServer'

version = '1.0'

Classes

class CreateSite
def __init__(self, options)
[show source]
C:\Documents and Settings\James\Desktop\PythonWeb\bricks\bricks\tools\__init__.py

   11: def __init__(self, options):
   12:     self.options = options

def copytree(self, src, dst)
[show source]
C:\Documents and Settings\James\Desktop\PythonWeb\bricks\bricks\tools\__init__.py

   14: def copytree(self, src, dst):#, symlinks=0):
   15:     dst = dst.replace('\\','/')
   16:     if dst[-1] != '/':
   17:         dst+= '/'
   18: 
   19: 
   20:     import sys
   21:     from pkg_resources import resource_listdir, resource_isdir, resource_string, require
   22:     require("bricks==0.6.0")
   23:     #name = "bricks"
   24: 
   25:        # print confname
   26: 
   27: 
   28: 
   29:     #try:
   30:     ##    from pkg_resources import resource_string, list_resources
   31:     #    import pkg_resources
   32:     #except ImportError: # XXX Quick hack to copy from dir structure if not using an egg
   33:     #names = os.listdir(src)
   34:     src = src.replace('\\','/')
   35:     names = resource_listdir('bricks', 'skeleton/'+src)
   36:     #raise Exception(names)
   37:     if not os.path.exists(dst):
   38:         os.mkdir(dst)
   39:     for name in names:
   40:         srcname = '/'.join([src, name]).replace('//','/')
   41:         dstname = '/'.join([dst, name]).replace('//','/')
   42:        # try:
   43:         #if symlinks and os.path.islink(srcname):
   44:         #    linkto = os.readlink(srcname)
   45:         #    os.symlink(linkto, dstname)
   46:         if resource_isdir('bricks', 'skeleton/'+srcname):
   47:             self.copytree(srcname, dstname)#, symlinks)
   48:         else:
   49:             if dstname[-5:] == '.tmpl':
   50:                 print 'Creating %s'%dstname[:-5]
   51:                 if os.path.exists(dstname):
   52:                     raise IOError('File %s already exists'%dstname)
   53:                 #fp = open(srcname)
   54:                 #template = fp.read()
   55:                 #fp.close()
   56: 
   57:                 template = resource_string("bricks", 'skeleton/'+srcname)
   58:                 fp = open(dstname[:-5],'wb')
   59:                 fp.write(
   60:                     web.template.parse(
   61:                         type='cheetah',
   62:                         template=template,
   63:                         dict=self.options
   64:                     )
   65:                 )
   66:                 fp.close()
   67:             else:
   68:                 print 'Creating %s'%dstname
   69:                 if os.path.exists(dstname):
   70:                     raise IOError('File %s already exists'%dstname)
   71:                 fp = open(dstname,'wb')
   72:                 fp.write(resource_string("bricks", 'skeleton/'+srcname))
   73:                 fp.close()