Skip to content

Instantly share code, notes, and snippets.

Alessandro Molina amol-

Block or report user

Report or block amol-

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amol-
amol- / request_validation.py
Created Sep 3, 2019
Test TurboGears request.validation in minimal mode
View request_validation.py
from wsgiref.simple_server import make_server
import tg
from tg import RestController, expose, validate, MinimalApplicationConfigurator
from formencode import validators
class RootController(RestController):
@expose('json')
@amol-
amol- / HelloWorld.jsx
Last active Jan 23, 2017
Isomorphic React applications in Python
View HelloWorld.jsx
export class HelloWorld extends React.Component {
render() {
return (
<div className="helloworld">
Hello {this.props.name}
</div>
);
}
}
@amol-
amol- / HelloWorld.jsx
Last active Sep 26, 2016
React, WebAssets, Babel and DukPY
View HelloWorld.jsx
export class HelloWorld extends React.Component {
render() {
return (
<div className="helloworld">
Hello {this.props.name}
</div>
);
}
}
@amol-
amol- / tgoneline.py
Last active Apr 17, 2016
Oneline TurboGears2 web application
View tgoneline.py
from tg import expose, TGController, AppConfig
from wsgiref.simple_server import make_server
make_server('', 8080, AppConfig(
minimal=True,
root_controller=type('RootController', (TGController,), {
'index': expose()(lambda *args, **params: 'Hello World')
})()
).make_wsgi_app()).serve_forever()
@amol-
amol- / tg2_opbeat.py
Created Feb 23, 2016
OpBeat integration for TurboGears2
View tg2_opbeat.py
from tg.appwrappers.base import ApplicationWrapper
class OpBeatApplicationWrapper(ApplicationWrapper):
def __init__(self, handler, config):
super(OpBeatApplicationWrapper, self).__init__(handler, config)
from tg.support.converters import aslist
import logging
log = logging.getLogger('opbeat')
@amol-
amol- / babelfilter.py
Last active Oct 29, 2015
WebAssets Filter to compile ES6 to ES5 using DukPY and BabelJS
View babelfilter.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
from webassets.filter import Filter
__all__ = ('BabelJS',)
# NOTE: When using the BabelJS compiler for code
# that needs to run in the browser make sure to add
# https://cdnjs.cloudflare.com/ajax/libs/babel-core/4.6.6/browser-polyfill.js
@amol-
amol- / tg2_appenlight
Created Nov 25, 2014
AppEnlight TurboGears2
View tg2_appenlight
TurboGears2 exception logging and performance monitoring
========================================================
Approx. integration time: **2 minutes**
WSGI middleware is the most common way to use App Enlight with your web application written in TurboGears2 web framework.
Installation and Setup
----------------------
@amol-
amol- / gist:8645500
Last active Jan 4, 2016
Proxy WSGI App
View gist:8645500
class ReverseProxied(object):
'''
location /myprefix {
proxy_pass http://192.168.0.1:5001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /myprefix;
}
'''
@amol-
amol- / gist:6061958
Created Jul 23, 2013
TurboMail on TurboGears 2.3
View gist:6061958
from __future__ import absolute_import
from turbomail.control import interface
from paste.deploy.converters import asbool
import re
from tg import config
class FakeConfigObj(object):
def __init__(self, real_config):
You can’t perform that action at this time.