This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
Why memcached doesn't work? | |
We observe weird behaviour of the function save_object_to_cache(...) | |
-------------------------------------------------------------------------------- | |
$ python /tmp/memcached_test.py | |
A new object <__main__.Wrapper object at 0x925f60c> with value "bar" has been created |
This file contains hidden or 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
""" | |
Registrar decorator can be used to add objects (function and classes) to the | |
registry. | |
>>> reg = Registrar() | |
>>> @reg('foo') | |
... def foo(): | |
... print 'foo' | |
... | |
>>> @reg('bar') |
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Python hook skeleton for gitolite. | |
- Place this file as ~/.gitolite/hooks/common/<hook-name> (i.e. as | |
~/.gitolite/hooks/common/post-receive) | |
- Run "gl-setup" in console | |
- Define a number of function with @hook() decorators inside | |
Providing such configuration, every function is executed as a hook for a |
This file contains hidden or 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
#!/usr/bin/env python | |
""" Simple script to show diff between two HTML pages in understandable format """ | |
import urllib2, tidy, sys, subprocess | |
tidy_kwargs = dict( | |
output_xml=1, | |
indent=1, | |
indent_attributes=1, | |
wrap=80, | |
char_encoding='raw', |
This file contains hidden or 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
#!/usr/bin/env python | |
""" Simple script to show diff between two HTML pages in understandable format """ | |
import urllib2, tidy, sys, subprocess | |
tidy_kwargs = dict( | |
output_xml=1, | |
indent=1, | |
indent_attributes=1, | |
wrap=80, | |
char_encoding='raw', |
This file contains hidden or 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
""" | |
Example | |
Create objects: | |
>>> status = Status(False, u'You are not allowed to do this') | |
>>> status = Status(True) | |
Use objects: |
NewerOlder