Exemplo n.º 1
0
from core import runlevel
from core.bot import Bot
from objects.calendar import Calendar, Event
from components.calendar import LocalUserAuthority
from tools import dataloader

if __name__ == '__main__':
    bot = Bot()
    bot.register_subsystem('sqlite-persistence', 'core.persistence.SqlitePersistence', sqlite_file=dataloader.Parameters.source)
    bot.init(runlevel.NETWORK_SERVICE)
    
    sqlite = bot.get_subsystem('sqlite-persistence')
    cursor = sqlite.get_cursor()
    calendar = bot.get_subsystem('calendar-component')
    
    logger = bot.get_logger('tools.import.contacts')
    
    calendar_references = {}
    
    for category in dataloader.get_categories(cursor, dataloader.Parameters.event_categories):
        newCalendar = Calendar()
        newCalendar.title = category['Name']
        newCalendar.color = category['Color'][1:]
        newCalendar.location = dataloader.Parameters.default_location
        newCalendar.authority = LocalUserAuthority.NAME
        
        logger.info('adding item: %s', newCalendar)
        
        calendar_references[category['CatID']] = newCalendar
        calendar.insert_object(newCalendar)
        
Exemplo n.º 2
0
    query = cc.datastore.get_query('event_by_id')
    local_id = [identity for identity in event.identities if identity.backend.typename == 'GoogleBackend'][0]
    
    query.id = json.loads(local_id.identity)['edit']
    
    gev = gbe.find_objects(query)
    
    query = cc.datastore.get_query('all_calendars_feed')
    
    for i, calendar in enumerate(gbe.find_objects(query).entry):
        print calendar.title.text
        print calendar.id.text
        
        print calendar.find_url(gbe.LINK_EVENTFEED)
        
        print "---"
    """
    
    calendar = Calendar(title='Party')
    cc.insert_object(calendar)
    
    event = Event(calendar=calendar, start=datetime.date(2011, 9, 30), end=datetime.date(2011, 10, 1), title="g******g bei baums mutter")
    cc.insert_object(event)
    

except:
    bot.get_logger().exception('Unhandled exception')

finally:
    bot.init(runlevel.HALT)
Exemplo n.º 3
0
    
    query.id = json.loads(local_id.identity)['edit']
    
    gev = gbe.find_objects(query)
    
    query = cc.datastore.get_query('all_calendars_feed')
    
    for i, calendar in enumerate(gbe.find_objects(query).entry):
        print calendar.title.text
        print calendar.id.text
        
        print calendar.find_url(gbe.LINK_EVENTFEED)
        
        print "---"
    """

    calendar = Calendar(title='Party')
    cc.insert_object(calendar)

    event = Event(calendar=calendar,
                  start=datetime.date(2011, 9, 30),
                  end=datetime.date(2011, 10, 1),
                  title="g******g bei baums mutter")
    cc.insert_object(event)

except:
    bot.get_logger().exception('Unhandled exception')

finally:
    bot.init(runlevel.HALT)
Exemplo n.º 4
0
from objects.calendar import Calendar, Event
from components.calendar import LocalUserAuthority
from tools import dataloader

if __name__ == '__main__':
    bot = Bot()
    bot.register_subsystem('sqlite-persistence',
                           'core.persistence.SqlitePersistence',
                           sqlite_file=dataloader.Parameters.source)
    bot.init(runlevel.NETWORK_SERVICE)

    sqlite = bot.get_subsystem('sqlite-persistence')
    cursor = sqlite.get_cursor()
    calendar = bot.get_subsystem('calendar-component')

    logger = bot.get_logger('tools.import.contacts')

    calendar_references = {}

    for category in dataloader.get_categories(
            cursor, dataloader.Parameters.event_categories):
        newCalendar = Calendar()
        newCalendar.title = category['Name']
        newCalendar.color = category['Color'][1:]
        newCalendar.location = dataloader.Parameters.default_location
        newCalendar.authority = LocalUserAuthority.NAME

        logger.info('adding item: %s', newCalendar)

        calendar_references[category['CatID']] = newCalendar
        calendar.insert_object(newCalendar)