Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
kss.core.pluginregistry._concatresource.resource.GenericResource Class Reference
Inheritance diagram for kss.core.pluginregistry._concatresource.resource.GenericResource:
Inheritance graph
[legend]
Collaboration diagram for kss.core.pluginregistry._concatresource.resource.GenericResource:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __browser_default__
def publishTraverse
def browserDefault
def chooseContext
def GET
def HEAD

Private Member Functions

def _testData

Detailed Description

A publishable resource

Definition at line 31 of file resource.py.


Member Function Documentation

Definition at line 37 of file resource.py.

00037 
00038         def __browser_default__(self, request):
00039             return self, (request.REQUEST_METHOD,)

Here is the call graph for this function:

Definition at line 52 of file resource.py.

00052 
00053     def _testData(self):
00054         return self.context.data

See interface IBrowserPublisher

Definition at line 47 of file resource.py.

00047 
00048         def browserDefault(self, request):
00049             '''See interface IBrowserPublisher'''
00050             return getattr(self, request.method), ()

Choose the appropriate context

Definition at line 55 of file resource.py.

00055 
00056     def chooseContext(self):
00057         """Choose the appropriate context"""
00058         return self.context

Here is the call graph for this function:

Here is the caller graph for this function:

Default document

Definition at line 59 of file resource.py.

00059 
00060     def GET(self):
00061         """Default document"""
00062 
00063         file = self.chooseContext()
00064         request = self.request
00065         response = request.response
00066 
00067         # Control in-memory caching
00068         cache_in_memory = file.caching == 'memory'
00069         if cache_in_memory:
00070             last_mod = file.lmt
00071             if last_mod > file.data_last_fetched:
00072                 # force delete file contents
00073                 file.purgeData()
00074 
00075         # HTTP If-Modified-Since header handling. This is duplicated
00076         # from OFS.Image.Image - it really should be consolidated
00077         # somewhere...
00078         if __five__:
00079             header = request.get_header('If-Modified-Since')
00080         else:
00081             header = request.getHeader('If-Modified-Since', None)
00082         if header is not None:
00083             header = header.split(';')[0]
00084             # Some proxies seem to send invalid date strings for this
00085             # header. If the date string is not valid, we ignore it
00086             # rather than raise an error to be generally consistent
00087             # with common servers such as Apache (which can usually
00088             # understand the screwy date string as a lucky side effect
00089             # of the way they parse it).
00090             try:    mod_since=long(timeFromDateTimeString(header))
00091             except: mod_since=None
00092             if mod_since is not None:
00093                 if not cache_in_memory:
00094                     last_mod = file.lmt
00095                 if last_mod > 0 and int(last_mod) <= mod_since:
00096                     response.setStatus(304)
00097                     return ''
00098 
00099         response.setHeader('Content-Type', file.content_type)
00100         response.setHeader('Last-Modified', file.lmh)
00101         # Cache for one day
00102         response.setHeader('Cache-Control', 'public,max-age=86400')
00103         data = file.data
00104 
00105         if not cache_in_memory:
00106             # force delete file contents
00107             file.purgeData()
00108 
00109         return data

Here is the call graph for this function:

Definition at line 110 of file resource.py.

00110 
00111     def HEAD(self):
00112         file = self.chooseContext()
00113         response = self.request.response
00114         response.setHeader('Content-Type', file.content_type)
00115         response.setHeader('Last-Modified', file.lmh)
00116         # Cache for one day
00117         response.setHeader('Cache-Control', 'public,max-age=86400')
00118         return ''

Here is the call graph for this function:

See interface IBrowserPublisher

Definition at line 43 of file resource.py.

00043 
00044         def publishTraverse(self, request, name):
00045             '''See interface IBrowserPublisher'''
00046             raise LookupError(name)


The documentation for this class was generated from the following file: