@@ -0,0 +1,841 @@
+from six import binary_type%0A%0A%0Aclass FileType(TypeDecorator):%0A    %22%22%22%0A    FileType for SQLAlchemy%0A%0A    When the FileType value is being stored into database the FileType saves%0A    the filename as unicode in the associated column.%0A%0A    When the value is fetched from database this type opens the associated%0A    file object.%0A    %22%22%22%0A    impl = UnicodeText%0A%0A    def __init__(self, open_func=open, *args, **kwargs):%0A        self.open_func = open_func%0A        TypeDecorator.__init__(self, *args, **kwargs)%0A%0A    def process_bind_param(self, value, dialect):%0A        if value:%0A            if isinstance(value.name, str):%0A                return value.name.decode('utf8')%0A            else:%0A                return value.name%0A%0A    def process_result_value(self, value, dialect):%0A        if value:%0A            return self.open_func(value.encode('utf8'))%0A

Add FileType