Skip to content

Ability to pass arbirtrary kwargs to child-dalec #26

@weber-s

Description

@weber-s

Initially webu/dalec-discourse#6

Sometime we want ton configure the child dalec according to specific API logic. In the example above it is the action "on behalf" of someone.

However, we want something generic: an ability to pass arbitrary kwargs to the proxy.

It should live somewhere in the

def refresh(
        self,
        content_type: str,
        channel: Optional[str] = None,
        channel_object: Optional[str] = None,
        generic_kwargs: [Optional[dic]] = None, # <- here! or elsewhere in the signature...
        force: Optional[bool] = False,
        dj_channel_obj: Optional[Model] = None,
    ) -> Union[Tuple[int, int, int], Tuple[Literal[False], Literal[False], Literal[False]]]:
        """
        Fetch updated contents from the source and update/create it into the DB.
        Then, if some contents has been created, delete oldests contents which are not anymore
        required
        returns number of created, updated and deleted objects or False if cache not yet expired
        """
        dalec_kwargs = {
            "content_type": content_type,
            "channel": channel,
            "channel_object": channel_object,
            "generic_kwargs": generic_kwargs # <- here!
        }

And accordingly in JS / HTML.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions