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

Ability to pass arbirtrary kwargs to child-dalec #26

Open
weber-s opened this issue Feb 21, 2024 · 1 comment
Open

Ability to pass arbirtrary kwargs to child-dalec #26

weber-s opened this issue Feb 21, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@weber-s
Copy link
Member

weber-s commented Feb 21, 2024

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.

@DylannCordel
Copy link
Member

Seems a good idea. 👍

IMHO, to avoid a breaking change, you must add your new arg at the end. In next major release we will be able to refactor once the project will be mature enough.

generic_kwargs to rename into specific_proxy_kwargs because it's specific, not generic.

LGFM if someone want to code this.

@DylannCordel DylannCordel added this to the 0.3.0 milestone Feb 21, 2024
@DylannCordel DylannCordel added the enhancement New feature or request label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants