Exemplo n.º 1
0
def serverInit():
    import Executables, CodeSources, MimeTypes, InitTags
    Executables.initTemplateMimeTypes()
    CodeSources.installIntoTraceback()
    MimeTypes.loadMimeTypes()
    InitTags.initTags()
    InitTags.initHiddenNamespace()
Exemplo n.º 2
0
def serverInit():
    import Executables, CodeSources, MimeTypes, InitTags
    Executables.initTemplateMimeTypes()
    CodeSources.installIntoTraceback()
    MimeTypes.loadMimeTypes()
    InitTags.initTags()
    InitTags.initHiddenNamespace()
Exemplo n.º 3
0
    def main(self):
        print "websiteMinimal.handler"
        filename = sanitizePath(self.request["raw-uri"])
        #if os.path.isdir(homedirectory + filename):
        #    if filename[-1:] != "/": filename += "/"
        #    if os.path.isfile(homedirectory + filename + indexfilename):
        #        filename += indexfilename
        #    else:
        #        yield websiteListFilesPage(filename)
        #        return

        filetype = MimeTypes.workoutMimeType(filename)

        error = None
        try:
            if os.path.exists(homedirectory +
                              filename) and not os.path.isdir(homedirectory +
                                                              filename):
                resource = {
                    "type": filetype,
                    "statuscode": "200",
                    #"length" : os.path.getsize(homedirectory + filename)
                }
                self.send(resource, "outbox")
            else:
                print "Error 404, is not file - " + homedirectory + filename
                error = 404

        except OSError, e:
            error = 404
Exemplo n.º 4
0
 def main(self):
     print "websiteMinimal.handler"
     filename = sanitizePath(self.request["raw-uri"])
     #if os.path.isdir(homedirectory + filename):
     #    if filename[-1:] != "/": filename += "/"
     #    if os.path.isfile(homedirectory + filename + indexfilename):
     #        filename += indexfilename
     #    else:
     #        yield websiteListFilesPage(filename)
     #        return
      
     filetype = MimeTypes.workoutMimeType(filename)
     
     error = None
     try:
         if os.path.exists(homedirectory + filename) and not os.path.isdir(homedirectory + filename):
             resource = {
                 "type"           : filetype,
                 "statuscode"     : "200",
                 #"length" : os.path.getsize(homedirectory + filename) 
             }
             self.send(resource, "outbox")
         else:
             print "Error 404, is not file - " + homedirectory + filename
             error = 404
             
     except OSError, e:
         error = 404
Exemplo n.º 5
0
def getExecutable(name, compType, srcModTime):
    mimeType = MimeTypes.getMimeType(name)
    try:

        if executableByTypes.has_key((mimeType, compType)):
            exe = executableByTypes[mimeType, compType]
        elif mimeType in cfg.Configuration.templateMimeTypes:
            exe = STMLExecutable
        else:
            raise KeyError, (mimeType, compType)

    except KeyError, val:
        raise SkunkStandardError, \
              "No executable form for %s servicing %s (%s)" % (
                  mimeType, name, {
                      DT_INCLUDE:"INCLUDE",
                      DT_REGULAR:"REGULAR",
                      DT_DATA:"DATA"
                      }[compType])
Exemplo n.º 6
0
def getExecutable( name, compType, srcModTime ):
    mimeType = MimeTypes.getMimeType( name )
    try:
        
        if executableByTypes.has_key((mimeType, compType)):
            exe = executableByTypes[mimeType, compType]
        elif mimeType in cfg.Configuration.templateMimeTypes:
            exe = STMLExecutable
        else:
            raise KeyError, (mimeType, compType)

    except KeyError, val:
        raise SkunkStandardError, \
              "No executable form for %s servicing %s (%s)" % (
                  mimeType, name, {
                      DT_INCLUDE:"INCLUDE",
                      DT_REGULAR:"REGULAR",
                      DT_DATA:"DATA"
                      }[compType])
Exemplo n.º 7
0
#
#  Copyright (C) 2001 Andrew T. Csillag <*****@*****.**>
#
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#
import sys
sys.path.append('/home/drew/devel/skunk/pylibs')
import Component
Component.globalNamespace['Component'] = Component

import MimeTypes
MimeTypes.loadMimeTypes()

sys.stderr = sys.__stderr__

import Error

try:
    print Component.callComponent('foo.html', {}, cache=1)
except:
    print "an error occurred"
    print Error.logException()

print Component.postRequestRenderList
Exemplo n.º 8
0
#  
#  Copyright (C) 2001 Andrew T. Csillag <*****@*****.**>
#  
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#   
import sys
sys.path.append('/home/drew/devel/skunk/pylibs')
import Component
Component.globalNamespace['Component'] = Component

import MimeTypes
MimeTypes.loadMimeTypes()

sys.stderr = sys.__stderr__

import Error

try:
    print Component.callComponent('foo.html', {}, cache=1)
except:
    print "an error occurred"
    print Error.logException()

print Component.postRequestRenderList