# Path: events/events.py
# KNOWN_ATTRIBUTES = ['start', 'end', 'recurrence', 'allday', 'title', 'description', 'location', 'alarm', 'alarmmin']
# UTC_STRING = """BEGIN:VTIMEZONE
# TZID:UTC
# BEGIN:STANDARD
# DTSTART:20000101T000000
# RRULE:FREQ=YEARLY;BYMONTH=1
# TZNAME:UTC
# TZOFFSETFROM:+0000
# TZOFFSETTO:+0000
# END:STANDARD
# END:VTIMEZONE"""
# ZERO = datetime.timedelta(0)
# HOUR = datetime.timedelta(hours=1)
# class Event(pisiinterfaces.Syncable):
# class UTC(datetime.tzinfo):
# class CustomOffset(datetime.tzinfo):
# class Recurrence:
# class AbstractCalendarSynchronizationModule(pisiinterfaces.AbstractSynchronizationModule):
#     def __init__( self, id, updated, attributes,  attributesToUTF = True):
#     def compare(self,  e):
#     def merge( self, e ):
#     def prettyPrint ( self ):
#     def utcoffset(self, dt):
#     def tzname(self, dt):
#     def dst(self, dt):
#     def __init__(self, name, st):
#     def utcoffset(self, dt):
#     def tzname(self, dt):
#     def dst(self, dt):
#     def __init__(self):
#     def initFromData(self,  data):
#     def initFromAttributes(self,  rrule,  dtstart,  dtend = None,  isAllDay = False):   
#     def getData(self):
#     def getDTStart(self):
#     def getDTEnd(self):
#     def getRRule(self):
#     def isAllDay(self):
#     def __eq__(self,  other):
#     def __ne__(self,  other):
#     def prettyPrint ( self ):
#     def __init__(self,  verbose,  soft,  modulesString,  config,  configsection,  name = "unkown contact source"):
#     def allEvents( self ):
#     def getEvent(self,  id):
#     def addEvent( self, eventInstance ):
#     def replaceEvent( self, id, updatedEvent):
#     def removeEvent( self, id ):
# def assembleID():


from pisiconstants import *
from events import events
import vobject
import datetime
    for x in entries.keys():
        v = entries[x]

        try:
            v.fn
        except AttributeError:
            firstname = _extractAtt(v, 'x.n.value.given')
            lastname = _extractAtt(v, 'x.n.value.family')

            if firstname:
                if lastname:
                    fn =firstname + ' ' +  lastname
                else:
                    fn = firstname
            else:
                fn = lastname
            _createRawAttribute(None,  v,  'fn',  "'''" + fn + "'''")
            
            
#
# PART 3: LOADING (Calendar)
#
def _extractRecurrence(x,  allDay):
    """
    Transforms VObject recurrence information into PISI internal object L{events.Recurrence}
    """
    if _extractAtt(x, 'x.dtend.value'):
        end = x.dtend
    else:
        end = None

# Path: events/events.py
# KNOWN_ATTRIBUTES = ['start', 'end', 'recurrence', 'allday', 'title', 'description', 'location', 'alarm', 'alarmmin']
# UTC_STRING = """BEGIN:VTIMEZONE
# TZID:UTC
# BEGIN:STANDARD
# DTSTART:20000101T000000
# RRULE:FREQ=YEARLY;BYMONTH=1
# TZNAME:UTC
# TZOFFSETFROM:+0000
# TZOFFSETTO:+0000
# END:STANDARD
# END:VTIMEZONE"""
# ZERO = datetime.timedelta(0)
# HOUR = datetime.timedelta(hours=1)
# class Event(pisiinterfaces.Syncable):
# class UTC(datetime.tzinfo):
# class CustomOffset(datetime.tzinfo):
# class Recurrence:
# class AbstractCalendarSynchronizationModule(pisiinterfaces.AbstractSynchronizationModule):
#     def __init__( self, id, updated, attributes,  attributesToUTF = True):
#     def compare(self,  e):
#     def merge( self, e ):
#     def prettyPrint ( self ):
#     def utcoffset(self, dt):
#     def tzname(self, dt):
#     def dst(self, dt):
#     def __init__(self, name, st):
#     def utcoffset(self, dt):
#     def tzname(self, dt):
#     def dst(self, dt):
#     def __init__(self):
#     def initFromData(self,  data):
#     def initFromAttributes(self,  rrule,  dtstart,  dtend = None,  isAllDay = False):   
#     def getData(self):
#     def getDTStart(self):
#     def getDTEnd(self):
#     def getRRule(self):
#     def isAllDay(self):
#     def __eq__(self,  other):
#     def __ne__(self,  other):
#     def prettyPrint ( self ):
#     def __init__(self,  verbose,  soft,  modulesString,  config,  configsection,  name = "unkown contact source"):
#     def allEvents( self ):
#     def getEvent(self,  id):
#     def addEvent( self, eventInstance ):
#     def replaceEvent( self, id, updatedEvent):
#     def removeEvent( self, id ):
# def assembleID():


# Path: vobjecttools.py
from pisiconstants import *
from events import events
import vobject
import datetime

    for x in entries.keys():
        v = entries[x]

        try:
            v.fn
        except AttributeError:
            firstname = _extractAtt(v, 'x.n.value.given')
            lastname = _extractAtt(v, 'x.n.value.family')

            if firstname:
                if lastname:
                    fn =firstname + ' ' +  lastname
                else:
                    fn = firstname
            else:
                fn = lastname
            _createRawAttribute(None,  v,  'fn',  "'''" + fn + "'''")
            
            
#
# PART 3: LOADING (Calendar)
#
def _extractRecurrence(x,  allDay):
    """
    Transforms VObject recurrence information into PISI internal object L{events.Recurrence}
    """
    if _extractAtt(x, 'x.dtend.value'):
        end = x.dtend
    else:
        end = None

    rec = events.Recurrence()