@transaction.commit_on_success
    def _create(self, request, project_slug, data):
        # Check for unavailable fields
        try:
            self._check_fields(data.iterkeys(), self.allowed_fields)
        except __HOLE__, e:
            msg = "Field '%s' is not allowed." % e
            logger.warning(msg)
            raise BadRequestError(msg)
        # Check for obligatory fields
        for field in ('name', 'slug', 'i18n_type', ):
            if field not in data:
                msg = "Field '%s' must be specified." % field
                logger.warning(msg)
                raise BadRequestError(msg)

        try:
            project = Project.objects.get(slug=project_slug)
        except Project.DoesNotExist, e:
            logger.warning(unicode(e), exc_info=True)
            raise NotFoundError(unicode(e))

        # In multipart/form-encode request variables have lists
        # as values. So we use __getitem__ isntead of pop, which returns
        # the last value
        method = data['i18n_type']; del data['i18n_type']
        if not registry.is_supported(method):
            msg = "i18n_type %s is not supported." % method
            logger.warning(msg)
            raise BadRequestError(msg)
        try:
            slug = data['slug']; del data['slug']
            name = data['name']; del data['name']
            # TODO for all fields
        except KeyError, e:
            msg = "Required field is missing: %s" % e
            logger.warning(msg)
            raise BadRequestError(msg)
        if len(slug) > 50:
            raise BadRequestError(
                "The value for slug is too long. It should be less than "
                "50 characters."
            )

        try:
            content = self._get_content(request, data)
            filename = self._get_filename(request, data)
        except NoContentError, e:
            raise BadRequestError(unicode(e))

        try:
            rb = ResourceBackend()
            rb_create =  rb.create(
                project, slug, name, method, project.source_language, content,
                extra_data={'filename': filename}
            )
            post_resource_save.send(sender=None, instance=Resource.objects.get(
                slug=slug, project=project),
                    created=True, user=request.user)
            return rb_create
        except ResourceBackendError, e:
            raise BadRequestError(unicode(e))
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/api.py/ResourceHandler._create