# Application.config file for Webware for Python

# The password for the Admin context:
AdminPassword = ''  # you cannot log in with an empty password

PrintConfigAtStartUp = True

# Servlets to be used as directory index in search order:
DirectoryFile = [
    'index', 'Index', 'main', 'Main'
    ]
# The following extensions will be ignored:
ExtensionsToIgnore = set([
    '.pyc', '.pyo', '.tmpl', '.bak', '.py_bak',
    '.py~', '.psp~', '.kid~', '.html~', '.tmpl~'
    ])
# If specified, only extensions in this list will be served:
ExtensionsToServe = []  # no limitation
UseCascadingExtensions = True
ExtensionCascadeOrder = ['.py', '.psp', '.kid', '.html']
# The following extensions are used for PSP files:
ExtensionsForPSP = ['.psp']
# The following extensions are used for Kid templates:
ExtensionsForKid = ['.kid']
# Files matching these patterns will be ignored:
FilesToHide = set([
    '.*', '*~', '*.bak', '*.py_bak', '*.tmpl',
    '*.pyc', '*.pyo', '__init__.*', '*.config'
    ])
# If specified, only files matching these patterns will be served:
FilesToServe = []  # no limitation

LogActivity = False
ActivityLogFilename = 'Logs/Activity.csv'
ActivityLogColumns = [
    'request.remoteAddress', 'request.method', 'request.uri',
    'response.size', 'servlet.name', 'request.timeStamp',
    'transaction.duration', 'transaction.errorOccurred'
    ]

Contexts = {}
Contexts['Docs'] = WebwarePath + '/Docs'
Contexts['WebKit/Docs'] = WebKitPath + '/Docs'
Contexts['Examples'] = WebKitPath + '/Examples'
Contexts['Admin'] = WebKitPath + '/Admin'
Contexts['MKBrowser'] = WebwarePath + '/MiddleKit/WebBrowser'
Contexts['Testing'] = WebKitPath + '/Testing'
Contexts['default'] = 'Examples'

# Sessions:
SessionStore = 'Dynamic'  # can be File, Dynamic, Memcached, Memory, Redis or Shelve
SessionStoreDir = 'Sessions'
SessionTimeout = 60  # minutes
SessionPrefix = None  # no prefix for session IDs
SessionName = '_SID_'  # name of the field holding the session ID
# Maximum number of sessions in memory:
MaxDynamicMemorySessions = 10000
# Time in minutes when to move sessions from memory to disk:
DynamicSessionTimeout = 15
# Set to False if sessions should be saved only when dirty:
AlwaysSaveSessions = True
# The session ID can be prefixed with "hostname" or any other string:
SessionPrefix = None  # no prefix to session ID
IgnoreInvalidSession = True
UseAutomaticPathSessions = False
UseCookieSessions = True
# If you rewrite the URL, you may need to specify this explicitly:
SessionCookiePath = None  # the servlet path is used if not specified
SecureSessionCookie = True  # use a secure cookie for HTTPS connections

# Set this to True to allow extra path info to be attached to URLs
ExtraPathInfo = False  # no extra path info

# Caching:
CacheServletClasses = True  # set to False for debugging
CacheServletInstances = True  # set to False for debugging
ReloadServletClasses = True  # set to True for quick and dirty reloading
# Directory for storing compiled PSP and Kid templates:
CacheDir = 'Cache'
# Set to True to clear the PSP cache on disk when the AppServer starts:
ClearPSPCacheOnStart = False
# The encoding for PSP files and compiled PSP servlets in the cache:
PSPFileEncoding = 'utf-8'
# The default output method for Kid. Some possible values are:
# html, html-strict, xhtml, xhtml-strict, xml
KidOutputMethod = 'html'
# The default output format for Kid. Some possible values are:
# default, compact, newlines, pretty, wrap, nice, ugly, named
KidOutputFormat = 'default'
# Set to False if you do not want compiled Kid templates to be cached on disk:
CacheKidTemplates = True
# Set to True if you want to use a separate KidKit file cache for the servlets,
# otherwise let Kid cache the compiled modules along with the templates.
UseKidKitCache = False
# The following two options are only applicable if the separate cache is used.
# Set to True if you want to store the source in the cache directory as well:
CacheKidSource = False
# Set to True to clear the Kid cache on disk when the AppServer starts:
ClearKidCacheOnStart = False

# Error handling:
ShowDebugInfoOnErrors = True
EnterDebuggerOnException = False
IncludeEditLink = True
IncludeFancyTraceback = False
FancyTracebackContext = 5
UserErrorMessage = '''
The site is having technical difficulties with this page. An error has
been logged, and the problem will be fixed as soon as possible. Sorry!
'''
LogErrors = True
ErrorLogFilename = 'Logs/Errors.csv'
SaveErrorMessages = True
ErrorMessagesDir = 'ErrorMsgs'
# Enable Error-Emails:
EmailErrors = False
# Be sure to review the following settings when enabling error e-mails:
ErrorEmailServer = 'localhost'
EmailErrorReportAsAttachment = False
ErrorEmailHeaders = {
    'From': 'webware@mydomain',
    'To': ['webware@mydomain'],
    'Reply-To': 'webware@mydomain',
    'Content-Type': 'text/html',
    'Subject': '[WebKit Error]',
    }
ErrorPage = None  # read the documentation on how to create custom error pages
MaxValueLengthInExceptionReport = 500
RPCExceptionReturn = 'traceback'  # can be occurred, exception or traceback
# Set to False if you don't want to have exceptions in RPC servlets be reported
# in the logs and/or by email:
ReportRPCExceptionsInWebKit = True

UnknownFileTypes = {
    'ReuseServlets': True,
    'Technique': 'serveContent',  # can be serveContent or redirectSansAdapter
    'CacheContent': False,
    'MaxCacheContentSize': 128*1024,
    'ReadBufferSize': 32*1024
    }
