(self, cases=None, **case_kwargs)
Enqueue case changes to be synced

        Does not post changes to HQ. Use `post_changes()` for that,
        possibly after enqueuing changes with this method.

        :param cases: A `CaseBlock` or `CaseStructure` or a list of the
        same (all must have same type). `CaseStructure` objects will be
        converted to case XML with defaults from this device's case
        factory. `CaseBlock` objects will be posted as is (no defaults).
        :param **case_kwargs: Arguments to be passed to
        `CaseFactory.get_case_block(...)`, which implies using defaults
        from this device's case factory.
Enqueue case changes to be synced
Enqueue case changes to be synced
def change_cases(self, cases=None, **case_kwargs):
        """Enqueue case changes to be synced

        Does not post changes to HQ. Use `post_changes()` for that,
        possibly after enqueuing changes with this method.

        :param cases: A `CaseBlock` or `CaseStructure` or a list of the
        same (all must have same type). `CaseStructure` objects will be
        converted to case XML with defaults from this device's case
        factory. `CaseBlock` objects will be posted as is (no defaults).
        :param **case_kwargs: Arguments to be passed to
        `CaseFactory.get_case_block(...)`, which implies using defaults
        from this device's case factory.
        """
        factory = self.case_factory
        if case_kwargs:
            if cases is not None:
                raise ValueError("pass one: cases or kwargs")
            if "case_id" not in case_kwargs:
                if not case_kwargs.get('create'):
                    raise ValueError("case_id is required for update")
                case_kwargs["case_id"] = uuid4().hex
            self.case_blocks.append(factory.get_case_block(**case_kwargs))
            return
        if isinstance(cases, (CaseStructure, CaseBlock)):
            cases = [cases]
        elif not isinstance(cases, list):
            raise ValueError(repr(cases))
        if all(isinstance(s, CaseStructure) for s in cases):
            self.case_blocks.extend(factory.get_case_blocks(cases))
        else:
            self.case_blocks.extend(b.as_xml() for b in cases)
def change_cases ( self , cases = None , * * case_kwargs ) : factory = self . case_factory if case_kwargs : if cases is not None : raise ValueError ( "pass one: cases or kwargs" ) if "case_id" not in case_kwargs : if not case_kwargs . get ( 'create' ) : raise ValueError ( "case_id is required for update" ) case_kwargs [ "case_id" ] = uuid4 ( ) . hex self . case_blocks . append ( factory . get_case_block ( * * case_kwargs ) ) return if isinstance ( cases , ( CaseStructure , CaseBlock ) ) : cases = [ cases ] elif not isinstance ( cases , list ) : raise ValueError ( repr ( cases ) ) if all ( isinstance ( s , CaseStructure ) for s in cases ) : self . case_blocks . extend ( factory . get_case_blocks ( cases ) ) else : self . case_blocks . extend ( b . as_xml ( ) for b in cases )