Rails Style Params in Python and Flask
Ruby on Rails does a great job of parsing arrays in form data and populating a params hash, for quick and easy access in your controllers.
For instance
Gives you
params[:item] # => ["item 1", "item 2"]
Flask doesn't do this work f...
Written by Sean Behan on 11/04/2018
Reshape an Array of Form Inputs for Flask with getlist()
This is how to reshape an array using Python without Numpy.
This is a fairly simple task but it can be a little confusing to wrap your head around. I ran into this problem while working with Flask, working with array from form fields.
I wanted to us...
Written by Sean Behan on 03/07/2017
How to Decorate Imported Libs in Python for Jinja Template Filters in Flask
To decorate an imported function in Python you would do something like this
# in ./lib.py
def function_name():
# function body
And then in your program you could decorate it like this
from lib import function_name
function_name = decorat...
Written by Sean Behan on 03/04/2017
My First Python Package on PyPi - Command Line Blog
I wrote my first Python package over the weekend. It is a simple package that adds a basic blog API to an existing Flask application.
It's called `command_line_blog` and is available [on Github](https://github.com/seanbehan/command_line_blog) and [on ...
Written by Sean Behan on 03/02/2017
How To Get A Dict from Flask Request Form
The `request.form` object is an immutable dictionary. An `ImmutableMultiDict` object to be exact. Immutable means that you cannot change its values. It's frozen.
However, you might want to change the values. Say for instance, creating a slug from a ti...
Written by Sean Behan on 03/02/2017