Exemple #1
0
def convert(template, data):
    """generate XHTML from vcard data and kid template
    """
    lines = icslex.unbreak(data)
    template.contacts = contacts(Properties, lines)
    for txt in template.generate(output='xml', encoding='utf-8'):
        yield txt
def convert(template, data):
    """generate XHTML from vcard data and kid template
    """
    lines = icslex.unbreak(data)
    template.contacts = contacts(Properties, lines)
    for txt in template.generate(output='xml', encoding='utf-8'):
        yield txt
def _test():
    import sys
    from pprint import pprint
    import doctest, fromIcal
    doctest.testmod(fromIcal)

    lines = unbreak(open(sys.argv[1]))
    n, p, v = parseLine(lines.next())
    c = []
    findComponents(lines, v, c)
    pprint(c)
Exemple #4
0
def _test():
    import sys
    from pprint import pprint
    import doctest, fromIcal
    doctest.testmod(fromIcal)

    lines = unbreak(open(sys.argv[1]))
    n, p, v = parseLine(lines.next())
    c = []
    findComponents(lines, v, c)
    pprint(c)
def interpret(sx, fp, base=None, suppressed=[]):
    lines = unbreak(fp)
    n, p, v = parseLine(lines.next())

    if v != "VCALENDAR":
        raise SyntaxError("Expected CALENDAR but found: %s" % (v))
    calendars = []
    findComponents(lines, v, calendars)

    attrs = {}
    RDF.bindAttr("rdf", attrs)
    iCalendar.bindAttr("", attrs)
    if base:
        attrs["xml:base"] = base

    sx.startElement("rdf:RDF", attrs)

    doComponents(sx, calendars, iCalendarDefs, suppressed=suppressed)

    sx.endElement("rdf:RDF")
def interpret(sx, fp, base=None, suppressed=[]):
    lines = unbreak(fp)
    n, p, v = parseLine(lines.next())

    if v != 'VCALENDAR':
        raise SyntaxError('Expected CALENDAR but found: %s' % (v))
    calendars = []
    findComponents(lines, v, calendars)

    attrs = {}
    RDF.bindAttr('rdf', attrs)
    iCalendar.bindAttr('', attrs)
    if base:
        attrs['xml:base'] = base

    sx.startElement('rdf:RDF', attrs)

    doComponents(sx, calendars, iCalendarDefs, suppressed=suppressed)

    sx.endElement('rdf:RDF')