|
39 | 39 |
|
40 | 40 | debug = False
|
41 | 41 |
|
42 |
| -defaultConfig = dict( |
43 |
| - ActivityLogFilename='Activity.csv', |
44 |
| - ActivityLogColumns=[ |
| 42 | +defaultConfig = { |
| 43 | + 'ActivityLogFilename': 'Activity.csv', |
| 44 | + 'ActivityLogColumns': [ |
45 | 45 | 'request.remoteAddress', 'request.method',
|
46 | 46 | 'request.uri', 'response.size',
|
47 | 47 | 'servlet.name', 'request.timeStamp',
|
48 |
| - 'transaction.duration', |
49 |
| - 'transaction.errorOccurred' |
| 48 | + 'transaction.duration', 'transaction.errorOccurred' |
50 | 49 | ],
|
51 |
| - AlwaysSaveSessions=True, |
52 |
| - AppLogFilename='Application.log', |
53 |
| - CacheDir='Cache', |
54 |
| - CacheServletClasses=True, |
55 |
| - CacheServletInstances=True, |
56 |
| - CheckInterval=None, |
57 |
| - Contexts={ |
| 50 | + 'AlwaysSaveSessions': True, |
| 51 | + 'AppLogFilename': 'Application.log', |
| 52 | + 'CacheDir': 'Cache', |
| 53 | + 'CacheServletClasses': True, |
| 54 | + 'CacheServletInstances': True, |
| 55 | + 'CheckInterval': None, |
| 56 | + 'Contexts': { |
58 | 57 | 'default': 'Examples',
|
59 | 58 | 'Admin': 'Admin',
|
60 | 59 | 'Examples': 'Examples',
|
61 | 60 | 'Testing': 'Testing',
|
62 | 61 | },
|
63 |
| - Debug=dict( |
64 |
| - Sessions=False, |
65 |
| - ), |
66 |
| - DirectoryFile=['index', 'Index', 'main', 'Main'], |
67 |
| - EnterDebuggerOnException=False, |
68 |
| - EmailErrors=False, |
69 |
| - EmailErrorReportAsAttachment=False, |
70 |
| - ErrorEmailServer='localhost', |
71 |
| - ErrorEmailHeaders={ |
| 62 | + 'Debug': {'Sessions': False}, |
| 63 | + 'DirectoryFile': ['index', 'Index', 'main', 'Main'], |
| 64 | + 'EnterDebuggerOnException': False, |
| 65 | + 'EmailErrors': False, |
| 66 | + 'EmailErrorReportAsAttachment': False, |
| 67 | + 'ErrorEmailServer': 'localhost', |
| 68 | + 'ErrorEmailHeaders': { |
72 | 69 | 'From': 'webware@mydomain',
|
73 | 70 | 'To': ['webware@mydomain'],
|
74 | 71 | 'Reply-To': 'webware@mydomain',
|
75 | 72 | 'Content-Type': 'text/html',
|
76 | 73 | 'Subject': 'Error'
|
77 | 74 | },
|
78 |
| - ErrorLogFilename='Errors.csv', |
79 |
| - ErrorMessagesDir='ErrorMsgs', |
80 |
| - ErrorPage=None, |
81 |
| - ExtensionCascadeOrder=['.py', '.psp', '.html'], |
82 |
| - ExtensionsToIgnore={ |
| 75 | + 'ErrorLogFilename': 'Errors.csv', |
| 76 | + 'ErrorMessagesDir': 'ErrorMsgs', |
| 77 | + 'ErrorPage': None, |
| 78 | + 'ExtensionCascadeOrder': ['.py', '.psp', '.html'], |
| 79 | + 'ExtensionsToIgnore': { |
83 | 80 | '.pyc', '.pyo', '.tmpl', '.bak', '.py_bak',
|
84 | 81 | '.py~', '.psp~', '.html~', '.tmpl~'
|
85 | 82 | },
|
86 |
| - ExtensionsToServe=[], |
87 |
| - ExtraPathInfo=True, |
88 |
| - FancyTracebackContext=5, |
89 |
| - FilesToHide={ |
| 83 | + 'ExtensionsToServe': [], |
| 84 | + 'ExtraPathInfo': True, |
| 85 | + 'FancyTracebackContext': 5, 'FilesToHide': { |
90 | 86 | '.*', '*~', '*.bak', '*.py_bak', '*.tmpl',
|
91 | 87 | '*.pyc', '*.pyo', '__init__.*', '*.config'
|
92 | 88 | },
|
93 |
| - FilesToServe=[], |
94 |
| - IgnoreInvalidSession=True, |
95 |
| - IncludeEditLink=True, |
96 |
| - IncludeFancyTraceback=False, |
97 |
| - LogActivity=True, |
98 |
| - LogDir='Logs', |
99 |
| - LogErrors=True, |
100 |
| - MaxValueLengthInExceptionReport=500, |
101 |
| - OutputEncoding='utf-8', |
102 |
| - PlugIns=['MiscUtils', 'WebUtils', 'TaskKit', 'UserKit', 'PSP'], |
103 |
| - PrintConfigAtStartUp=True, |
104 |
| - PrintPlugIns=True, |
105 |
| - RegisterSignalHandler=False, |
106 |
| - ReloadServletClasses=False, |
107 |
| - ReportRPCExceptionsInWebware=True, |
108 |
| - ResponseBufferSize=8 * 1024, # 8 kBytes |
109 |
| - RetainSessions=True, |
110 |
| - RPCExceptionReturn='traceback', |
111 |
| - RunTasks=True, |
112 |
| - SaveErrorMessages=True, |
113 |
| - SecureSessionCookie=True, |
114 |
| - SessionCookiePath=None, |
115 |
| - HttpOnlySessionCookie=True, |
116 |
| - SameSiteSessionCookie='Strict', |
117 |
| - SessionModule='Session', |
118 |
| - SessionName='_SID_', |
119 |
| - SessionPrefix='', |
120 |
| - SessionStore='Dynamic', |
121 |
| - SessionStoreDir='Sessions', |
122 |
| - SessionTimeout=60, |
123 |
| - ShowDebugInfoOnErrors=False, |
124 |
| - SilentURIs=None, |
125 |
| - UnknownFileTypes=dict( |
126 |
| - ReuseServlets=True, |
127 |
| - Technique='serveContent', # or redirectSansScript |
128 |
| - CacheContent=False, |
129 |
| - MaxCacheContentSize=128 * 1024, |
130 |
| - ReadBufferSize=32 * 1024 |
131 |
| - ), |
132 |
| - UseAutomaticPathSessions=False, |
133 |
| - UseCascadingExtensions=True, |
134 |
| - UseCookieSessions=True, |
135 |
| - UserErrorMessage=( |
| 89 | + 'FilesToServe': [], |
| 90 | + 'IgnoreInvalidSession': True, |
| 91 | + 'IncludeEditLink': True, |
| 92 | + 'IncludeFancyTraceback': False, |
| 93 | + 'LogActivity': True, |
| 94 | + 'LogDir': 'Logs', |
| 95 | + 'LogErrors': True, |
| 96 | + 'MaxValueLengthInExceptionReport': 500, |
| 97 | + 'OutputEncoding': 'utf-8', |
| 98 | + 'PlugIns': ['MiscUtils', 'WebUtils', 'TaskKit', 'UserKit', 'PSP'], |
| 99 | + 'PrintConfigAtStartUp': True, |
| 100 | + 'PrintPlugIns': True, |
| 101 | + 'RegisterSignalHandler': False, |
| 102 | + 'ReloadServletClasses': False, |
| 103 | + 'ReportRPCExceptionsInWebware': True, |
| 104 | + 'ResponseBufferSize': 8 * 1024, # 8 kBytes |
| 105 | + 'RetainSessions': True, |
| 106 | + 'RPCExceptionReturn': 'traceback', |
| 107 | + 'RunTasks': True, |
| 108 | + 'SaveErrorMessages': True, |
| 109 | + 'SecureSessionCookie': True, |
| 110 | + 'SessionCookiePath': None, |
| 111 | + 'HttpOnlySessionCookie': True, |
| 112 | + 'SameSiteSessionCookie': 'Strict', |
| 113 | + 'SessionModule': 'Session', |
| 114 | + 'SessionName': '_SID_', |
| 115 | + 'SessionPrefix': '', |
| 116 | + 'SessionStore': 'Dynamic', |
| 117 | + 'SessionStoreDir': 'Sessions', |
| 118 | + 'SessionTimeout': 60, |
| 119 | + 'ShowDebugInfoOnErrors': False, |
| 120 | + 'SilentURIs': None, |
| 121 | + 'UnknownFileTypes': { |
| 122 | + 'ReuseServlets': True, |
| 123 | + 'Technique': 'serveContent', # or redirectSansScript |
| 124 | + 'CacheContent': False, |
| 125 | + 'MaxCacheContentSize': 128 * 1024, |
| 126 | + 'ReadBufferSize': 32 * 1024 |
| 127 | + }, |
| 128 | + 'UseAutomaticPathSessions': False, |
| 129 | + 'UseCascadingExtensions': True, |
| 130 | + 'UseCookieSessions': True, |
| 131 | + 'UserErrorMessage': ( |
136 | 132 | 'The site is having technical difficulties with this page.'
|
137 | 133 | ' An error has been logged, and the problem will be fixed'
|
138 | 134 | ' as soon as possible. Sorry!'
|
139 | 135 | ),
|
140 |
| - UseSessionSweeper=True, |
141 |
| - Verbose=True, |
142 |
| - WSGIWrite=True, # use write callable with WSGI |
143 |
| -) |
| 136 | + 'UseSessionSweeper': True, |
| 137 | + 'Verbose': True, |
| 138 | + 'WSGIWrite': True # use write callable with WSGI |
| 139 | +} |
144 | 140 |
|
145 | 141 |
|
146 | 142 | class EndResponse(Exception):
|
@@ -467,10 +463,11 @@ def configFilename(self):
|
467 | 463 |
|
468 | 464 | def configReplacementValues(self):
|
469 | 465 | """Get config values that need to be escaped."""
|
470 |
| - return dict( |
471 |
| - ServerSidePath=self._serverSidePath, |
472 |
| - WebwarePath=self._webwarePath, |
473 |
| - Development=self._development) |
| 466 | + return { |
| 467 | + 'ServerSidePath': self._serverSidePath, |
| 468 | + 'WebwarePath': self._webwarePath, |
| 469 | + 'Development': self._development |
| 470 | + } |
474 | 471 |
|
475 | 472 | def development(self):
|
476 | 473 | """Whether the application shall run in development mode"""
|
@@ -645,12 +642,14 @@ def writeActivityLog(self, trans):
|
645 | 642 | if mode == 'w':
|
646 | 643 | f.write(','.join(self.setting('ActivityLogColumns')) + '\n')
|
647 | 644 | values = []
|
648 |
| - objects = dict( |
649 |
| - application=self, transaction=trans, |
650 |
| - request=trans.request(), response=trans.response(), |
651 |
| - servlet=trans.servlet(), |
| 645 | + objects = { |
| 646 | + 'application': self, 'transaction': trans, |
| 647 | + 'request': trans.request(), |
| 648 | + 'response': trans.response(), |
| 649 | + 'servlet': trans.servlet(), |
652 | 650 | # don't cause creation of session here:
|
653 |
| - session=trans._session) |
| 651 | + 'session': trans._session |
| 652 | + } |
654 | 653 | for column in self.setting('ActivityLogColumns'):
|
655 | 654 | try:
|
656 | 655 | value = valueForName(objects, column)
|
@@ -988,7 +987,7 @@ def handleExceptionInTransaction(self, excInfo, trans):
|
988 | 987 | editlink = f'{request.scriptName()}/Admin/EditFile' if self.setting(
|
989 | 988 | 'IncludeEditLink') else None
|
990 | 989 | self._exceptionHandlerClass(
|
991 |
| - self, trans, excInfo, dict(editlink=editlink)) |
| 990 | + self, trans, excInfo, {'editlink': editlink}) |
992 | 991 |
|
993 | 992 | def rootURLParser(self):
|
994 | 993 | """Accessor: the Root URL parser.
|
@@ -1172,7 +1171,7 @@ def loadPlugIns(self):
|
1172 | 1171 | def __call__(self, environ, start_response):
|
1173 | 1172 | """The WSGI application callable"""
|
1174 | 1173 | verbose = self._verbose
|
1175 |
| - requestDict = dict(environ=environ) |
| 1174 | + requestDict = {'environ': environ} |
1176 | 1175 |
|
1177 | 1176 | requestID = self._requestID
|
1178 | 1177 | self._requestID = requestID + 1
|
|
0 commit comments