Skip to content

Commit 35d5231

Browse files
committed
BUG: Fix patch
1 parent 99e90a5 commit 35d5231

File tree

1 file changed

+9
-4
lines changed
  • qiita_db/support_files/patches/python_patches

1 file changed

+9
-4
lines changed
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
from os.path import realpath
2-
from qiita_db.sql_connection import SQLConnectionHandler
2+
from qiita_db.sql_connection import TRN
33

4-
conn = SQLConnectionHandler()
5-
path = conn.execute_fetchone('SELECT base_data_dir FROM settings')[0]
6-
conn.execute("UPDATE settings SET base_data_dir = %s", (realpath(path),))
4+
with TRN:
5+
TRN.add('SELECT base_data_dir FROM settings')
6+
path = TRN.execute_fetchlast()
7+
8+
# if the path is non-canonical (it contains .. or other redundant symbols)
9+
# this will update it, else it will leave as is
10+
TRN.add("UPDATE settings SET base_data_dir = %s", (realpath(path),))
11+
TRN.execute()

0 commit comments

Comments
 (0)