ondrejkajinek / pygrim Goto Github PK
View Code? Open in Web Editor NEWPython 2 framework for web app frontends
License: MIT License
Python 2 framework for web app frontends
License: MIT License
... need to be implemented ...
Three decorators, namely @error_handler
, @custom_error_handler
and @not_found_hander
, are now used to mark controller method as a handler for "not good" situation. In fact, these decorators do very similar job (handle an error state).
@custom_error_handler
and @error_handler
are in fact the same -- @error_handler
catches BaseException. @not_found_handler
should catch NotFoundException
, that should be returned to code.
Both @error_handler
and @not_found_handler
should take prefix
argument which restricts them to request with uri.startswith(prefix)
not_found decorator might get a list of path prefixes. If requested url cannot be handled by any route but starts with a prefix registered for not_found handler, such handler will be used for handling 404 situation. default_not_found handler will be the last to be used, when no other match the requested url
Session cookie is sent to user only when it is created! It should be re-sent on every response.
PyGrim can't handle several 'static-map' entries in 'uwsgi' section of config file
Getting flash messages should support for filtering (by message type). Only iterated messages are to be removed -- e.g., iterating over error flash messages will not discard any other message from session.
Specify View component interface and provide method that will get view constructor -- in a way similar to session handler class.
if route is /test/(?P=[0-9]+)(/(?P=[0-9]+))? than url_for("test",{"first":1, "second":2}) generates /test/1(/2) instead of /test/1/2
Pygrim should contain some factory method to create validator: it should be initialized by data source (e.g., context.POST) and validation rules (e.g. pairs of (variable_name, validator) ). Validator should be functor (implementing call). Calling validator should either raise an exception (when invalid input is given) or return validated value. Validators won't be part of pygrim and won't be restricted in any other way than requiring call method.
Implement correct behaviour when Response.body is a generator type -- don't wait till it is iterated over, but send parts as they are being iterated.
Allow pygrim server to have several kinds of view components registered. Each route handler should specify which view class should be used to render the result.
For raw result (return response body without any rendering), new class (RawView) should be implemented.
Together with this change, template data dump should be turned into separate view class (JsonView), and server should change selected view class to JsonView when dump switch is on.
PyGrim should check (on postfork phase) if RawView and JsonView are enabled. If any is disabled, warning should be logged about core component being disabled.
Instead of disabling the view, DummyView should be used -- it does not render any body and sends default response headers.
Currently, pygrim uses single log for all messages. It might be useful to have separated log levels for different situations, such as server start, server runtime.
Currently, @method(session=True)
is used for loading session. Change session implementation so it is loaded when accessed -- regardless of route setting.
Session will be saved when route handle successfully returns. When not-found or exception is used, session will not be saved by PyGrim -- needs to be saved manually, if required.
When cookies have already been sent to client, session can still be created (e.g., by generator used as response body). If cookie headers have already been sent, PyGrim has no way to inform user about his session id.
When cookie headers have been sent (and no session have been used at that moment), raise on attempt to create new session.
Routes should now be registered with @route
decorator -- its parameters will be passed to Route
.
PyGrim should have route_dump
capability -- print all routes, nof-founds and errors that are registered, plus info about their handles: their names, in which file and line it is implemented, etc.
Several features will become obsolete and deprecated: method for creating routes, @method
decorator, checking if handle is exposed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.