Skip to content

AbstractService, __init__ not called #81

Description

@djsliders

Hello,
In order to avoid declaring an init method inside all services, with often the same things (db, current_user) I use an abstract class that UserService (for example) inherits:

class AbstractService(ABC):

    def __init__(self,):
        self.config = config
        self.session = self.config.get_db()


class UsersService(AbstractService):
   def get_users():
      **self.session.query....**

But this doesn't work, as the self.session is never set. But if I create a init in UsersService and call the super.init(), then it works.

Is there a way to fix that ?

THank you for the help and the great framework.

Activity

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