From f7a7512a794a974e52061dad81ca50856569123f Mon Sep 17 00:00:00 2001 From: Charitha Madusanka Date: Thu, 9 May 2019 12:12:09 +0530 Subject: [PATCH 1/5] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..dd84ea78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 20934adede90f087412afdd6d2a30a3c7c267ea3 Mon Sep 17 00:00:00 2001 From: Charitha Madusanka Date: Sun, 23 Jun 2019 10:28:57 +0530 Subject: [PATCH 2/5] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..9d4faec3 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL From bd36195a02250b94cce9cf6ba3c46856fee3fe95 Mon Sep 17 00:00:00 2001 From: Milindu Sanoj Kumarage Date: Sun, 28 Jul 2019 10:24:34 +0530 Subject: [PATCH 3/5] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9d4faec3..b0fe6fc4 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username +open_collective: agentmilindu ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From 79dc87bfc07e61ef1cc41405fabdcacb90ee2a08 Mon Sep 17 00:00:00 2001 From: Milindu Sanoj Kumarage Date: Sun, 28 Jul 2019 10:25:21 +0530 Subject: [PATCH 4/5] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index b0fe6fc4..42aacc5c 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: # Replace with a single Patreon username -open_collective: agentmilindu +open_collective: bassa ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From 16804a438963cd22166ad0ec802ddd88cea40f15 Mon Sep 17 00:00:00 2001 From: BLasan Date: Tue, 24 Mar 2020 19:56:03 +0530 Subject: [PATCH 5/5] fixed:UserManager.py and DownloadManager.py MySQLdb bugs modifications added unused errors resolved --- components/core/DownloadManager.py | 43 +++++++++++++++--------------- components/core/UserManager.py | 28 +++++++++---------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/components/core/DownloadManager.py b/components/core/DownloadManager.py index 9c1f2906..6428ccf8 100644 --- a/components/core/DownloadManager.py +++ b/components/core/DownloadManager.py @@ -1,5 +1,5 @@ from Models import Download, Status -from DBCon import * +from DBCon import get_db_con,MySQLdb import time import sys import sqlalchemy.pool as pool @@ -23,7 +23,7 @@ def add_download(download): try: cursor.execute(sql, (download.link, download.userName, int(time.time()), download_name)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() # Shows error thrown up by database print(e) @@ -46,7 +46,7 @@ def remove_download(id, userName): return "Download started. Entry cannot be deleted." cursor.execute(sql, [str(id), userName]) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -67,7 +67,7 @@ def rate_download(id, userName, rate): cursor.execute(sql, (userName, id, rate)) db.commit() update_rate(id) - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -85,7 +85,7 @@ def update_rate(id): data = cursor.fetchone() cursor.execute(sql, (data[0], id)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -103,7 +103,7 @@ def get_downloads_user(userName, limit): results = cursor.fetchall() db.close() return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -119,7 +119,7 @@ def get_downloads(limit): results = cursor.fetchall() db.close() return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -138,7 +138,7 @@ def update_status_gid(gid, status, completed=False): else: cursor.execute(sql, (status, gid)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -153,7 +153,7 @@ def set_gid(id, gid): try: cursor.execute(sql) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -167,7 +167,7 @@ def set_name(gid, name): try: cursor.execute(sql, (name, gid)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -181,7 +181,7 @@ def set_size(gid, size): try: cursor.execute(sql, (size, gid)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -201,7 +201,7 @@ def get_to_download(): if verbose: print ("LIST", results) downloads = [Download(result['link'], result['user_name'], result['id']) for result in results] return downloads - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -213,7 +213,7 @@ def set_path(gid, path): try: cursor.execute(sql, (path, gid)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -232,7 +232,7 @@ def get_download_path(id): path = results['path'] db.close() return path - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -249,12 +249,11 @@ def get_download_email(gid): path = results['email'] db.close() return path - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" def get_to_delete(time, rate): - recordsPerPage = 15 db = threadpool.connect() if db is not None: cursor = db.cursor() @@ -266,7 +265,7 @@ def get_to_delete(time, rate): if verbose: print ("Time", time, "Rate", rate) if verbose: print ("results", results) return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -278,7 +277,7 @@ def set_delete_status(path): try: cursor.execute(sql) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -298,7 +297,7 @@ def get_download_status(id): status = results['status'] db.close() return status - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -315,7 +314,7 @@ def get_id_from_gid(gid): status = results['id'] db.close() return status - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -332,7 +331,7 @@ def get_username_from_gid(gid): status = results['user_name'] db.close() return status - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -350,6 +349,6 @@ def get_gid_from_id(id): gid = results['gid'] db.close() return gid - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" diff --git a/components/core/UserManager.py b/components/core/UserManager.py index 5d95f9e6..f73b768a 100644 --- a/components/core/UserManager.py +++ b/components/core/UserManager.py @@ -1,5 +1,5 @@ from Models import User -from DBCon import * +from DBCon import get_db_con,MySQLdb from ConfReader import get_conf_reader import sqlalchemy.pool as pool @@ -69,7 +69,7 @@ def add_user(user): try: cursor.execute(sql, (user.userName, user.password, user.auth, user.email)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -83,9 +83,9 @@ def add_regular_user(user): try: cursor.execute(sql, (user.userName, user.password, user.auth, user.email)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.IntegrityError: db.rollback() - return e[1] + return "username taken" return "success" return "db connection error" @@ -97,7 +97,7 @@ def remove_user(username): try: cursor.execute(sql, (username)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -112,7 +112,7 @@ def update_user(user, username): try: cursor.execute(sql, (user.userName, user.auth, user.email, username)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -128,7 +128,7 @@ def get_users(): results = cursor.fetchall() db.close() return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -142,7 +142,7 @@ def get_blocked_users(): results = cursor.fetchall() db.close() return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -154,7 +154,7 @@ def block_user(username): try: cursor.execute(sql, (1, username)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -168,7 +168,7 @@ def unblock_user(username): try: cursor.execute(sql, (0, username)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -184,7 +184,7 @@ def get_signup_requests(): results = cursor.fetchall() db.close() return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -196,7 +196,7 @@ def approve_user(username): try: cursor.execute(sql, (1, username)) db.commit() - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: db.rollback() return e[1] return "success" @@ -213,7 +213,7 @@ def get_heavy_users(): results = cursor.fetchall() db.close() return results - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error" @@ -233,6 +233,6 @@ def check_if_bandwidth_exceeded(username): else: return False return result - except MySQLdb.Error as e: + except MySQLdb._mysql.Error as e: return e[1] return "db connection error"