Giter VIP home page Giter VIP logo

gluino's Introduction

About gluino

Port of web2py libraries to Bottle, Flask, Pyramid, Tornado, and Wsgiref with examples.

This is a project that started during the PyCon 2012 sprint.

Author: Massimo Di Pierro

License: Web2py license (LGPL) applies to files in gluino/ folder

On PyPI: http://pypi.python.org/pypi/Gluino

The port includes;

Examples

  • bottle_example.py
  • flask_example.py
  • pyramid_example.py
  • tornado_example.py
  • wsgiref_example.py

pyramid_example.py is also known as web2pyramid. It was anticipated long ago but never came to be, until now!

All the examples include the same common code:

db=DAL('sqlite://storage.sqlite')
db.define_table('person',Field('name',requires=IS_NOT_EMPTY()))

...

form = SQLFORM(db.person)
if form.accepts(vars):
    message = 'hello %s' % form.vars.name
else:
    message = 'hello anonymous'
people = db(db.person).select()
now  = cache.ram('time',lambda:time.ctime(),10)
return locals()

and execute the same template:

{{extend 'templates/layout.html'}}
<h1>{{=message}}</h1>
{{=form}}
<h2>People</h2>
{{=people}}
<h2>Test caching time</h2>
{{=now}}
<h2>A static image</h2>
<img src="/static/cat.jpg" />

which generates the same output on all the frameworks:

screenshot

What is missing (compared with web2py)

Note these are not really limitations. We just assume that if you use, for example, Flask with gluino, you want to use the Flask sessions and not the web2py sessions. Same for access control. Moreover we assume that if you want to use the web2py client size styles and JavaScript, you can copy them yourself from the web2py scaffolding app.

  • sessions (you have to use the session provided by the host framework)
  • web2py routing (you have to the routing mechanism of the host framework)
  • multi-app support (only web2py does that well)
  • the web based IDE (only web2py has it)
  • web2py internationalization (you have to use i18n)
  • the Role Based Access Control (you have to use the host framework's API)
  • web2py's CRON and Scheduler
  • form.process() (you have to use form.accepts(...) but works the well)
  • everything in contrib (because we did not package it but you can copy it over)
  • web2py.js (because we did not package static files here but you can copy it from web2py into static)

Important

While we guarantee backward compatibility for web2py, we cannot guaranteed backward compatibility for this API since it is very new. Yet the files included here are a subset of web2py/gluon/*.py. We only added the wrapper object (in gluino/init.py) and the examples.

Todo

  • more testing

gluino's People

Contributors

mdipierro avatar

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.