1.1 --- a/WebStack/Generic.py Fri Aug 19 13:26:04 2005 +0000
1.2 +++ b/WebStack/Generic.py Fri Aug 19 13:26:25 2005 +0000
1.3 @@ -575,6 +575,12 @@
1.4 """
1.5 An application-specific method which sets the 'path_info' in the
1.6 transaction. This affects subsequent calls to 'get_virtual_path_info'.
1.7 +
1.8 + Note that the virtual path info should either be an empty string, or it
1.9 + should begin with "/" and then (optionally) include other details.
1.10 + Virtual path info strings which omit the leading "/" - ie. containing
1.11 + things like "xxx" or even "xxx/yyy" - do not really make sense and may
1.12 + not be handled correctly by various WebStack components.
1.13 """
1.14
1.15 self.path_info = path_info
1.16 @@ -592,6 +598,35 @@
1.17 else:
1.18 return self.get_path_info()
1.19
1.20 + def get_processed_virtual_path_info(self):
1.21 +
1.22 + """
1.23 + An application-specific method which returns the virtual path info that
1.24 + is considered "processed"; that is, the part of the path info which is
1.25 + not included in the virtual path info.
1.26 +
1.27 + Where the virtual path info is identical to the path info, an empty
1.28 + string is returned.
1.29 +
1.30 + Where the virtual path info is a substring of the path info, the path
1.31 + info preceding that substring is returned.
1.32 +
1.33 + Where the virtual path info is either an empty string or not a substring
1.34 + of the path info, the entire path info is returned.
1.35 + """
1.36 +
1.37 + real_path_info = self.get_path_info()
1.38 + virtual_path_info = self.get_virtual_path_info()
1.39 +
1.40 + if virtual_path_info == "":
1.41 + return real_path_info
1.42 +
1.43 + i = real_path_info.find(virtual_path_info)
1.44 + if i == -1:
1.45 + return real_path_info
1.46 + else:
1.47 + return real_path_info[:i]
1.48 +
1.49 class Resource:
1.50
1.51 "A generic resource interface."