I've attached a patch that deals with this.  It'll also be up at sf.net in a 
minute.
Tavis

On April 18, 2002 01:09 pm, Jeff Johnson wrote:
> I'm working on a new project and wanted to try out Cheetah's inheritance
> approach rather than containment.  I found that I had to add '.tmpl' to
> the extensionsToIgnore setting in order to specify my servlet name in
> the URL without the extension.  Otherwise I got 404 - Page not found but
> _no_ errors were reported on the WebKit stdout.  This highlighted a few
> issues.
>
> With default Application.config settings, the WebKit output was:
>
>     1  2002-04-18 16:05:14  /partner/base
>     1  0.01 secs            /partner/base
>
> This gives a 404 error in the browser but no error shows in stdout.

Hmm, that needs to be fixed.

> If I changed UseCascadingExtensions to 0:
>
>     1  2002-04-18 16:05:56  /partner/base
> WARNING: For /base, did not get precisely 1 filename:
> ['/home/jeff/jeff/partner/www/base.tmpl',
> '/home/jeff/jeff/partner/www/base.py']
>     1  0.01 secs            /partner/base
>
> This also gives a 404 in the browser.
>
> By adding '.tmpl' to ExtensionsToIgnore, things work as expected.  Since
> '*.tmpl' is in the default FilesToHide setting, I propose it should also
> be added to ExtensionsToIgnore.

I agree.

> There seems to be 3 competing pairs of settings below that combine to
> produce strange behavior.  Could the winner be chosen and the other two
> removed?

They all do different things.  ExtensionsTo___ are only used when the 
extension is not part of the URL. They are for convenience, not security.
CasdadingExtensions are also there for convenience when the extensions are 
missing from the URL. FilesTo___ are used for all requests regardless of the 
presence of the extension.  They are for security, not convenience.  I don't 
see anyway to combine them.

>       'ExtensionsToIgnore':   ['.pyc', '.pyo', '.py~', '.psp~',
> '.html~','.bak',], #'.tmpl'],
>       'ExtensionsToServe':  [], # if specified, only extensions in
> this list will be used
>       'UseCascadingExtensions': 0,
>       'ExtensionCascadeOrder':['.py','.psp','.html'],
>       'FilesToHide': ['.*','*~', '*.bak', '*.tmpl', '*.config',
> '__init__.*', '*.pyc', '*.pyo'],
>       'FilesToServe': [], # if specified, only files matching these
> patterns will be served
Index: Application.py
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/Application.py,v
retrieving revision 1.134
diff -u -r1.134 Application.py
--- Application.py	12 Apr 2002 15:12:15 -0000	1.134
+++ Application.py	18 Apr 2002 20:54:21 -0000
@@ -262,7 +262,7 @@
 		return {
 			'PrintConfigAtStartUp': 1,
 			'DirectoryFile':        ['index', 'Main'],
-			'ExtensionsToIgnore':   ['.pyc', '.pyo', '.py~', '.bak'],
+			'ExtensionsToIgnore':   ['.pyc', '.pyo', '.py~', '.bak', '.tmpl'],
 			'ExtensionsToServe':   None,
 			'UseCascadingExtensions':1,
 			'ExtensionCascadeOrder':['.psp','.py','.html',],
@@ -1210,7 +1210,7 @@
 				if self.setting('UseCascadingExtensions'):
 					for ext in self.setting('ExtensionCascadeOrder'):
 						if (ssPath + ext) in filenames:
-							fullPath = ssPath + ext
+							ssPath = ssPath + ext
 							foundMatch = 1
 							break
 				if not foundMatch:
Index: Configs/Application.config
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/Configs/Application.config,v
retrieving revision 1.45
diff -u -r1.45 Application.config
--- Configs/Application.config	12 Apr 2002 15:12:15 -0000	1.45
+++ Configs/Application.config	18 Apr 2002 20:54:21 -0000
@@ -2,7 +2,7 @@
 	'AdminPassword':	'webware', #Change This!
 	'PrintConfigAtStartUp': 1,
 	'DirectoryFile':        ['index', 'Index','main','Main'],
-	'ExtensionsToIgnore':   ['.pyc', '.pyo', '.py~', '.psp~', '.html~','.bak'],
+	'ExtensionsToIgnore':   ['.pyc', '.pyo', '.py~', '.psp~', '.html~','.bak','.tmpl'],
 	'ExtensionsToServe':  [], # if specified, only extensions in this list will be used
 	'UseCascadingExtensions': 1,
 	'ExtensionCascadeOrder':['.py','.psp','.html'],
Index: Docs/Application.configlist
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/Docs/Application.configlist,v
retrieving revision 1.13
diff -u -r1.13 Application.configlist
--- Docs/Application.configlist	12 Apr 2002 15:12:16 -0000	1.13
+++ Docs/Application.configlist	18 Apr 2002 20:54:21 -0000
@@ -5,7 +5,7 @@
 
 ('PrintConfigAtStartUp', '1', "Does what it says. It's generally a good idea to leave this on."),
 
-('ExtensionsToIgnore', "['.pyc', '.pyo', '.py~', '.bak']", 'This is a list of extensions that WebKit will ignore when autodetecting extensions. Note that this does not prevent WebKit from serving such a file if it is named explicitly in a URL.'),
+('ExtensionsToIgnore', "['.pyc', '.pyo', '.py~', '.bak', '.tmpl']", 'This is a list of extensions that WebKit will ignore when autodetecting extensions. Note that this does not prevent WebKit from serving such a file if it is named explicitly in a URL.'),
 
 ('ExtensionsToServe', "[]", 'This is a list of extensions that WebKit will use exclusively when autodetecting extensions. Note that this does not prevent WebKit from serving such a file if it is named explicitly in a URL.'),
 

Reply via email to