Skip to content

Instantly share code, notes, and snippets.

View an-dev's full-sized avatar

Andy an-dev

View GitHub Profile
@an-dev
an-dev / MultiPartSerializerForRestlessTornado.py
Created August 6, 2019 15:43
Multipart file upload aware custom JSON serializer for Restless using Tornado utils
#!/usr/bin/env python
# coding:utf-8
import StringIO
import os
import uuid
import restless.exceptions
import restless.serializers
import restless.tnd
import tornado.httputil
@an-dev
an-dev / validators.py
Created April 7, 2019 21:52 — forked from mobula/validators.py
Performs file upload and image upload validation for django.
# -*- coding: utf-8 -*-
# https://gist.github.com/mobula/da99e4db843b9ceb3a3f
# @brief
# Performs file upload validation for django.
# with Django 1.7 migrations support (deconstructible)
# Provides:
# - FileValidator
# - ImageValidator (adds Image specific validation using PIL)