With my recent dedicated introduction to the Python language I have become very appreciative of the highly composable nature of WSGI applications.
In a functional style you are able to compose a desired application from many different components, using the middleware ideology.
The benefits of this approach can be clearly seen in the contrived example depicted below, which is based on my previous Flask example.
Coming from a strongly PHP background, initially looking at the web-development landscape whilst delving into Python seemed a little confusing.
As Python was not developed for the web from an offset, a specification was accepted called PEP 333 which standardised the required interface between Web servers and Python Web Frameworks/Applications.
Despite the additional complexity, the manner in which middle-ware applications can be integrated, along with the server choice add possibilities that I find hard to locate a comparable in PHP.
FUSE for OSX is a Mac OSX port of the popular Filesystem in Userspace (FUSE) software, and a successor to MacFUSE.
Once installed you have the ability to mount many different types of remote and local file-system in userland, without the need to alter the kernel.
An example filesystem that I have found to be very useful is SSHFS, which allows you to interact with files located on a remote server, via the SSH protocol.
Once mounted the specified remote directory can be accessed as if it were a local volume.
I have recently set aside some time to delve into the world of Python and all its Zen.
Being a web-developer at heart I of-course had to look at the current options available to me.
In this post I will be guiding you through creating a single-script web application using Flask and Basic access authentication.
For simplicity I will assume that you have a working installation of either Python 2.7/3.3 and virtualenv.
Having just stepped into the world of Python I think it is only human-nature to compare, if not contemplate solutions to, discovered given strengths in a more familiar language.
My familiar language being of-course PHP, I thought it would be a good thought experiment to see if I could design a basic decorator implementation in the language.
Decorators, as discussed in another post, are an easy concept to explain.
Simply put they wrap specified functions with other functions, providing a means to compose new functions in a succinct manner.