This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User specific aliases and functions (.bashrc) | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
source /etc/bashrc | |
fi | |
# Source common definitions | |
if [ -f ~/.bashrc_common ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from requests import request | |
from requests import async | |
URL = 'http://httpbin.org/get' | |
def get(): | |
return request('get', URL) | |
def async_get(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_proxy(node, context): | |
name = title_to_name(node.name, blacklist=context.keys()) | |
if node.id is None: | |
DBSession.flush(objects=(node,)) | |
proxy = context[name] = ContentProxy(proxied_id=node.id) | |
return proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@fixture(scope='session') | |
def custom_settings(): | |
return {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(pyramid)[piotr@demon pyramid]$ nosetests -t test_xxx | |
E | |
====================================================================== | |
ERROR: test_xxx (pyramid.tests.test_config.test_i18n.TestI18NConfiguratorMixin) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/piotr/projects/pyramid/pyramid/tests/test_config/test_i18n.py", line 95, in test_xxx | |
dirs = config.registry.getUtility(ITranslationDirectories) | |
File "/home/piotr/.virtualenvs/pyramid/lib/python2.7/site-packages/zope/interface/registry.py", line 172, in getUtility | |
raise ComponentLookupError(provided, name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.config import Configurator | |
if __name__ == '__main__': | |
config = Configurator() | |
config.override_asset('app', 'app.subapp:app-overrides/') | |
config.commit() | |
config.add_translation_dirs('app:locale') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def includeme(config): | |
config.add_translation_dirs('app:locale') | |
config.add_translation_dirs('app:framework-locale') | |
config.commit() | |
config.scan(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.config import Configurator | |
config = Configurator() | |
config.begin() | |
config.override_asset('framework', 'app:framework-overrides/') | |
config.commit() | |
config.add_translation_dirs('framework:locale') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import SimpleHTTPRequestHandler | |
from http.server import HTTPServer | |
class MyRequestHandler(SimpleHTTPRequestHandler): | |
#protocol_version = "HTTP/1.0" # works | |
protocol_version = "HTTP/1.1" # hangs | |
def __init__(self, request, *args): | |
request.settimeout(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine | |
from sqlalchemy import Column, ForeignKey, Integer, String, Unicode, UniqueConstraint | |
from sqlalchemy.ext.associationproxy import association_proxy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import relationship, sessionmaker | |
from sqlalchemy.orm.collections import attribute_mapped_collection | |
Base = declarative_base() |