Skip to content

Provide an API to determine whether a feature is implemented for a particular scheme #39

@markshowalter

Description

@markshowalter

This issue came up with pdslogger/pdstemplate but I think it will have other uses as well. I need a way to determine if a feature is implemented without waiting until a NotImplementedError is raised. Here is my use case:

Suppose the user is validating a PDS3 table over http using pdstemplate. By default, log files are created at the same location as the table. Such a log cannot be uploaded over http, however, so this generates a NotImplementedError at upload(). By that time, the log file already exists locally and it's too late to do anything about it. My solution for now is to provide an error message that says that the log could not be uploaded and providing a link to the local file, which by default is buried somewhere deep inside /tmp. It would be way better if I could determine in advance that it will not be possible to upload the log, so pdslogger -> file_handler can immediately tell the user to put the log somewhere else.

Although my example just involves upload(), I think there are other methods like glob() and listdir() where it should also be possible to know in advance whether or not they are implemented.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions