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
How to Create a Slug in Python with the Re Module
There are a few 3rd party modules that do this sort of thing. But there is a pretty solution using out of the box Python functionality. You don't have to install any dependencies if you use the `re` module.
import re
text = ' asdfladf ljklasfj 2324...
Written by Sean Behan on 03/02/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