Skip to content

Commit e39cd16

Browse files
committed
renamed function to follow convention of naming
1 parent 8e780d2 commit e39cd16

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

web/server/codechecker_server/api/product_server.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,11 @@ def getProductConfiguration(self, product_id):
311311
return prod
312312

313313
@timeit
314-
def addProduct_Support(self,product_info):
314+
def add_product_support(self, product_info):
315315
"""
316316
Creates a database for the given product,
317-
to assist add product function that connect to already existing database
317+
to assist add product function that connect to
318+
already existing database
318319
"""
319320
# Extract connection details
320321
if product_info.engine == 'sqlite':
@@ -326,13 +327,13 @@ def addProduct_Support(self,product_info):
326327
db_port = int(product_info.port)
327328
db_user = convert.from_b64(product_info.username_b64)
328329
db_pass = convert.from_b64(product_info.password_b64)
329-
db_name = product_info.database if product_info.database else None
330+
db_name = product_info.database or None
330331
if db_name is None:
331-
raise Exception("Database name is not provided")
332-
except Exception as e:
333-
raise Exception("Invalid connection details")
332+
raise ValueError("Database name is not provided")
333+
except Exception as x:
334+
raise ValueError("Invalid database connection details") from x
334335

335-
# Create an engine for database to connect and create a new database
336+
# Create an engine for database to connect to
336337
engine_url = URL.URL(
337338
drivername=db_engine,
338339
username=db_user,
@@ -344,7 +345,8 @@ def addProduct_Support(self,product_info):
344345
engine = create_engine(engine_url)
345346
conn = engine.connect()
346347
conn.execute("commit")
347-
#check connection
348+
349+
# check connection
348350
try:
349351
conn.execute(f"CREATE DATABASE {db_name}")
350352
return True
@@ -358,7 +360,7 @@ def addProduct_Support(self,product_info):
358360
return False
359361

360362
@timeit
361-
def addProduct(self, product): # work in progress
363+
def addProduct(self, product):
362364
"""
363365
Add the given product to the products configured by the server.
364366
"""

0 commit comments

Comments
 (0)