Пример #1
0
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@since Aug 15, 2011
@author Mario Steinhoff
"""

__version__ = '$Rev$'

import logging
import os

from core import runlevel
from core.bot import Bot
from core.persistence import SqlAlchemyPersistence

# Load all table definitions
import objects

if __name__ == '__main__':
    config_root = os.environ['FPTBOT_CONFIG']

    bot = Bot(root=config_root, level=logging.INFO)
    bot.init(runlevel.LOCAL_SERVICE)

    persistence = bot.get_subsystem('local-persistence')

    base = SqlAlchemyPersistence.Base
    base.metadata.create_all(persistence.engine)
Пример #2
0
__version__ = '$Rev$'

import datetime

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)
Пример #3
0
__version__ = '$$'

import datetime
import json

from core import runlevel
from core.bot import Bot
from objects.calendar import Calendar, Event
from components.calendar import GoogleBackend

try:
    bot = Bot()
    bot.init(runlevel.NETWORK_SERVICE)

    cc = bot.get_subsystem('calendar-component')
    """
    event = Event(start=datetime.date(2011, 9, 26), end=datetime.date(2011, 9, 27), title="sync-test")
    event = cc.insert_object(event)
    
    scnds = cc.datastore.secondary_backends
    gbe = [scnd for scnd in scnds if isinstance(scnd, GoogleBackend)][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')
Пример #4
0
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@since Aug 15, 2011
@author Mario Steinhoff
"""

__version__ = '$Rev$'

import logging
import os

from core import runlevel
from core.bot import Bot
from core.persistence import SqlAlchemyPersistence

# Load all table definitions
import objects

if __name__ == '__main__':
    config_root = os.environ['FPTBOT_CONFIG']
    
    bot = Bot(root=config_root, level=logging.INFO)
    bot.init(runlevel.LOCAL_SERVICE)
    
    persistence = bot.get_subsystem('local-persistence')
    
    base = SqlAlchemyPersistence.Base
    base.metadata.drop_all(persistence.engine)
Пример #5
0
__version__ = '$$'

import datetime
import json

from core import runlevel
from core.bot import Bot
from objects.calendar import Calendar, Event
from components.calendar import GoogleBackend

try:
    bot = Bot()
    bot.init(runlevel.NETWORK_SERVICE)
    
    cc = bot.get_subsystem('calendar-component')
    """
    event = Event(start=datetime.date(2011, 9, 26), end=datetime.date(2011, 9, 27), title="sync-test")
    event = cc.insert_object(event)
    
    scnds = cc.datastore.secondary_backends
    gbe = [scnd for scnd in scnds if isinstance(scnd, GoogleBackend)][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')
Пример #6
0
import datetime

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