Ejemplo n.º 1
0
def handle_profile_update(event):
    """ This function is fired off from the horus profile view.
    We have extended the profile to have extra data and we handle that data 
    here 
    """
    request = event.request
    context = request.context
    values = event.values

    email = values['email']
    first_name = values['first_name']
    last_name = values['last_name']
    one_liner = values['one_liner']
    postal = values['postal']

    #language_ids = values['spoken_languages']
    #timezone = values['timezone']

    context.email = email
    context.profile.first_name = first_name
    context.profile.last_name = last_name
    context.profile.one_liner = one_liner

    if postal != context.profile.postal:
        context.profile.postal = postal
        refresh_user_location(request.db_session, context)

    index_users(request, [context])

    request.db_session.commit()
Ejemplo n.º 2
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)

    config_uri = argv[1]
    setup_logging(config_uri)
    env = bootstrap(config_uri)
    settings = env['registry'].settings
    request = env['request']
    engine = engine_from_config(settings, 'sqlalchemy.')
    db_session = scoped_session(sessionmaker())
    db_session.configure(bind=engine)

    if request.search_settings['enabled']:
        setup_user_index(request)

        users = get_users_from_db(db_session, None, None)
        index_users(request, users)
    else:
        log.error("You have elastic search disabled")
Ejemplo n.º 3
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)

    config_uri = argv[1]
    setup_logging(config_uri)
    env = bootstrap(config_uri)
    settings = env['registry'].settings
    request = env['request']
    engine = engine_from_config(settings, 'sqlalchemy.')
    db_session = scoped_session(sessionmaker())
    db_session.configure(bind=engine)

    Base.metadata.drop_all(engine)
    Base.metadata.create_all(engine)

    data = generate_default_data(db_session)

    db_session.commit()

    if request.search_settings['enabled']:
        setup_user_index(request)
        index_users(request, data['users'])