Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

querysets.WorkflowTypeQuerySet.filter() should behave like a class method #4

Open

Description

@ggreg

If we filter by domain we should not have to instanciate WorkflowTypeQuerySet with a Domain in argument.

Activity

  1. oleiade commented on Apr 4, 2013

    @oleiade
    Contributor

    How would the method prototype would look like then, would domain_name become mandatory?
    Plus, I'm very aware of class methods usage, but queryset depends on their instance connection attribute to go fetch data from amazon, how would it be handled without self instance reference?

    current method:

        def filter(self, domain_name=None, registration_status=REGISTERED, name=None):
            """Filters workflows based of their status, and/or name"""
    
            def get_workflows():
                response = {'nextPageToken': None}
                while 'nextPageToken' in response:
                    response = self.connection.list_workflow_types(
                        domain_name,
                        registration_status,
                        name=name,
                        next_page_token=response['nextPageToken']
                    )
    
                    for workflow in response['typeInfos']:
                        yield workflow
    
            # As WorkflowTypeQuery has to be built against a specific domain
            # name, domain filter is disposable, but not mandatory.
            domain_name = domain_name or self.domain.name
    
            return [self.to_WorkflowType(wf) for wf in get_workflows()]
  2. ggreg commented on Apr 4, 2013

    @ggreg
    ContributorAuthor

    If domain_name is a filtering key we should allow to instanciate a queryset without a domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions