Back to index

plone3  3.1.7
Public Member Functions | Static Private Attributes
kss.core.pluginregistry.browser.develview.DevelView Class Reference
Inheritance diagram for kss.core.pluginregistry.browser.develview.DevelView:
Inheritance graph
[legend]
Collaboration diagram for kss.core.pluginregistry.browser.develview.DevelView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def publishTraverse
def browserDefault
def ison
def isoff
def set
def unset
def needs_old_cssquery
def getLogLevel
def setLogLevel
def ui
def ui_js
def ui_css
def ui_kss

Static Private Attributes

tuple _ui = ViewPageTemplateFile('develui.pt', content_type='text/html;charset=utf-8')

Detailed Description

Definition at line 17 of file develview.py.


Member Function Documentation

Definition at line 36 of file develview.py.

00036 
00037     def browserDefault(self, request):
00038         # make ui the default method
00039         return self, ('ui', )

Definition at line 103 of file develview.py.

00103 
00104     def getLogLevel(self, REQUEST=None):
00105         'Gets current log level'
00106         loglevel = self.request.cookies.get(COOKIE_LOGLEVEL, 'DEBUG').upper()
00107         return loglevel

def kss.core.pluginregistry.browser.develview.DevelView.isoff (   self,
  REQUEST = None 
)

Definition at line 71 of file develview.py.

00071 
00072     def isoff(self, REQUEST=None):
00073         'Check if running in production mode'
00074         result = not(self.ison())
00075         if REQUEST is not None:
00076             result = str(result)
00077         return result

Here is the call graph for this function:

Checks if running in development mode

Two ways to induce development mode:

- set the cookie on the request

- switch portal_js tool into debug mode, this will
  select development mode without the cookie

Definition at line 44 of file develview.py.

00044 
00045     def ison(self):
00046         '''Checks if running in development mode
00047 
00048         Two ways to induce development mode:
00049 
00050         - set the cookie on the request
00051 
00052         - switch portal_js tool into debug mode, this will
00053           select development mode without the cookie
00054 
00055         '''
00056         ison = COOKIE_DEVELMODE in self.request.cookies
00057 
00058         if not ison:
00059             # Check from javascript tool
00060             # XXX this should not be done from here, but I don't want to
00061             # modify other components yet.
00062             try:
00063                 from Products.CMFCore.utils import getToolByName
00064                 js_tool = getToolByName(self.context.aq_inner, 'portal_javascripts')
00065                 ison = js_tool.getDebugMode()
00066             except:
00067                 pass
00068 
00069         result = bool(ison)
00070         return result

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 90 of file develview.py.

00090 
00091     def needs_old_cssquery(self):
00092         user_agent = self.request.get_header('User-Agent', '')
00093         safari_3_1 = 'Version/3.1' in user_agent and 'Safari' in user_agent
00094         # on Safari 3_1 the current base2 is broken, this check makes
00095         # it possible to serve the old cssquery instead of base2
00096         # on this version.
00097         # """User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; en-us) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13"""
00098         return safari_3_1

Definition at line 30 of file develview.py.

00030 
00031     def publishTraverse(self, request, name):
00032         try:
00033             return getattr(self, name)
00034         except AttributeError:
00035             raise NotFound(self.context, name, request)

Here is the call graph for this function:

Definition at line 78 of file develview.py.

00078 
00079     def set(self):
00080         'Sets development mode cookie'
00081         self.request.response.setCookie(COOKIE_DEVELMODE, '1', path='/')

Here is the caller graph for this function:

Definition at line 108 of file develview.py.

00108 
00109     def setLogLevel(self, loglevel):
00110         'Sets loglevel cookie'
00111         self.request.response.setCookie(COOKIE_LOGLEVEL, loglevel, path='/')

Here is the caller graph for this function:

Definition at line 118 of file develview.py.

00118 
00119     def ui(self):
00120         'User interface for interactive switching'
00121         options = {}
00122         # Handle development/production mode
00123         if 'devel' in self.request.form:
00124             self.set()
00125             # setting it also to have immediate effect in the page
00126             options['devel_mode'] = True
00127         if 'prod' in self.request.form:
00128             self.unset()
00129             if COOKIE_DEVELMODE in self.request.cookies:
00130                 # setting it also to have immediate effect in the page
00131                 options['devel_mode'] = False
00132         # Handle loglevel
00133         if 'loglevel' in self.request.form:
00134             loglevel =  self.request.form['loglevel']
00135             self.setLogLevel(loglevel)
00136             # setting it also to have immediate effect in the page
00137             options['loglevel'] = loglevel
00138         # Return the rendered template
00139         return self._ui(**options)

Here is the call graph for this function:

Definition at line 147 of file develview.py.

00147 
00148     def ui_css(self):
00149         'CSS needed for the ui'
00150         resource = ITraverser(self.context).traverse('++resource++kss_devel_ui.css', 
00151                 request=self.request)
00152         cooked = resource.GET()
00153         return cooked

Here is the call graph for this function:

Definition at line 140 of file develview.py.

00140 
00141     def ui_js(self):
00142         'Javascript needed for the ui'
00143         resource = ITraverser(self.context).traverse('++resource++kss_devel_ui.js', 
00144                 request=self.request)
00145         cooked = resource.GET()
00146         return cooked

Here is the call graph for this function:

Definition at line 154 of file develview.py.

00154 
00155     def ui_kss(self):
00156         'KSS needed for the ui'
00157         resource = ITraverser(self.context).traverse('++resource++kss_devel_ui.kss', 
00158                 request=self.request)
00159         cooked = resource.GET()
00160         return cooked

Here is the call graph for this function:

Definition at line 82 of file develview.py.

00082 
00083     def unset(self):
00084         'Unsets development mode cookie'
00085         self.request.response.expireCookie(COOKIE_DEVELMODE, path='/')

Here is the caller graph for this function:


Member Data Documentation

tuple kss.core.pluginregistry.browser.develview.DevelView._ui = ViewPageTemplateFile('develui.pt', content_type='text/html;charset=utf-8') [static, private]

Definition at line 116 of file develview.py.


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