public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][Patch]: Wrong listing of directories in File Manager in Windows Only.
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][Patch]: Wrong listing of directories in File Manager in Windows Only.
@ 2016-09-05 09:51 Surinder Kumar <[email protected]>
2016-09-05 16:07 ` Re: [pgAdmin4][Patch]: Wrong listing of directories in File Manager in Windows Only. Dave Page <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Surinder Kumar @ 2016-09-05 09:51 UTC (permalink / raw)
To: pgadmin-hackers
Hi
*Issue:*
FileManager: when Select File dialog is opened in query tool in Runtime
Mode, it was listing wrong directory. instead it should list drives such as
C:\, D:\, E:\ etc if no STORAGE_DIR path is set in config_local.py. This is
a regression of RM 1937.
*Solution:*
we do list drives, If platform is Windows and If self.dir is set to None,
but self.dir is set to empty string inside __init__ constructor. This is
the reason it wasn't listing drives.
I have taken care it in this patch and tested it for following platforms:
Windows,
Ubuntu and
Mac.
Please find attached patch and review.
Thanks,
Surinder Kumar
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] FileManager_show_drives_windows.patch (2.9K, 3-FileManager_show_drives_windows.patch)
download | inline diff:
diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py
index 24e81dd..e262208 100644
--- a/web/pgadmin/misc/file_manager/__init__.py
+++ b/web/pgadmin/misc/file_manager/__init__.py
@@ -249,8 +249,7 @@ class Filemanager(object):
)
self.dir = get_storage_directory()
- if ((self.dir is not None and isinstance(self.dir, list)) or
- self.dir is None):
+ if (self.dir is not None and isinstance(self.dir, list)):
self.dir = ""
@staticmethod
@@ -568,7 +567,7 @@ class Filemanager(object):
'Code': 1
}
- dir = self.dir
+ dir = self.dir if self.dir is not None else ''
# check if it's dir
if old[-1] == '/':
old = old[:-1]
@@ -620,7 +619,7 @@ class Filemanager(object):
'Code': 1
}
- dir = self.dir
+ dir = self.dir if self.dir is not None else ''
orig_path = "{0}{1}".format(dir, path)
err_msg = ''
@@ -653,7 +652,7 @@ class Filemanager(object):
'Code': 1
}
- dir = self.dir
+ dir = self.dir if self.dir is not None else ''
err_msg = ''
code = 1
try:
@@ -674,14 +673,13 @@ class Filemanager(object):
'Error': err_msg,
'Code': code
}
-
return result
def is_file_exist(self, path, name, req=None):
"""
Checks whether given file exists or not
"""
- dir = self.dir
+ dir = self.dir if self.dir is not None else ''
err_msg = ''
code = 1
name = unquote(name)
@@ -733,7 +731,7 @@ class Filemanager(object):
'Code': 1
}
- dir = self.dir
+ dir = self.dir if self.dir is not None else ''
newName = name
if dir != "":
newPath = dir + '/' + path + newName + '/'
@@ -775,7 +773,7 @@ class Filemanager(object):
'Code': 1
}
- dir = self.dir
+ dir = self.dir if self.dir is not None else ''
orig_path = "{0}{1}".format(dir, path)
name = path.split('/')[-1]
content = open(orig_path, 'r')
diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
index baa71b1..8d891fd 100755
--- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
+++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
@@ -1488,8 +1488,7 @@ if (has_capability(data, 'upload')) {
setTimeout(function() {}, 10000);
},
success: function(file, response) {
- var response = jQuery.parseJSON(response),
- data = response.data.result,
+ var data = response.data.result,
$this = $(file.previewTemplate);
if (data.Code == 0) {
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][Patch]: Wrong listing of directories in File Manager in Windows Only.
2016-09-05 09:51 [pgAdmin4][Patch]: Wrong listing of directories in File Manager in Windows Only. Surinder Kumar <[email protected]>
@ 2016-09-05 16:07 ` Dave Page <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2016-09-05 16:07 UTC (permalink / raw)
To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers
Thanks, applied.
On Mon, Sep 5, 2016 at 10:51 AM, Surinder Kumar
<[email protected]> wrote:
> Hi
>
> Issue:
> FileManager: when Select File dialog is opened in query tool in Runtime
> Mode, it was listing wrong directory. instead it should list drives such as
> C:\, D:\, E:\ etc if no STORAGE_DIR path is set in config_local.py. This is
> a regression of RM 1937.
>
> Solution:
> we do list drives, If platform is Windows and If self.dir is set to None,
> but self.dir is set to empty string inside __init__ constructor. This is the
> reason it wasn't listing drives.
> I have taken care it in this patch and tested it for following platforms:
> Windows,
> Ubuntu and
> Mac.
>
> Please find attached patch and review.
>
>
> Thanks,
> Surinder Kumar
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-09-05 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-05 09:51 [pgAdmin4][Patch]: Wrong listing of directories in File Manager in Windows Only. Surinder Kumar <[email protected]>
2016-09-05 16:07 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox