コード例 #1
0
def add_default_user_tags():
    this_folder = os.path.dirname(os.path.realpath(__file__))
    sys.path.append(this_folder + '/../')
    from schemas import base_users as jorm_users
    from settings import API_ENV

    default_user_tags_list = json.loads(
        open('./test/fixtures/user_tags.json').read())

    session = jorm_users.UsersSession()

    for tag in default_user_tags_list:
        existing = session.query(
            jorm_users.UserTag).filter_by(name=tag['name']).scalar()
        if existing:
            print "skipping tag '%s' already in db" % tag['name']
        else:
            session.add(
                jorm_users.UserTag(name=tag['name'],
                                   provenance='system',
                                   active_suggestion=True))
            session.commit()
            print "added tag '%s'" % tag['name']

    session.close()
コード例 #2
0
def add_default_folders():
    session = jorm_users.UsersSession()
    for folder in folders:
        session.add(jorm_users.UserFolder(folder))
    session.commit()
    session.close()
コード例 #3
0
def add_insight_data():
    session = jorm_users.UsersSession()
    for datum in insight_data:
        session.add(jorm_users.InsightsTable(datum))
    session.commit()
    session.close()
コード例 #4
0
def add_subscription():
    session = jorm_users.UsersSession()
    session.add(jorm_users.Subscription(subscription))
    session.commit()
    session.close()
コード例 #5
0
def add_coupons():
    session = jorm_users.UsersSession()
    for coupon in coupons:
        session.add(jorm_users.Coupon(coupon))
    session.commit()
    session.close()
コード例 #6
0
def add_plans():
    session = jorm_users.UsersSession()
    for plan in plans:
        session.add(jorm_users.Plan(plan))
    session.commit()
    session.close()
コード例 #7
0
def add_word_cloud():
    session = jorm_users.UsersSession()
    session.add(jorm_users.ActWordCount(word_cloud))
    session.commit()
    session.close()
コード例 #8
0
def add_users():
    session = jorm_users.UsersSession()
    session.add(jorm_users.User(user))
    session.commit()
    session.close()