Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose handlers as classes/interfaces: ClientHandler, DisplayHandler, LifespanHandler, etc. #215

Open
cztomczak opened this issue Feb 16, 2016 · 1 comment
Labels

Comments

@cztomczak
Copy link
Owner

Module cefpython.handlers.

When user's code creates MyClientHandler it can use these interfaces to check if his callbacks signatures are declared properly - to look for typos or deprecated callbacks removed from upstream CEF. Also would be useful for auto completion.

These handlers interfaces should be auto generated from source code - create it as part of translator.py? (Issue #214)

Python has the concept of abc - Abstract Bases Classes - see:

Example:

class ClientHandler(metaclass=ABCMeta):
    __subclass__ = {DisplayHandler, LifespanHandler, ...}

class MyClientHandler:
    def __init__(self):
        assert issubclass(MyClientHandler, ClientHandler)

The example above probably requires implementing all callbacks - we only need to validate functions that have been declared. Whether such callback name is valid and whether its number of parameters are valid.

Also do this for other non-handler classes, but which also act as callbacks:

  • StringVisitor
  • CookieVisitor
  • WebRequestClient
@cztomczak
Copy link
Owner Author

Current Chrome 47 will break backward compatibility due to changes in upstream CEF. CEF Python depends on CEF and there will be more BC breaks in the future, can't do much about that. It would be good if such BC breaks could be detected by pylint or an IDE like PyCharm. That's why the need for client handler interfaces. It needs to able to be checked programmatically whether a callback with such name exists and wheter its arguments are valid (number and types if possible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant