Created
July 9, 2012 21:22
-
-
Save jayd3e/3079031 to your computer and use it in GitHub Desktop.
Question?
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
def update(p, attrs): | |
""" | |
Updates a specific "Job" dict, must be given an id | |
""" | |
k = keys() | |
job_dict = pop_job(default_queue_name, attrs['id']) | |
# sometimes the job_dict comes back as None, why? | |
if 'id' in attrs: | |
job_dict = pop_job(p, attrs['id']) | |
else: | |
raise Exception('Must pass an id into the update function.') | |
if job_dict: | |
for key, val in attrs.items(): | |
job_dict[key] = val | |
p.sadd(k['jobs'], json.dumps(job_dict)) | |
p.execute() | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment