def _create(cls, target_class, *args, **kwargs):
        if args:
            assert False, "Positional args aren't supported, use keyword args."

        context = {'user': factories._get_action_user_name(kwargs)}
        issue_comment_dict = helpers.call_action('issue_comment_create',
                                                 context=context,
                                                 **kwargs)
        return issue_comment_dict
Example #2
0
    def _create(cls, target_class, *args, **kwargs):
        if args:
            assert False, "Positional args aren't supported, use keyword args."

        context = {'user': factories._get_action_user_name(kwargs)}
        issue_comment_dict = helpers.call_action('issue_comment_create',
                                                 context=context,
                                                 **kwargs)
        return issue_comment_dict
 def _create(cls, target_class, *args, **kwargs):
     if args:
         assert False, "Positional args aren't supported, use keyword args."
     context = {'user': _get_action_user_name(kwargs)}
     # If there is an existing source for this URL, and we can't create
     # another source with that URL, just return the original one.
     try:
         source_dict = toolkit.get_action('harvest_source_show')(
             context, dict(url=kwargs['url']))
     except (KeyError, toolkit.ObjectNotFound), e:
         source_dict = toolkit.get_action('harvest_source_create')(
             context, kwargs)
 def _create(cls, target_class, *args, **kwargs):
     if args:
         assert False, "Positional args aren't supported, use keyword args."
     context = {'user': _get_action_user_name(kwargs)}
     if 'source_id' not in kwargs:
         kwargs['source_id'] = kwargs['source'].id
     if 'run' not in kwargs:
         kwargs['run'] = False
     job_dict = toolkit.get_action('harvest_job_create')(context, kwargs)
     if cls._return_type == 'dict':
         return job_dict
     else:
         return cls.FACTORY_FOR.get(job_dict['id'])
Example #5
0
    def _create(cls, target_class, *args, **kwargs):
        if args:
            assert False, "Positional args aren't supported, use keyword args."

        context = {'user': factories._get_action_user_name(kwargs)}

        # issue_create is so badly behaved I'm doing this for now
        data_dict = dict(**kwargs)
        data_dict.pop('user', None)

        issue_dict = helpers.call_action('issue_create',
                                         context=context,
                                         **data_dict)
        return issue_dict
    def _create(cls, target_class, *args, **kwargs):
        if args:
            assert False, "Positional args aren't supported, use keyword args."

        context = {'user': factories._get_action_user_name(kwargs)}

        # issue_create is so badly behaved I'm doing this for now
        data_dict = dict(**kwargs)
        data_dict.pop('user', None)

        issue_dict = helpers.call_action('issue_create',
                                         context=context,
                                         **data_dict)
        return issue_dict
Example #7
0
 def _create(cls, target_class, *args, **kwargs):
     if args:
         assert False, "Positional args aren't supported, use keyword args."
     context = {'user': _get_action_user_name(kwargs)}
     if 'source_id' not in kwargs:
         kwargs['source_id'] = kwargs['source'].id
     if 'run' not in kwargs:
         kwargs['run'] = False
     job_dict = toolkit.get_action('harvest_job_create')(
         context, kwargs)
     if cls._return_type == 'dict':
         return job_dict
     else:
         return cls.FACTORY_FOR.get(job_dict['id'])
 def _create(cls, target_class, *args, **kwargs):
     if args:
         assert False, "Positional args aren't supported, use keyword args."
     context = {'user': _get_action_user_name(kwargs)}
     if 'job_id' not in kwargs:
         kwargs['job_id'] = kwargs['job'].id
         kwargs['source_id'] = kwargs['job'].source.id
     # Remove 'job' to avoid it getting added as a HarvestObjectExtra
     if 'job' in kwargs:
         kwargs.pop('job')
     job_dict = toolkit.get_action('harvest_object_create')(context, kwargs)
     if cls._return_type == 'dict':
         return job_dict
     else:
         return cls.FACTORY_FOR.get(job_dict['id'])
Example #9
0
 def _create(cls, target_class, *args, **kwargs):
     if args:
         assert False, "Positional args aren't supported, use keyword args."
     context = {'user': _get_action_user_name(kwargs)}
     if 'job_id' not in kwargs:
         kwargs['job_id'] = kwargs['job'].id
         kwargs['source_id'] = kwargs['job'].source.id
     # Remove 'job' to avoid it getting added as a HarvestObjectExtra
     if 'job' in kwargs:
         kwargs.pop('job')
     job_dict = toolkit.get_action('harvest_object_create')(
         context, kwargs)
     if cls._return_type == 'dict':
         return job_dict
     else:
         return cls.FACTORY_FOR.get(job_dict['id'])
Example #10
0
 def _create(cls, target_class, *args, **kwargs):
     if args:
         assert False, "Positional args aren't supported, use keyword args."
     context = {'user': _get_action_user_name(kwargs)}
     # If there is an existing source for this URL, and we can't create
     # another source with that URL, just return the original one.
     try:
         source_dict = toolkit.get_action('harvest_source_show')(
             context, dict(url=kwargs['url']))
     except toolkit.ObjectNotFound:
         source_dict = toolkit.get_action('harvest_source_create')(
             context, kwargs)
     if cls._return_type == 'dict':
         return source_dict
     else:
         return cls.FACTORY_FOR.get(source_dict['id'])