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: |
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
#!/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
""" | |
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
# -*- 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import httplib2 | |
import urllib | |
import json | |
def request(address, email=None, limit=None): | |
""" | |
Simple wrapper around nominatim geocoding web service |
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 calculator doesn't work and how to fix it? | |
I expect to see: | |
$ python /tmp/discount_calculator.py | |
950.0 | |
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
diff --git a/djcelery/migrations/0002_v25_changes.py b/djcelery/migrations/0002_v25_changes.py | |
index f3bb729..7013f7f 100644 | |
--- a/djcelery/migrations/0002_v25_changes.py | |
+++ b/djcelery/migrations/0002_v25_changes.py | |
@@ -11,6 +11,10 @@ def ignore_exists(fun, *args, **kwargs): | |
fun(*args, **kwargs) | |
except DatabaseError, exc: | |
if "exists" in str(exc): | |
+ # don't panic, everything is okay, it's just a hack | |
+ if db.has_ddl_transactions: |
OlderNewer