master
janko 2022-10-31 18:22:26 +01:00
parent d53a3dfda0
commit a5de5f9e35
4 changed files with 3 additions and 19 deletions

View File

@ -12,16 +12,12 @@ options = {
}
client = Client(options)
print(dir(client))
def get_file_list():
return client.list("/GIA CLOUD")
for file in get_file_list():
link = client.get_url(file)
print(link)
link = client.get_url(file)
info = client.info("/GIA CLOUD")
info = client.info("/GIA CLOUD")

View File

@ -14,8 +14,6 @@ name = seznam[0].get_name()
public_share = nc.share_file_with_link("/GIA CLOUD/"+name)
public_link= public_share.get_link()+"/download/"+name
print(public_link)
def test_file():
return public_link

View File

@ -13,9 +13,7 @@ def get_settings(user_id):
#tu rešujejo none user bug, ki se pojavi, ko na novo reg user, ni zazznan v querryju
# zdaj imamo problem clasha med globalno in lokalno spremenljivko "dbsession"
if user == None:
print("user je bil none")
user = dbsession.query(User).get(user_id)
print("User je: ", user)
settings_db = user.settings
if settings_db == "":
@ -29,7 +27,6 @@ def get_settings(user_id):
settings_dict = json.loads(settings_db)
dbsession.close()
print("this is it: ", settings_dict)
return settings_dict
@ -47,8 +44,6 @@ def save_settings():
return render_template("settings.html", username=username, settings=settings_old)
if request.method == "POST":
print('this is the form ', request.form)
#request form stuff
settings_dict = {
"max_new" : request.form.get('max_new', False),
@ -56,9 +51,7 @@ def save_settings():
"max_shared" : request.form.get('max_shared', False),
}
print('this is the dict: ', settings_dict)
settings_json = json.dumps(settings_dict)
print('this is the json: ', settings_json)
user = dbsession.query(User).get(user_id)
user.settings = settings_json

View File

@ -23,7 +23,6 @@ def share(card, user_id):
#skip če že ima ta card v db.
existing = dbsession.query(Card).filter(Card.title == card.title, Card.owner_id==user.id).all()
if existing == []:
print("sharing to, ", user.id)
new_card = card = Card(title=card.title, interest_rate=-1.0, owner_id=user.id, item_location=card.item_location, last_review=None, share_id=h)
dbsession.add(new_card)
dbsession.commit()
@ -31,7 +30,6 @@ def share(card, user_id):
def get_all_shared(user_id):
"""adds all existing shared cards to this users collection"""
print("DODAJAMO VSE KARTE TEMU NOVEMU USERJU")
dbsession = get_session()
#get all cards with a shared id but make suer they are unique. add them to collection of user
@ -41,5 +39,4 @@ def get_all_shared(user_id):
for c in all_shared_cards:
new_card = Card(title= c.title, interest_rate=-1.0, owner_id=user_id, item_location=c.item_location, last_review=None, share_id=c.share_id)
dbsession.add(new_card)
dbsession.commit()
print(c.title, c.share_id, c.item_location)
dbsession.commit()