public inbox for [email protected]
help / color / mirror / Atom feedTrying to work on a feature.
2+ messages / 2 participants
[nested] [flat]
* Trying to work on a feature.
@ 2018-03-26 18:29 Rahul Soshte <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Rahul Soshte @ 2018-03-26 18:29 UTC (permalink / raw)
To: pgadmin-hackers
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 ?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Trying to work on a feature.
@ 2018-03-26 19:01 Joao De Almeida Pereira <[email protected]>
parent: Rahul Soshte <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Joao De Almeida Pereira @ 2018-03-26 19:01 UTC (permalink / raw)
To: Rahul Soshte <[email protected]>; +Cc: pgadmin-hackers
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 ?
>
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-03-26 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 18:29 Trying to work on a feature. Rahul Soshte <[email protected]>
2018-03-26 19:01 ` Joao De Almeida Pereira <[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