Beispiel #1
0
 def writeDict(self, d, heading=None, encoded=None):
     """Output a table-formatted dictionary."""
     self.writeln(htmlForDict(
         d, addSpace=self._addSpace,
         filterValueCallBack=self.filterDictValue,
         maxValueLength=self._maxValueLength,
         topHeading=heading, isEncoded=encoded))
 def writeDict(self, d):
   self.htmlWriteln(htmlForDict(d, filterValueCallBack=self.filterDictValue,
     maxValueLength=self._maxValueLength))
   keys= d.keys()
   keys.sort()
   for key in keys:
     self.descWrite(self.descRepr(key) + ':')
     values= string.split(str(d[key]), '\n')
     self.descWriteln(values[0])
     for value in values[1:]:
       self.descWriteln('      ' + self.descRepr(value))
    def repr(self, value):
        """Get HTML encoded representation.

        Returns the repr() of value already HTML encoded. As a special case,
        dictionaries are nicely formatted in table.

        This is a utility method for `writeAttrs`.
        """
        if isinstance(value, dict):
            return htmlForDict(value,
                               addSpace=self._addSpace,
                               filterValueCallBack=self.filterDictValue,
                               maxValueLength=self._maxValueLength)
        rep = repr(value)
        if self._maxValueLength and len(rep) > self._maxValueLength:
            rep = rep[:self._maxValueLength] + '...'
        return htmlEncode(rep)
Beispiel #4
0
	def repr(self, x):
		"""Get HTML encoded representation.

		Returns the repr() of x already HTML encoded. As a special case,
		dictionaries are nicely formatted in table.

		This is a utility method for `writeAttrs`.

		"""
		if type(x) is DictType:
			return htmlForDict(x, filterValueCallBack=self.filterDictValue,
				maxValueLength=self._maxValueLength)
		else:
			rep = repr(x)
			if self._maxValueLength and len(rep) > self._maxValueLength:
				rep = rep[:self._maxValueLength] + '...'
			return htmlEncode(rep)
Beispiel #5
0
    def repr(self, value):
        """Get HTML encoded representation.

        Returns the repr() of value already HTML encoded. As a special case,
        dictionaries are nicely formatted in table.

        This is a utility method for `writeAttrs`.
        """
        if isinstance(value, dict):
            return htmlForDict(value, addSpace=self._addSpace,
                filterValueCallBack=self.filterDictValue,
                maxValueLength=self._maxValueLength)
        else:
            rep = repr(value)
            if self._maxValueLength and len(rep) > self._maxValueLength:
                rep = rep[:self._maxValueLength] + '...'
            return htmlEncode(rep)
Beispiel #6
0
 def writeContent(self):
     self.writeln(
         htmlForDict(self.application().config(), topHeading='Application'))
 def writeDict(self, d, heading=None, encoded=None):
     """Output a table-formated dictionary."""
     self.writeln(htmlForDict(d, addSpace=self._addSpace,
         filterValueCallBack=self.filterDictValue,
         maxValueLength=self._maxValueLength,
         topHeading=heading, isEncoded=encoded))
Beispiel #8
0
	def writeDict(self, d):
		"""Output a table-formated dictionary."""
		self.writeln(htmlForDict(d, filterValueCallBack=self.filterDictValue,
			maxValueLength=self._maxValueLength))