Exemple #1
0
def send(dbcal, calendar, client):
    n = 0
    for obj in dbcal.event_set.filter(user_modified=True):
        dblogger.info("Gonna send %s", obj)
        n += 1

        mycal = vobject.iCalendar()
        #~ mycal.add('vevent')

        #~ mycal = vobject.iCalendar()
        #~ vevent = vobject.newFromBehavior('vevent', '2.0')
        vevent = mycal.add('vevent')
        vevent.add('uid').value = obj.uid
        vevent.add('dtstamp').value = obj.modified
        if obj.start_time:
            vevent.add('dtstart').value = datetime.datetime.combine(
                obj.start_date, obj.start_time)
        else:
            vevent.add('dtstart').value = obj.start_date
        if obj.end_time:
            vevent.add('dtend').value = datetime.datetime.combine(
                obj.end_date, obj.end_time)
        else:
            vevent.add('dtend').value = obj.end_date
        vevent.add('transp').value = iif(
            obj.transparent, 'TRANSPARENT', 'OPAQUE')
        vevent.add('summary').value = obj.summary
        if obj.place:
            vevent.add('location').value = obj.place.name
        vevent.add('description').value = obj.description
        event = caldav.Event(
            client, data=mycal.serialize(), parent=calendar).save()
    dblogger.info("--> Sent %d events to calendar server.", n)
Exemple #2
0
def send(dbcal, calendar, client):
    n = 0
    for obj in dbcal.event_set.filter(user_modified=True):
        dblogger.info("Gonna send %s", obj)
        n += 1

        mycal = vobject.iCalendar()
        #~ mycal.add('vevent')

        #~ mycal = vobject.iCalendar()
        #~ vevent = vobject.newFromBehavior('vevent', '2.0')
        vevent = mycal.add('vevent')
        vevent.add('uid').value = obj.uid
        vevent.add('dtstamp').value = obj.modified
        if obj.start_time:
            vevent.add('dtstart').value = datetime.datetime.combine(
                obj.start_date, obj.start_time)
        else:
            vevent.add('dtstart').value = obj.start_date
        if obj.end_time:
            vevent.add('dtend').value = datetime.datetime.combine(
                obj.end_date, obj.end_time)
        else:
            vevent.add('dtend').value = obj.end_date
        vevent.add('transp').value = iif(
            obj.transparent, 'TRANSPARENT', 'OPAQUE')
        vevent.add('summary').value = obj.summary
        if obj.place:
            vevent.add('location').value = obj.place.name
        vevent.add('description').value = obj.description
        event = caldav.Event(
            client, data=mycal.serialize(), parent=calendar).save()
    dblogger.info("--> Sent %d events to calendar server.", n)
Exemple #3
0
 def format_value(self, ar, v):
     return force_unicode(iif(v, _("Yes"), _("No")))
Exemple #4
0
def par2person(row, person):
    person.is_active = iif(row['IDPRT'] == 'I', False, True)
    if row['IDPRT'] == 'S':
        person.is_cpas = True
    elif row['IDPRT'] == 'A':
        person.is_senior = True
Exemple #5
0
 def format_value(self, ar, v):
     return force_text(iif(v, _("Yes"), _("No")))
Exemple #6
0
 def __repr__(self):
     return "ConfigDir %s" % self.name + iif(
         self.writeable, " (writeable)", "")
Exemple #7
0
def par2person(row, person):
    person.is_active = iif(row['IDPRT'] == 'I', False, True)
    if row['IDPRT'] == 'S':
        person.is_cpas = True
    elif row['IDPRT'] == 'A':
        person.is_senior = True
Exemple #8
0
 def __repr__(self):
     return "ConfigDir %s" % self.name + iif(self.writeable, " (writeable)",
                                             "")
Exemple #9
0
 def format_value(self, ar, v):
     return force_text(iif(v, _("Yes"), _("No")))
Exemple #10
0
 def format_value(self, ar, v):
     return force_unicode(iif(v, _("Yes"), _("No")))