public inbox for [email protected]
help / color / mirror / Atom feedFrom: Joao De Almeida Pereira <[email protected]>
To: Rahul Soshte <[email protected]>
Cc: [email protected]
Subject: Re: Trying to work on a feature.
Date: Mon, 26 Mar 2018 19:01:37 +0000
Message-ID: <CAE+jjakJK78KFFVmCkyBARHx=+CUbo41UtxGATk-1Yvmt-ctvg@mail.gmail.com> (raw)
In-Reply-To: <CAKyzeV0BaogfKUxUhP+YagByJbBSJPiTF5T3FMQVQDdxEKV+yg@mail.gmail.com>
References: <CAKyzeV0BaogfKUxUhP+YagByJbBSJPiTF5T3FMQVQDdxEKV+yg@mail.gmail.com>
Hello Rahul,
This issues looks like it is located in the file
pgadmin/tools/sqleditor/__init__.py in the function save_file
Maybe around the code:
# generate full path of file
file_path = unquote(file_data['file_name'])
if hasattr(str, 'decode'):
file_path = unquote(
file_data['file_name']
).encode('utf-8').decode('utf-8')
Sorry if this seams obvious, but we would advise you to:
1 - Extract the function content of save_file to it's own file, something
like pgadmin/tools/sqleditor/utils/save_query_to_file.py
2 - Leave in the__init__.py file a shell function like
@blueprint.route('/save_file/', methods=["PUT", "POST"], endpoint='save_file')
@login_required
def save_file():
"""
This function retrieves file_name and data from request.
and then save the data to the file
"""
if request.data:
file_data = json.loads(request.data, encoding='utf-8')
save_query_to_file = SaveQueryToFile()
save_query_to_file.execute(file_data)
return make_json_response(
data={
'status': True,
}
)
3 - Create some tests around the current behavior of the function, similar
to the ones you can find in pgadmin/tools/sqleditor/utils/tests/*
4 - Create some tests to ensure if no extension is provided that it would
add a default one and implement this new behavior
And you should be set to go
Thanks
Victoria & Joao
On Mon, Mar 26, 2018 at 2:29 PM Rahul Soshte <[email protected]>
wrote:
> I am new to the codebase of pgAdmin4 and I am trying to work on this
> Feature.
>
> https://redmine.postgresql.org/issues/1998
>
> which appends .sql to files when using the feature "Save" or "Save As"
>
> Which files or folders I should be mostly grasping or looking at ?
>
>
>
view thread (2+ messages)
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]
Subject: Re: Trying to work on a feature.
In-Reply-To: <CAE+jjakJK78KFFVmCkyBARHx=+CUbo41UtxGATk-1Yvmt-ctvg@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