Code Monkey home page Code Monkey logo

flask-transfer's People

Contributors

justanr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

python3pkg

flask-transfer's Issues

Error handling.

Right now Flask-Transfer has a single custom exception -- UploadError -- which is just a catch all for when something goes wrong. I'd rather not define more exceptions than needed, especially because the last thing the Python community needs is yet another ValidationError.

How much error handling should we be concerned with? Should we take a wtforms approach and collect all the errors before reporting them (potentially causing other errors to be triggered, say we get a JPG but we were expecting a PDF) or just abort on the first issue?

Or should error handling be left to the caller?

Pass metadata to saving mechanism.

Right now, the saving mechanism receives a completely different set of arguments than the rest of Flask-Transfer's calls. On one hand, this is great, one can pass arguments directly down to it. However, I think it makes it potentially awkward: validators and processors receive one set of data to work with and the saving mechanism gets a different one.

If data needs to be shared between these -- say a directory to throw thumbnails into -- it needs to be duplicated.

ImageTransfer = Transfer(preprocessors=[thumbnailify])
meta = {'save_path': get_save_path()}
ImageTransfer.save(filehandle, metadata=meta, save_path=meta['save_path'])

But if the saving mechanism gets the metadata object as well, it can be located in a single place and makes the calling conventions for everything consistent. Everything gets filehandle, metadata, rather than the current everything gets filehandle, metadata except the destination.

Thoughts?

Release 0.0.2?

Haven't been any changes to Flask-Transfer for a few months now, and there are a bunch of commits that aren't included in 0.0.1.

Would be great if a 0.0.2 release of Flask-Transfer could be made, so that these commits are included in a stable version.

Flask-WTForms compatibility layer

I had originally designed a Flask-WTForms compatibility layer for the validators. There's still traces of this, such as optionally turning off validation when calling Transfer.save. However, once I added the concept of passing metadata to the validators and didn't see a good of passing metadata to Flask-Transfer validators that end up living on a wtforms field.

Flask-Transfer could provide a custom Form class with a modified Form.validate_on_submit that receives a metadata attribute. But I feel this may be overstepping Flask-Transfer's scope. This also involves injecting a class in between a validator and BaseValidator that intercepts the __call__ and passes the correct attributes instead of field, form.

This could be out of scope for this project and I'm open to creating a Flask-WTF-Transfer (or similar) project that mediates this. Just import the form and validators from there so they can live peacefully together rather than hacking something together that'll distract from Flask-Transfer's goal.

Nesting Transfer objects

As I'm actually writing documentation (instead of just playing Kingdom Rush....), what if it were possible to nest Transfer objects. Seeing as they are already callable, it'd be possible to pass one into the pre/post processor list and have it run there.

What are the thoughts on formalizing this use?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.