Author: gotcha
Date: Fri Jun 13 11:55:25 2008
New Revision: 55804
Modified:
kukit/kss.core/branch/jscoverage/kss/core/commands.py
Log:
cleaned up after pep8
Modified: kukit/kss.core/branch/jscoverage/kss/core/commands.py
==============================================================================
--- kukit/kss.core/branch/jscoverage/kss/core/commands.py (original)
+++ kukit/kss.core/branch/jscoverage/kss/core/commands.py Fri Jun 13
11:55:25 2008
@@ -33,23 +33,26 @@
from pluginregistry import checkRegisteredCommand, checkRegisteredSelector, \
KSSPluginError
+
class KSSCommands(list):
implements(IKSSCommands)
-
+
def addCommand(self, command_name, selector=None, **kw):
command = KSSCommand(command_name, selector=selector, **kw)
self.append(command)
return command
-
+
def render(self, request):
'''All methods must use this to return their command set
'''
- adapter = zope.component.getMultiAdapter((self, request),
IKSSCommandView)
+ adapter = zope.component.getMultiAdapter((self, request),
+ IKSSCommandView)
return adapter.render()
+
class KSSParam:
implements(IKSSParam)
-
+
def __init__(self, name, content=''):
self.name = name
self.content = content
@@ -63,10 +66,11 @@
def getContent(self):
return self.content
-
+
+
class KSSCommand:
implements(IKSSCommand)
-
+
def __init__(self, command_name, selector=None, **kw):
try:
checkRegisteredCommand_old(command_name)
@@ -77,12 +81,13 @@
else:
# ok. XXX this will be deprecated
# All registerCommand commands are obsolete, by default
- import warnings, textwrap
+ import warnings
+ import textwrap
warnings.warn(textwrap.dedent('''\
- The usage of the kss command "%s" is deprecated'''
+ The usage of the kss command "%s" is deprecated'''
% (command_name, )), DeprecationWarning, 2)
if selector is not None:
- if isinstance(selector, basestring):
+ if isinstance(selector, basestring):
# the default selector - given just as a string
self.selector = selector
self.selectorType = ''
@@ -171,9 +176,10 @@
def getParams(self):
return self.params
+
class CommandView(object):
'''View of a command.
-
+
The render method does actual marshalling
of the commands to be sent to the client.
'''
@@ -199,16 +205,18 @@
for command in context:
for param in command.getParams():
param.force_content_unicode()
-
+
# XML output gets rendered via a page template
# XXX note: barefoot rendering, use python: only after zope2.9
# XXX we must have the content type set both here and below
- _render = ViewPageTemplateFile('browser/kukitresponse.pt',
content_type='text/xml;charset=utf-8')
+ _render = ViewPageTemplateFile('browser/kukitresponse.pt',
+ content_type='text/xml;charset=utf-8')
def render(self):
result = self._render()
# Always output text/xml to make sure browsers but the data in the
# responseXML instead of responseText attribute of the
# XMLHttpRequestobject.
- self.request.response.setHeader('Content-type',
'text/xml;charset=utf-8')
+ self.request.response.setHeader('Content-type',
+ 'text/xml;charset=utf-8')
return result
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins