Open
Description
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:
- abc module - https://docs.python.org/2/library/abc.html
- PEP 3119 - https://www.python.org/dev/peps/pep-3119/
- http://stackoverflow.com/questions/372042/
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