Exemplo n.º 1
0
def _format_parameters(old_parameters):
    """
    Parameters are converted to their proper forms.

    :type old_parameters: dict
    :rtype: dict
    """

    #ToDo is this string stripping really neccesary? Probably a misunderstanding of what these symbols mean.

    new_parameters = {key: [] for key in KEYWORDS}
    for el in old_parameters["Groups: "]:
        new_parameters["Groups: "].append(el.replace('\\', ''))
    for el in old_parameters["SUMMARY:"]:
        new_parameters["SUMMARY:"].append(el[:el.find('[')])
    for el in old_parameters["DTEND:"]:
        new_parameters["DTEND:"].append(
            converting.ical_datetime_to_timestamp(el))
    for el in old_parameters["DTSTART:"]:
        new_parameters["DTSTART:"].append(
            converting.ical_datetime_to_timestamp(el))
    for key in KEYWORDS:
        if len(new_parameters[key]) == 0:
            new_parameters[key] = old_parameters[key]
    return new_parameters
Exemplo n.º 2
0
def _format_parameters(old_parameters):
    """
    Parameters are converted to their proper forms.

    :type old_parameters: dict
    :rtype: dict
    """

    #ToDo is this string stripping really neccesary? Probably a misunderstanding of what these symbols mean.

    new_parameters = {key: [] for key in KEYWORDS}
    for el in old_parameters["Groups: "]:
        new_parameters["Groups: "].append(el.replace('\\', ''))
    for el in old_parameters["SUMMARY:"]:
        new_parameters["SUMMARY:"].append(el[:el.find('[')])
    for el in old_parameters["DTEND:"]:
        new_parameters["DTEND:"].append(converting.ical_datetime_to_timestamp(el))
    for el in old_parameters["DTSTART:"]:
        new_parameters["DTSTART:"].append(converting.ical_datetime_to_timestamp(el))
    for key in KEYWORDS:
        if len(new_parameters[key]) == 0:
            new_parameters[key] = old_parameters[key]
    return new_parameters
Exemplo n.º 3
0
 def test_to_timestamp(self):
     import sqlite3
     self.assertEquals(converting.ical_datetime_to_timestamp("DTSTART:20140304T083000Z"),
                       sqlite3.Timestamp(2014, 3, 4, 10, 30, 0))