public inbox for [email protected]
help / color / mirror / Atom feedFrom: Rahul Soshte <[email protected]>
To: Murtuza Zabuawala <[email protected]>
Cc: Joao De Almeida Pereira <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch][Feature #1998] Appends .sql if extension not given when using 'save' or 'save as' feature
Date: Sat, 14 Apr 2018 16:50:00 +0530
Message-ID: <CAKyzeV0FMhwH8UvxDN9XgE7nUdU5zh7jXKuB5=ow10N=7wkvNg@mail.gmail.com> (raw)
In-Reply-To: <CAKyzeV3rObAuH_QRA7wredF+rA516TKHWZRxKCryeY6tReJOxQ@mail.gmail.com>
References: <CAKyzeV1fMB6rPMF+LCMY7B6_2-j7DZfmh307dBFemtR=4taX6g@mail.gmail.com>
<CAE+jjam7ks2X=x5WoEp7WEn4tLNzw8Gzu+Mqx1sUm0OUu4Md-A@mail.gmail.com>
<CAKKotZR_c5xJ+U-4bYQJ0DJHvDPxPK1aWOi7b7APFhNzpr1F9w@mail.gmail.com>
<CAKyzeV0yp3-W2-=aBW38bg5zqEf44JqTnfPAtxra6ZwgwArHkw@mail.gmail.com>
<CAKKotZQwA=x1COBZ=GhC1inE1aOk43Y4sjyKBLq4tkUz7H8NiA@mail.gmail.com>
<CAKKotZSCFBnwZxwGH3VKUnNYtXJFjqBePxt3LBCs=8PPYBT3cw@mail.gmail.com>
<CAKyzeV1eoSyT-YWac=OA_kjA1aDtV+1v3+fYop+WhBAXLwq8+g@mail.gmail.com>
<CAKKotZRiEnSjtwDNx3XAW-MsjKCXsut+k_CJS0kjXij_9jeE3g@mail.gmail.com>
<CAKyzeV3-6yVGRj0i8ZU-4Y-ysgfHk3sRiJm4cTwi=KonMJNgrQ@mail.gmail.com>
<CAKKotZRcx4ZcQ2+gfa3zLf4nH12DHCbZOi2P+iM3bewP_38hGA@mail.gmail.com>
<CAKyzeV3ciT_L9OoOG8XcxQPNsCokvwgduhGM0Cha0FtXW7damA@mail.gmail.com>
<CAKKotZR9JEQm8rA21Cx-buLQUxKXQixoTY8wWfu=bov0pPXAiw@mail.gmail.com>
<CAKyzeV3UzJe-SvykiG-kK701GpHHkG=GGVL_FBRGwSpvNK8nqA@mail.gmail.com>
<CAKyzeV3rObAuH_QRA7wredF+rA516TKHWZRxKCryeY6tReJOxQ@mail.gmail.com>
On Sat, Apr 14, 2018 at 4:49 PM, Rahul Soshte <[email protected]>
wrote:
> Also attaching my web/pgadmin/tools/sqleditor/static/sqleditor.js
> my _save_file_handler code
>
>
>
>
>
> On Sat, Apr 14, 2018 at 4:46 PM, Rahul Soshte <[email protected]>
> wrote:
>
>> Hi,
>>
>> I have been partially able to solve the problem as you can see in the
>> image. When I select sql in format combobox then only the .sql extension is
>> added.
>>
>>
>>
>>
>> But another issue has arisen. Once the file is saved and now When I
>> change the text in the CodeMirror , the save button is enabled and then
>> when I click on it , a error message pops.The problem is whenever I try to
>> save a file for the first time the code works ,but the 2nd time
>> I try to save it,the code faulters.
>>
>> Error message is as follows:
>>
>> Traceback (most recent call last):
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1997, in __call__
>> return self.wsgi_app(environ, start_response)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1985, in wsgi_app
>> response = self.handle_exception(e)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1540, in handle_exception
>> reraise(exc_type, exc_value, tb)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1982, in wsgi_app
>> response = self.full_dispach_request()
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1614, in full_dispatch_request
>> rv = self.handle_user_exception(e)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1517, in handle_user_exception
>> reraise(exc_type, exc_value, tb)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1612, in full_dispatch_request
>> rv = self.dispatch_request()
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask/app.py",
>> line 1598, in dispatch_request
>> return self.view_functions[rule.endpoint](**req.view_args)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/flask_login.py",
>> line 792, in decorated_view
>> return func(*args, **kwargs)
>> File "/var/www/flask/pgadmin4/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
>> line 1314, in save_file
>> 'file_path': file_path
>> File "/var/www/flask/pgadmin4/pgadmin4/web/pgadmin/utils/ajax.py",
>> line 61, in make_json_response
>> separators=(',', ':')),
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/simplejson/__init__.py",
>> line 399, in dumps
>> **kw).encode(obj)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py",
>> line 291, in encode
>> chunks = self.iterencode(o, _one_shot=True)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py",
>> line 373, in iterencode
>> return _iterencode(o, 0)
>> File "/var/www/flask/pgadmin4/pgadmin4/web/pgadmin/utils/ajax.py",
>> line 30, in default
>> return json.JSONEncoder.default(self, obj)
>> File "/var/www/flask/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py",
>> line 268, in default
>> o.__class__.__name__)
>> TypeError: Object of type Response is not JSON serializable
>>
>> I pass an array which contains the file_name and file_type in
>> /pgadmin/misc/file_manager/static/js/file_manager.js
>>
>>
>>
>> Also I have done similar changes around line 678.
>>
>> Also in web/pgadmin/tools/sqleditor/__init__.py I have made the
>> folllowing changes
>>
>>
>>
>> Also I have attached my web/pgadmin/tools/sqleditor/ut
>> ils/save_file_query_to_file_utils.py
>>
>
>
Attachments:
[image/png] image.png (24.9K, 3-image.png)
download | view image
[image/png] image.png (29.1K, 4-image.png)
download | view image
[image/png] image.png (64.0K, 5-image.png)
download | view image
[image/png] image.png (62.4K, 6-image.png)
download | view image
[image/png] image.png (62.9K, 7-image.png)
download | view image
[image/png] image.png (64.0K, 8-image.png)
download | view image
view thread (20+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: [pgAdmin4][Patch][Feature #1998] Appends .sql if extension not given when using 'save' or 'save as' feature
In-Reply-To: <CAKyzeV0FMhwH8UvxDN9XgE7nUdU5zh7jXKuB5=ow10N=7wkvNg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox