View wsgi.py
# -*- coding: utf-8 -*- | |
import io | |
import os | |
import sys | |
import time | |
import wsgiref.util | |
import uwsgidecorators |
View fixed.py
# Pas besoin de point-virgule | |
import os; | |
# Utilise open("gaumont.generate.txt", 'w') à la place ; ici tu supprimes le fichier puis l'ouvres en mode "ajout à la fin", | |
# autant l'ouvrir directement en mode "remplacement" | |
os.remove("gaumont.generate.txt"); | |
FILE = open("gaumont.generate.txt", "a+"); | |
print("========================="); | |
print(" GAUMONT GENERATOR BY TCHOTCHO"); |
View my_factory.py
import factory | |
import factory.alchemy | |
import my_tests | |
import my_models | |
class MyFactory(factory.alchemy.SQLAlchemyFactory): | |
class Meta: | |
sqlalchemy_session_loader = my_tests.session_loader | |
model = my_models.Model |
View test_lcd.py
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function, unicode_literals | |
import socket | |
import sys | |
DEFAULT_LCDD_CHARSET = 'utf-8' |
View settings.py
class InvalidStringHandler(object): | |
"""Custom handler for invalid string in templates.""" | |
def __call__(self): | |
"""Force crashes in {{ foo|sth }}, without breaking __str__.""" | |
import ipdb; ipdb.set_trace() | |
raise ValueError() | |
def __nonzero__(self): | |
"""So that '{% if foo %}' doesn't break.""" |
View mock_datetime.py
# This code is in the public domain | |
# Author: Raphaël Barrois | |
from __future__ import print_function | |
import datetime | |
import mock |
View gist:3721801
from suds.transport.http import HttpTransport as SudsHttpTransport | |
class WellBehavedHttpTransport(SudsHttpTransport): | |
"""HttpTransport which properly obeys the ``*_proxy`` environment variables.""" | |
def u2handlers(self): | |
"""Return a list of specific handlers to add. | |
The urllib2 logic regarding ``build_opener(*handlers)`` is: |