Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # get data from Postgresql and create document in couch
- ticket_doc = {"_id": ticket_number, "type": "ticket", "sequence_number": ticket_data[0], "user_id": ticket_data[1], "reported_on": reported_on, "created_at": ticket_data[3].strftime("%Y/%m/%d %H:%M:%S +0000"), "notes": ticket_data[4], "template_version": ticket_data[6], "_attachments": attachments}
- try:
- print ticket_number, ticket_data[0], db.save_doc(ticket_doc, True, False, False)
- except ValueError:
- print "Couldn't save ticket #" + ticket_number + " with sequence number " + str(ticket_data[0])
- # error raised on document conflict
- Traceback (most recent call last):
- File "./ticket-sync.py", line 49, in <module>
- print ticket_number, ticket_data[0], db.save_doc(ticket_doc, True, False, False)
- File "/usr/local/lib/python2.6/dist-packages/couchdbkit-0.4.11-py2.6.egg/couchdbkit/client.py", line 475, in save_doc
- **params), raw=_raw_json)
- File "/usr/local/lib/python2.6/dist-packages/restkit-2.2.3-py2.6.egg/restkit/resource.py", line 174, in put
- headers=headers, **params)
- File "/usr/local/lib/python2.6/dist-packages/couchdbkit-0.4.11-py2.6.egg/couchdbkit/resource.py", line 148, in request
- response=e.response)
Add Comment
Please, Sign In to add comment