Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
kss.core.commands.KSSCommand Class Reference

List of all members.

Public Member Functions

def __init__
def addParam
def addUnicodeParam
def addStringParam
def addHtmlParam
def addXmlParam
def addCdataParam
def getName
def getSelector
def getSelectorType
def getParams

Public Attributes

 selector
 selectorType
 name
 params

Private Member Functions

def _addParam

Detailed Description

Definition at line 67 of file commands.py.


Constructor & Destructor Documentation

def kss.core.commands.KSSCommand.__init__ (   self,
  command_name,
  selector = None,
  kw 
)

Definition at line 70 of file commands.py.

00070 
00071     def __init__(self, command_name, selector=None, **kw):
00072         try:
00073             checkRegisteredCommand_old(command_name)
00074         except KSSPluginError:
00075             # we expect this is not registered as command, anyway
00076             # so check it as an action.
00077             checkRegisteredCommand(command_name)
00078         else:
00079             # ok. XXX this will be deprecated
00080             # All registerCommand commands are obsolete, by default
00081             import warnings, textwrap
00082             warnings.warn(textwrap.dedent('''\
00083             The usage of the kss command "%s" is deprecated''' 
00084                 % (command_name, )), DeprecationWarning, 2)
00085         if selector is not None:
00086             if isinstance(selector, basestring): 
00087                 # the default selector - given just as a string
00088                 self.selector = selector
00089                 self.selectorType = ''
00090             else:
00091                 checkRegisteredSelector(selector.type)
00092                 self.selector = selector.value
00093                 self.selectorType = selector.type
00094         else:
00095             self.selector = None
00096             self.selectorType = None
00097         self.name = command_name
00098         self.params = []
00099         # Add parameters passed in **kw
00100         for key, value in kw.iteritems():
00101             self.addParam(key, value)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def kss.core.commands.KSSCommand._addParam (   self,
  name,
  content = '' 
) [private]

Definition at line 119 of file commands.py.

00119 
00120     def _addParam(self, name, content=''):
00121         'Add the param as is'
00122         param = KSSParam(name, content)
00123         self.params.append(param)
00124         return param

Here is the caller graph for this function:

def kss.core.commands.KSSCommand.addCdataParam (   self,
  name,
  content = '' 
)

Definition at line 150 of file commands.py.

00150 
00151     def addCdataParam(self, name, content=''):
00152         'Add the param as a CDATA node'
00153         # Replace `>` part of `]]>` with the entity ref so it won't
00154         # accidentally close the CDATA (required by the XML spec)
00155         content = '<![CDATA[%s]]>' % content.replace(']]>', ']]&gt;')
00156         self._addParam(name, content=content)
00157 

Here is the call graph for this function:

Here is the caller graph for this function:

def kss.core.commands.KSSCommand.addHtmlParam (   self,
  name,
  content = '' 
)

Definition at line 138 of file commands.py.

00138 
00139     def addHtmlParam(self, name, content=''):
00140         'Add the param as an HTML content.'
00141         content = HtmlParser(content)().encode('ascii', 'xmlcharrefreplace')
00142         ##self.addParam(name, content=content)
00143         # add html as cdata!
00144         self.addCdataParam(name, content=content)

Here is the call graph for this function:

def kss.core.commands.KSSCommand.addParam (   self,
  name,
  content = '' 
)

Definition at line 109 of file commands.py.

00109 
00110     def addParam(self, name, content=''):
00111         # Check for the size of the content. Larger than 4K will give
00112         # problems with Firefox (which splits text nodes). Therefore
00113         # we give this special treatment.
00114         if len(content) > 4096:
00115             return self.addCdataParam(name, content)
00116         else:
00117             # Escape all XML characters
00118             return self._addParam(name, content=xml_escape(content))

Here is the call graph for this function:

Here is the caller graph for this function:

def kss.core.commands.KSSCommand.addStringParam (   self,
  name,
  content = '',
  encoding = 'utf8' 
)

Definition at line 133 of file commands.py.

00133 
00134     def addStringParam(self, name, content='', encoding='utf8'):
00135         'Add the param as an encoded string, by default UTF-8'
00136         content = unicode(content, encoding)
00137         self.addUnicodeParam(name, content=content)

Here is the call graph for this function:

def kss.core.commands.KSSCommand.addUnicodeParam (   self,
  name,
  content = u'' 
)

Definition at line 129 of file commands.py.

00129 
00130     def addUnicodeParam(self, name, content=u''):
00131         'Add the param as unicode'
00132         self.addParam(name, content)

Here is the call graph for this function:

Here is the caller graph for this function:

def kss.core.commands.KSSCommand.addXmlParam (   self,
  name,
  content = '' 
)

Definition at line 145 of file commands.py.

00145 
00146     def addXmlParam(self, name, content=''):
00147         'Add the param as XML content'
00148         content = XmlParser(content)().encode('ascii', 'xmlcharrefreplace')
00149         self._addParam(name, content=content)

Here is the call graph for this function:

Definition at line 162 of file commands.py.

00162 
00163     def getName(self):
00164         return self.name

Definition at line 171 of file commands.py.

00171 
00172     def getParams(self):
00173         return self.params

Definition at line 165 of file commands.py.

00165 
00166     def getSelector(self):
00167         return self.selector

Here is the caller graph for this function:

Definition at line 168 of file commands.py.

00168 
00169     def getSelectorType(self):
00170         return self.selectorType


Member Data Documentation

Definition at line 96 of file commands.py.

Definition at line 97 of file commands.py.

Definition at line 87 of file commands.py.

Definition at line 88 of file commands.py.


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