PyXR

c:\python24\lib\site-packages \ isapi \ simple.py



0001 """Simple base-classes for extensions and filters.
0002 
0003 None of the filter and extension functions are considered 'optional' by the
0004 framework.  These base-classes provide simple implementations for the
0005 Initialize and Terminate functions, allowing you to omit them,
0006 
0007 It is not necessary to use these base-classes - but if you don't, you
0008 must ensure each of the required methods are implemented.
0009 """
0010 
0011 class SimpleExtension:
0012     "Base class for a a simple ISAPI extension"
0013     def __init__(self):
0014         pass
0015 
0016     def GetExtensionVersion(self, vi):
0017         """Called by the ISAPI framework to get the extension version
0018         
0019         The default implementation uses the classes docstring to
0020         set the extension description."""
0021         # nod to our reload capability - vi is None when we are reloaded.
0022         if vi is not None:
0023             vi.ExtensionDesc = self.__doc__
0024 
0025     def HttpExtensionProc(self, control_block):
0026         """Called by the ISAPI framework for each extension request.
0027         
0028         sub-classes must provide an implementation for this method.
0029         """
0030         raise NotImplementedError, "sub-classes should override HttpExtensionProc"
0031 
0032     def TerminateExtension(self, status):
0033         """Called by the ISAPI framework as the extension terminates.
0034         """
0035         pass
0036 
0037 class SimpleFilter:
0038     "Base class for a a simple ISAPI filter"
0039     filter_flags = None
0040     def __init__(self):
0041         pass
0042 
0043     def GetFilterVersion(self, fv):
0044         """Called by the ISAPI framework to get the extension version
0045         
0046         The default implementation uses the classes docstring to
0047         set the extension description, and uses the classes
0048         filter_flags attribute to set the ISAPI filter flags - you
0049         must specify filter_flags in your class.
0050         """
0051         if self.filter_flags is None:
0052             raise RuntimeError, "You must specify the filter flags"
0053         # nod to our reload capability - fv is None when we are reloaded.
0054         if fv is not None:
0055             fv.Flags = self.filter_flags
0056             fv.FilterDesc = self.__doc__
0057 
0058     def HttpFilterProc(self, fc):
0059         """Called by the ISAPI framework for each filter request.
0060         
0061         sub-classes must provide an implementation for this method.
0062         """
0063         raise NotImplementedError, "sub-classes should override HttpExtensionProc"
0064 
0065     def TerminateFilter(self, status):
0066         """Called by the ISAPI framework as the filter terminates.
0067         """
0068         pass
0069 

Generated by PyXR 0.9.4
SourceForge.net Logo