Skip to content

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

Open
@cztomczak

Description

@cztomczak

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions