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 functools import wraps | |
from django.template.response import TemplateResponse | |
def template_view(template_name): | |
""" View decorator to convert returned dictionary into TemplateResponse | |
You can apply template name for this decorator like this | |
>>> @template_view |
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
""" Cache <-> Object Mapper | |
I know there is `rom <https://pypi.python.org/pypi/rom>`_ or some. | |
""" | |
import json | |
from django.core.cache import cache | |
SEPARATOR = ':' |
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
cd /tmp | |
mkdir adobe_flash | |
cd adobe_flash | |
wget http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.442/install_flash_player_11_linux.x86_64.tar.gz | |
tar axvf install_flash_player_11_linux.x86_64.tar.gz | |
sudo mv ./libflashplayer.so /usr/lib/mizilla/plugins |
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
Testitg: <class '__main__.RequiredForm'> | |
======== Should be True: True ========== | |
is_valid: True | |
cleaned_data: {'is_test': True} | |
======== Should be True: true ========== | |
is_valid: True | |
cleaned_data: {'is_test': True} | |
======== Should be True: 1 ========== | |
is_valid: True | |
cleaned_data: {'is_test': True} |
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
Testitg: <class '__main__.RequiredSerializer'> | |
======== Should be True: True ========== | |
is_valid: True | |
data: ReturnDict([('is_test', True)]) | |
======== Should be True: true ========== | |
is_valid: True | |
data: ReturnDict([('is_test', True)]) | |
======== Should be True: 1 ========== | |
is_valid: True | |
data: ReturnDict([('is_test', True)]) |
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 io import StringIO | |
import cProfile | |
import pstats | |
from django.conf import settings | |
class ProfilerMiddleware(object): | |
""" プロファイラーを実行するMiddleware |
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
class WidgetForm(object): | |
def is_valid(self): | |
pass | |
def __str__(self): | |
widget_forms = { | |
widget_code: modelformset_factory(widget_class) | |
for widget_code, widget_class in widgets.widgets.items() | |
} |
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
<source> | |
type forward | |
</source> | |
<match **> | |
type record_reformer | |
renew_record false | |
enable_ruby true | |
tag ip_formatted.${tag} |
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
""" | |
Usage | |
===== | |
:: | |
$ python easyscript.py 1 2 | |
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
2015-06-16 09:42:09,565 ERROR [waitress][Dummy-4] Exception when serving /manage/terms/ãã£/@@properties | |
Traceback (most recent call last): | |
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/waitress/channel.py", line 337, in service | |
task.service() | |
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/waitress/task.py", line 173, in service | |
self.execute() | |
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/waitress/task.py", line 392, in execute | |
app_iter = self.channel.server.application(env, start_response) | |
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/pyramid-1.6a1-py3.4.egg/pyramid/router.py", line 223, in __call__ | |
response = self.invoke_subrequest(request, use_tweens=True) |