Skip to content

Commit

Permalink
code refactoring in app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ReYaNOW committed Dec 29, 2023
1 parent 2e7bb2e commit 0d74e53
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions page_analyzer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ def create_url_page():
db = Database(connect=True)
found_url = db.get_url_by_name(fixed_url)

if not found_url:
if found_url:
flash('Страница уже существует', 'info')
new_url_id = found_url.id
else:
new_url_id = db.add_new_url(fixed_url)
flash('Страница успешно добавлена', 'success')
return redirect(url_for('get_url', url_id=new_url_id))

url_id = found_url.id
flash('Страница уже существует', 'info')

db.close()
return redirect(url_for('get_url', url_id=url_id))
return redirect(url_for('get_url', url_id=new_url_id))


@app.post('/urls/<int:url_id>/checks')
Expand Down

0 comments on commit 0d74e53

Please sign in to comment.