def get_or_create_shop(name):
    shop = db.session.query(sql.wc_Shop).filter_by(name=name).first()
    if shop:
        return shop
    else:
        shop = sql.wc_Shop(name=name)
        db.session.add(shop)
        db.session.commit()
        return shop
def __insert_shops():
    '''Inserting all shops from workpass'''
    pkl_shops = ptd.shops(workpass, "Устройство.магазины")
    dbshops = [dbs[0] for dbs in db.session.query(sql.wc_Shop.name).all()]
    for s in pkl_shops:
        if not s.decode('utf-8') in dbshops:
            shop = sql.wc_Shop(name=s)
            db.session.add(shop)
    db.session.commit()
def __insert_shops():
    '''Inserting all shops from workpass'''
    pkl_shops = ptd.shops(workpass, "Устройство.магазины")
    dbshops = [dbs[0] for dbs in db.session.query(sql.wc_Shop.name).all()]
    for s in pkl_shops:
        if not s.decode('utf-8') in dbshops:
            shop = sql.wc_Shop(name=s)
            db.session.add(shop)
    db.session.commit()