Skip to content

PDBList::retrieve_pdb_file overpowers the API user #1064

Open

Description

@riemaxi

This VERY HANDY funcion is doing three things that are inconvenient

  • It prints messages to the console, like "Downloading PDB structure 'XXXX'..."
  • It saves the data into a local file
  • it generates an exception instead of returning an error code.

My suggestion is to use callback functions for

  • messaging
  • for the downloaded content

For messaging do not use any specific languaje, use an message id
For the downloaded content, let the user decide where to put it (e.g a file or on a database, or even send it forward .. you name it)

OBS. You do not need to to make this function obsolete, just create a more open version using callback functions, where the default would be to print to the console if no callback is provided

Activity

  1. hectormartinezdev commented on Mar 14, 2017

    @hectormartinezdev
    Contributor

    @riemaxi Could you extend on using callback functions to messaging or downloaded content?

    For messaging I think that move the print function/statement to the logging module would be useful, since you can set verbosity and hide the messages.

    For the downloaded content, you mean return a plain text, instead of creating a file and let the user save the text in a file or passing it to another function, class, etc.? Maybe this is useful too, a parameter that let you decide if you want to receive it as a text or save it directly. For instance, if you don't specify a path parameter.

  2. riemaxi commented on Mar 14, 2017

    @riemaxi
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions