{
774e43e9a3af4e1d811d9fff57cadf43: {
netloc: "www.thalo.com",
managed: true,
tenant_id: "565212",
discovery_status: "ERROR",
trigger_id: "urn:uuid:7d790d47-25c4-4f7e-83ba-92e764c914e1",
time: "2013-12-19 20:54:52 +0000",
metadata: { },
Determines whether a list nested in mongodb already contains the value.
If not, write it.
def is_a_new_thing(an_id):
doc = DB.collection.get('stuff')
the_ids = doc['ids']
setbefore = set(the_ids)
setafter = set(the_ids).add(an_id)
# adding an existing value to a set will not change the set
def update(self, key, data):
""" Affects only the keys in `data` """
write = copy.copy(data)
current = self.get(key)
current.update(write)
response = self.save(key, data) if current == self.get(key) else False
# experimental
# user should check response is not False to ensure successful update
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
import platform | |
for thing in dir(platform): | |
print '---------' | |
print thing | |
try: | |
print getattr(platform, thing)() | |
except Exception: | |
print getattr(platform, thing) |
Unrecoverable error: error(9, 'Bad file descriptor')
Traceback (most recent call last):
File "/home/sstav/.virtualenvs/project/local/lib/python2.7/site-packages/celery/worker/__init__.py", line 212, in start
self.blueprint.start(self)
File "/home/sstav/.virtualenvs/project/local/lib/python2.7/site-packages/celery/bootsteps.py", line 123, in start
step.start(parent)
File "/home/sstav/.virtualenvs/project/local/lib/python2.7/site-packages/celery/bootsteps.py", line 373, in start
return self.obj.start()
File "/home/sstav/.virtualenvs/project/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 271, in start
like this:
The source_dict
contains some values you're going to want in your new or updated target_dict
, and it might look like this:
source_dict = {'key1': {
'key2': {
'key3': {
'key4': 'value4',
'key5': 'value5'
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
#!/bin/bash | |
# This hook is run after this virtualenv is activated. | |
##################################### | |
## To setup a venv which | |
## has git-hg interopability | |
## | |
## Fetches latest script | |
## | |
## Using virtualenv, virtualenvwrapper, |
NewerOlder