Re: Trying to work on a feature.

Поиск
Список
Период
Сортировка
От Joao De Almeida Pereira
Тема Re: Trying to work on a feature.
Дата
Msg-id CAE+jjakJK78KFFVmCkyBARHx=+CUbo41UtxGATk-1Yvmt-ctvg@mail.gmail.com
обсуждение исходный текст
Ответ на Trying to work on a feature.  (Rahul Soshte <rahulsoshte360@gmail.com>)
Список 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 <rahulsoshte360@gmail.com> 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 ?


В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Joao De Almeida Pereira
Дата:
Сообщение: Re: [pgAdmin4][Patch]: RM #1978 - Add an option to allow user todisable alertifyjs and acitree animations
Следующее
От: Robert Eckhardt
Дата:
Сообщение: Re: [pgAdmin4][RM#3055] Allow user to sort the data in View data mode