Пример #1
0
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)
        
        one = True

    for event in dataloader.get_events(cursor, dataloader.Parameters.event_categories):
        
        newEvent = Event()
Пример #2
0
 def get_dates(self):
     return Calendar.get_month_dates(self.today.year, self.today.month + 1)
Пример #3
0
 def get_dates(self):
     return Calendar.get_week_dates(self.today.year,
                                    self.today.isocalendar()[1] + 1)
Пример #4
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)
Пример #5
0
    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)

        one = True

    for event in dataloader.get_events(cursor,
                                       dataloader.Parameters.event_categories):
Пример #6
0
    bot.init(runlevel.LOCAL_SERVICE)
    
    bot.start_subsystem('sqlite-persistence')
    sqlite = bot.get_subsystem('sqlite-persistence')
    calendar = bot.get_subsystem('calendar-component')
    
    logger = bot.get_logger('tools.import.contacts')
    
    contacts_to_insert = []
    calendar_to_insert = []
    
    for event in dataloader.get_events(sqlite.get_cursor(), [dataloader.Parameters.birthday_category]):
        contact = Contact()
        contact.nickname = event['Name']
        contact.birthday = datetime.datetime.strptime(event['Date_B'], '%Y-%m-%d')
        
        logger.info('adding item: %s', contact)
        #calendar.insert_object(contact)
    
    for category in dataloader.get_categories(sqlite.get_cursor(), [dataloader.Parameters.birthday_category]):
        calendar = Calendar()
        calendar.title = category['Name']
        calendar.color = category['Color'][1:]
        calendar.location = dataloader.Parameters.default_location
        calendar.authority = LocalBirthdayAuthority.NAME
        
        logger.info('added item: %s', calendar)
        #calendar.insert_object(contact)
    
    bot.init(runlevel.HALT)