コード例 #1
0
def serverInit():
    import Executables, CodeSources, MimeTypes, InitTags
    Executables.initTemplateMimeTypes()
    CodeSources.installIntoTraceback()
    MimeTypes.loadMimeTypes()
    InitTags.initTags()
    InitTags.initHiddenNamespace()
コード例 #2
0
ファイル: cfg.py プロジェクト: BackupTheBerlios/skunkweb-svn
def serverInit():
    import Executables, CodeSources, MimeTypes, InitTags
    Executables.initTemplateMimeTypes()
    CodeSources.installIntoTraceback()
    MimeTypes.loadMimeTypes()
    InitTags.initTags()
    InitTags.initHiddenNamespace()
コード例 #3
0
def _realRenderComponent( name, argDict, auxArgs, compType, srcModTime ):
    global topOfComponentStack
    DEBUG(COMPONENT, "_realRenderComponent")
    executable = Executables.getExecutable( name, compType, srcModTime )

    if compType == DT_INCLUDE and componentStack:
        namespace = componentStack[topOfComponentStack].namespace
    else:
        namespace = globalNamespace.copy()

    namespace = executable.mergeNamespaces( namespace, argDict, auxArgs )

    newFrame = ComponentStackFrame(name, namespace, executable, argDict,
                                   auxArgs, compType ) 

    #DEBUG(COMPONENT, "len stack = %d  top = %d" % (len(componentStack),
    #      topOfComponentStack))
    if len(componentStack) <= ( topOfComponentStack + 1):
        componentStack.append(newFrame)
    else:
        componentStack[topOfComponentStack+1:] = [newFrame]

    try:
        if DEBUGIT(COMPONENT_TIMES):
            beg = time.time()
        topOfComponentStack += 1
        out = executable.run()
    finally:
        topOfComponentStack -= 1
        if DEBUGIT(COMPONENT_TIMES):
            DEBUG(COMPONENT_TIMES, "execution of %s in %s" % (
                name, time.time() - beg))

    expiration = namespace.get('__expiration',
                               time.time()
                               + cfg.Configuration.defaultExpiryDuration )

    # normally this is equivalent to a pop, but if a component exception
    # was handled somewhere, we need to clean up the residual shit

    del componentStack[ topOfComponentStack+1 : ]
    
    if compType != DT_INCLUDE:
        #DEBUG(COMPONENT, 'clearing the namespace!!! %s %s' % (DT_INCLUDE, compType))
        namespace.clear()
        
    return out, expiration
コード例 #4
0
def _realRenderComponent(name, argDict, auxArgs, compType, srcModTime):
    global topOfComponentStack
    DEBUG(COMPONENT, "_realRenderComponent")
    executable = Executables.getExecutable(name, compType, srcModTime)

    if compType == DT_INCLUDE and componentStack:
        namespace = componentStack[topOfComponentStack].namespace
    else:
        namespace = globalNamespace.copy()

    namespace = executable.mergeNamespaces(namespace, argDict, auxArgs)

    newFrame = ComponentStackFrame(name, namespace, executable, argDict,
                                   auxArgs, compType)

    #DEBUG(COMPONENT, "len stack = %d  top = %d" % (len(componentStack),
    #      topOfComponentStack))
    if len(componentStack) <= (topOfComponentStack + 1):
        componentStack.append(newFrame)
    else:
        componentStack[topOfComponentStack + 1:] = [newFrame]

    try:
        if DEBUGIT(COMPONENT_TIMES):
            beg = time.time()
        topOfComponentStack += 1
        out = executable.run()
    finally:
        topOfComponentStack -= 1
        if DEBUGIT(COMPONENT_TIMES):
            DEBUG(COMPONENT_TIMES,
                  "execution of %s in %s" % (name, time.time() - beg))

    expiration = namespace.get(
        '__expiration',
        time.time() + cfg.Configuration.defaultExpiryDuration)

    # normally this is equivalent to a pop, but if a component exception
    # was handled somewhere, we need to clean up the residual shit

    del componentStack[topOfComponentStack + 1:]

    if compType != DT_INCLUDE:
        #DEBUG(COMPONENT, 'clearing the namespace!!! %s %s' % (DT_INCLUDE, compType))
        namespace.clear()

    return out, expiration