Package gavo :: Package web :: Module ifpages :: Class StaticFile
[frames] | no frames]

Class StaticFile

source code

                   object --+            
                            |            
       nevow.rend.DataFactory --+        
                                |        
                   object --+   |        
                            |   |        
     nevow.rend.RenderFactory --+        
                                |        
                   object --+   |        
                            |   |        
      nevow.rend.MacroFactory --+        
                                |        
                   object --+   |        
                            |   |        
 nevow.rend.ConfigurableMixin --+        
                                |        
              nevow.rend.Fragment --+    
                                    |    
   nevow.rend.ConfigurableFactory --+    
                                    |    
nevow.rend.FreeformChildMixin --+   |    
                                |   |    
      nevow.rend.ChildLookupMixin --+    
                                    |    
                      nevow.rend.Page --+
                                        |
                                       StaticFile

a file from the file system, served pretty directly.

Some of these static files can be javascript (that's usually minified on the fly) or nevow templates. These we want to cache. For everything else, we don't win anything by caching, but, when we serve large data, we can DoS ourselves. So, we decide manually whether to cache.

The caches are bound to an RD passed in as cacheRD at construction time. For system resources, that should be getRD(registry.SERVICELIST_ID).

On-the-fly processing is based on certain magic mime types: text/nevow-template is rendered and application/javascript is minified.

Instance Methods
 
__init__(self, fName, cacheRD)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getMimeType(self) source code
 
renderPlain(self, request) source code
 
renderHTTP(self, ctx) source code

Inherited from nevow.rend.Page: __provides__, child_, flattenFactory, onPostFailure, onPostSuccess, rememberStuff, renderString, renderSynchronously, webFormPost

Inherited from nevow.rend.Fragment: get, remember, rend

Inherited from nevow.rend.DataFactory: __providedBy__, child

Inherited from nevow.rend.RenderFactory: render_data, render_mapping, render_sequence, render_string, render_xml, renderer

Inherited from nevow.rend.MacroFactory: macro

Inherited from nevow.rend.ConfigurableMixin: getBinding, getBindingNames, getDefault, postForm

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from nevow.rend.ConfigurableFactory: configurable_, configurable_original, locateConfigurable

Inherited from nevow.rend.ChildLookupMixin: childFactory, locateChild, putChild

Inherited from nevow.rend.FreeformChildMixin: child_freeform_hand

Class Variables
  defaultType = 'application/octet-stream'
  magicMimes = {'application/javascript': <__builtin__.function ...

Inherited from nevow.rend.Page: __implemented__, addSlash, afterRender, beforeRender, buffered

Inherited from nevow.rend.Fragment: docFactory, original

Inherited from nevow.rend.ChildLookupMixin: children

Properties

Inherited from object: __class__

Method Details

__init__(self, fName, cacheRD)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

renderHTTP(self, ctx)

source code 
Overrides: nevow.rend.Page.renderHTTP

Class Variable Details

magicMimes

Value:
{'application/javascript': <__builtin__.function object>,
 'text/nevow-template': <__builtin__.function object>}