Home | Trees | Index | Help |
---|
Package vobject :: Module vobject |
|
Classes | |
---|---|
Component |
A complex property that can contain multiple ContentLines. |
ContentLine |
Holds one content line for formats like vCard and vCalendar. |
Stack |
|
VBase |
Base class for ContentLine and Component. |
Exceptions | |
---|---|
NativeError |
|
ParseError |
|
ValidateError |
|
VObjectError |
Function Summary | |
---|---|
backslashEscape(s)
| |
Encode and fold obj and its children, write to buf or return a string. | |
Return param, or "param" if ',' or ';' or ':' is in param. | |
Return a matching behavior if it exists, or None. | |
Iterate through a stream, yielding one logical line at a time. | |
Given a name, return a behaviored ContentLine or Component. | |
| |
| |
Generate one Component at a time from a stream. | |
Return the first component from stream. | |
Register the given behavior. | |
textLineToContentLine(text,
n)
|
Variable Summary | |
---|---|
unicode |
CR = u'\r'
|
unicode |
CRLF = u'\r\n'
|
bool |
DEBUG = False
|
Formatter |
formatter = <logging.Formatter instance at 0x4023610c>
|
StreamHandler |
handler = <logging.StreamHandler instance at 0x402360cc>
|
unicode |
LF = u'\n'
|
SRE_Pattern |
line_re = ^(([a-zA-Z0-9-]+)\.)?([a-zA-Z0-9-]+)((?:;(?:[a...
|
Logger |
logger = <logging.Logger instance at 0x4023608c>
|
SRE_Pattern |
logical_lines_re = ((?:[^\r\n]|(?:\r\n|\r|\n|$)[\t ])*(?...
|
SRE_Pattern |
param_values_re = "([^"]*)"|([^";:,]+)
|
SRE_Pattern |
params_re = ;([a-zA-Z0-9-]+)(?:=((?:(?:"[^"]*"|[^";:,]*)...
|
dict |
patterns = {'param_value_grouped': '\n" ( [^"] * )" | ( ...
|
unicode |
SPACE = u' '
|
unicode |
SPACEORTAB = u' \t'
|
unicode |
TAB = u'\t'
|
str |
testLines = '\nLine 0 text\n , Line 0 continued.\nLine 1...
|
str |
testVCalendar = '\nBEGIN:VCALENDAR\nBEGIN:VEVENT\nSUMMAR...
|
SRE_Pattern |
wrap_re = ((?:\r\n|\r|\n|$)[\t ]|(?:\r\n|\r|\n|$))
|
dict |
__behaviorRegistry = {'REQUEST-STATUS': [('', <class 'vo...
|
Function Details |
---|
defaultSerialize(obj, buf, lineLength)Encode and fold obj and its children, write to buf or return a string. |
dquoteEscape(param)Return param, or "param" if ',' or ';' or ':' is in param. |
getBehavior(name, id=None)Return a matching behavior if it exists, or None. If id is None, return the default for name. |
getLogicalLines(fp, allowQP=True)Iterate through a stream, yielding one logical line at a time. Because many applications still use vCard 2.1, we have to deal with the quoted-printable encoding for long lines, as well as the vCard 3.0 and vCalendar line folding technique, a whitespace character at the start of the line. Quoted-printable data will be decoded in the Behavior decoding phase.>>> import StringIO >>> f=StringIO.StringIO(testLines) >>> for n, l in enumerate(getLogicalLines(f)): ... print "Line %s: %s" % (n, l[0]) ... Line 0: Line 0 text, Line 0 continued. Line 1: Line 1;encoding=quoted-printable:this is an evil= evil= format. Line 2: Line 2 is a new line, it does not start with whitespace. |
newFromBehavior(name, id=None)Given a name, return a behaviored ContentLine or Component. |
parseLine(line)>>> parseLine("BLAH:") ('BLAH', [], '', None) >>> parseLine("RDATE:VALUE=DATE:19970304,19970504,19970704,19970904") ('RDATE', [], 'VALUE=DATE:19970304,19970504,19970704,19970904', None) >>> parseLine('DESCRIPTION;ALTREP="http://www.wiz.org":The Fall 98 Wild Wizards Conference - - Las Vegas, NV, USA') ('DESCRIPTION', [['ALTREP', 'http://www.wiz.org']], 'The Fall 98 Wild Wizards Conference - - Las Vegas, NV, USA', None) >>> parseLine("EMAIL;PREF;INTERNET:john@nowhere.com") ('EMAIL', [['PREF'], ['INTERNET']], 'john@nowhere.com', None) >>> parseLine('EMAIL;TYPE="blah",hah;INTERNET="DIGI",DERIDOO:john@nowhere.com') ('EMAIL', [['TYPE', 'blah', 'hah'], ['INTERNET', 'DIGI', 'DERIDOO']], 'john@nowhere.com', None) >>> parseLine('item1.ADR;type=HOME;type=pref:;;Reeperbahn 116;Hamburg;;20359;') ('ADR', [['type', 'HOME'], ['type', 'pref']], ';;Reeperbahn 116;Hamburg;;20359;', 'item1') >>> parseLine(":") Traceback (most recent call last): ... ParseError: 'Failed to parse line: :' |
parseParams(string)>>> parseParams(';ALTREP="http://www.wiz.org"') [['ALTREP', 'http://www.wiz.org']] >>> parseParams('') [] >>> parseParams(';ALTREP="http://www.wiz.org;;",Blah,Foo;NEXT=Nope;BAR') [['ALTREP', 'http://www.wiz.org;;', 'Blah', 'Foo'], ['NEXT', 'Nope'], ['BAR']] |
readComponents(streamOrString, validate=False, transform=True)Generate one Component at a time from a stream.>>> import StringIO >>> f = StringIO.StringIO(testVCalendar) >>> cal=readComponents(f).next() >>> cal <VCALENDAR| [<VEVENT| [<SUMMARY{u'BLAH': [u'hi!']}Bastille Day Party>]>]> >>> cal.vevent[0].summary[0] <SUMMARY{u'BLAH': [u'hi!']}Bastille Day Party> |
readOne(stream, validate=False, transform=True)Return the first component from stream. |
registerBehavior(behavior, name=None, default=False, id=None)Register the given behavior. If default is True (or if this is the first version registered with this name), the version will be the default if no id is given. |
Variable Details |
---|
CR
|
CRLF
|
DEBUG
|
formatter
|
handler
|
LF
|
line_re
|
logger
|
logical_lines_re
|
param_values_re
|
params_re
|
SPACE
|
SPACEORTAB
|
TAB
|
testLines
|
testVCalendar
|
wrap_re
|
__behaviorRegistry
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Fri Dec 14 17:25:16 2007 | http://epydoc.sf.net |