Re: [pgAdmin4]: RM-1910 - Remember last used directory in the file manager

From: Neel Patel <neel(dot)patel(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4]: RM-1910 - Remember last used directory in the file manager
Date: 2016-12-23 06:17:43
Message-ID: CACCA4P0rPdTV+BpCNtgjjLY8GgwwN3gPKUax9m-BxAj0Rf+r-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Dave,

I have tried to reproduce the issue with both python 2 & python3 but no
luck and from the logs, it looks like issue with global name 'transid' not
defined so i don't think we have changed anything in that logic but yes we
need to fix this.

Can you please let me know the steps to reproduce so that i can fix this
issue ?

Thanks,
Neel Patel

On Fri, Dec 16, 2016 at 7:06 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
> On Fri, Dec 16, 2016 at 12:08 PM, Neel Patel
> <neel(dot)patel(at)enterprisedb(dot)com> wrote:
> > Hi Dave,
> >
> > Please find attached patch file with the fix of below suggestion.
> >
> > If the directory that has been remembered no longer exists, then find
> > closest parent directory to set last remembered directory.
> >
> > Do review it and let us know for comments.
>
> When I click the File Open button in the SQL Editor, I now get the
> following exception:
>
> 2016-12-16 13:17:45,049: INFO werkzeug: 127.0.0.1 - - [16/Dec/2016
> 13:17:45] "GET /file_manager/get_trans_id?callback=
> jQuery11120806574590893895_1481894262193&_=1481894262194
> HTTP/1.1" 500 -
> Traceback (most recent call last):
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 2000, in __call__
> return self.wsgi_app(environ, start_response)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1991, in wsgi_app
> response = self.make_response(self.handle_exception(e))
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1567, in handle_exception
> reraise(exc_type, exc_value, tb)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1988, in wsgi_app
> response = self.full_dispatch_request()
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1641, in full_dispatch_request
> rv = self.handle_user_exception(e)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1544, in handle_user_exception
> reraise(exc_type, exc_value, tb)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1639, in full_dispatch_request
> rv = self.dispatch_request()
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1625, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask_login.py",
> line 792, in decorated_view
> return func(*args, **kwargs)
> File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/file_manager/
> __init__.py",
> line 232, in get_trans_id
> data={'fileTransId': transid, 'status': True}
> NameError: global name 'transid' is not defined
>
> Coupled with the following from the JS console:
>
> 13:32:20.605 SyntaxError: JSON.parse: unexpected character at line 1
> column 1 of the JSON data
> <anonymous> utility.js:1182
> <anonymous> utility.js:12
> .globalEval/<() jquery-1.11.2.js:339
> .globalEval() jquery-1.11.2.js:338
> .converters["text script"]() jquery-1.11.2.js:9766
> ajaxConvert() jquery-1.11.2.js:8838
> done() jquery-1.11.2.js:9259
> .send/callback() jquery-1.11.2.js:9713
> .send() jquery-1.11.2.js:9719
> .ajax() jquery-1.11.2.js:9210
> jQuery._evalUrl() jquery-1.11.2.js:9368
> .domManip() jquery-1.11.2.js:5977
> .append() jquery-1.11.2.js:5753
> pgAdmin.FileManager.init/</renderStoragePanel/<() file_manager.js:198
> jQuery.Callbacks/fire() jquery-1.11.2.js:3143
> jQuery.Callbacks/self.fireWith() jquery-1.11.2.js:3255
> done() jquery-1.11.2.js:9309
> .send/callback() jquery-1.11.2.js:9713
> .send() jquery-1.11.2.js:9659
> .ajax() jquery-1.11.2.js:9210
> pgAdmin.FileManager.init/getTransId() file_manager.js:29
> pgAdmin.FileManager.init/</renderStoragePanel() file_manager.js:201
> pgAdmin.FileManager.init/</<.main() file_manager.js:225
> Alertify/<.dialog/this[name]() alertify.js:2965
> pgAdmin.FileManager.show_file_selection() file_manager.js:594
> pgAdmin.FileManager.show_dialog() file_manager.js:605
> ._open_select_file_manager() sqleditor.js:2454
> ._load_file() sqleditor.js:2433
> triggerEvents() backbone.js:208
> Backbone.Events.trigger() backbone.js:148
> SQLEditorView<.on_file_load() sqleditor.js:1498
> bound () self-hosted:752
> jQuery.event.dispatch() jquery-1.11.2.js:4664
> $event.dispatch() jquery.event.drag-2.2.js:374
> jQuery.event.add/elemData.handle() jquery-1.11.2.js:4333
> 1 jquery-1.11.2.js%20line%20339%20%3E%20eval:1182:11
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Surinder Kumar 2016-12-23 07:19:25 Re: [pgAdmin4][Patch]: Fix RM1790 - [Web] Support setting a field's value to "null"
Previous Message Surinder Kumar 2016-12-23 05:54:54 Re: [pgAdmin4][Patch]: Fix RM1790 - [Web] Support setting a field's value to "null"