Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.patches.unicodehacks.FasterStringIO Class Reference
Inheritance diagram for CMFPlone.patches.unicodehacks.FasterStringIO:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.patches.unicodehacks.FasterStringIO:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def close
def seek
def write
def getvalue

Public Attributes

 buf
 len
 buflist
 bufappend
 pos
 closed
 softspace
 write

Detailed Description

Append-only version of StringIO, which ignores any initial buffer.

This let's us have much faster write() and getvalue methods.

Most of this code was taken from zope.tal.talinterpreter.py licenced under
the ZPL 2.1.

Definition at line 42 of file unicodehacks.py.


Constructor & Destructor Documentation

Definition at line 50 of file unicodehacks.py.

00050 
00051     def __init__(self, buf=None):
00052         self.buf = u''
00053         self.len = 0
00054         self.buflist = []
00055         self.bufappend = self.buflist.append
00056         self.pos = 0
00057         self.closed = False
00058         self.softspace = 0


Member Function Documentation

Definition at line 59 of file unicodehacks.py.

00059 
00060     def close(self):
00061         if not self.closed:
00062             self.write = _write_ValueError
00063             StringIO.close(self)

Definition at line 71 of file unicodehacks.py.

00071 
00072     def getvalue(self):
00073         if self.buflist:
00074             try:
00075                 self.buf = u''.join(self.buflist)
00076             except UnicodeDecodeError:
00077                 self.buf = u''.join([_unicode_replace(value) for value in self.buflist])
00078             self.buflist = []
00079         return self.buf

Here is the call graph for this function:

def CMFPlone.patches.unicodehacks.FasterStringIO.seek (   self,
  pos,
  mode = 0 
)

Definition at line 64 of file unicodehacks.py.

00064 
00065     def seek(self, pos, mode=0):
00066         raise RuntimeError("FasterStringIO.seek() not allowed")

Definition at line 67 of file unicodehacks.py.

00067 
00068     def write(self, s):
00069         self.bufappend(s)
00070         self.len = self.pos = self.pos + len(s)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 51 of file unicodehacks.py.

Definition at line 54 of file unicodehacks.py.

Definition at line 53 of file unicodehacks.py.

Definition at line 56 of file unicodehacks.py.

Definition at line 52 of file unicodehacks.py.

Definition at line 55 of file unicodehacks.py.

Definition at line 57 of file unicodehacks.py.

Definition at line 61 of file unicodehacks.py.


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