todo
todo copied to clipboard
how to integrate json store to use couchdb?
This looks like an awesome app. I'm a couchdb developer & fan, and was wondering if there's any way to integrate these somehow? http://code.google.com/p/couchdb-python/ is popular. This way I could share info everywhere.
If you give me some hints where to start, I can probably figure this out & send a PR.
One way you can put the data in the cloud is using a file sync service like Dropbox for e.g. - so if you gave multiple Mac machines, you can still use and work on the same todo lists. You can use the setup keyword to specify a target folder (somewhere inside your root Dropbox folder). It doesn't matter which format is used (JSON, Taskpaper etc), as long as the underlying files are synced up, you should be able to access the same todo items and lists across machines.
That being said, for couchdb integration, I can think of two approaches.
Option 1 One is to tweak /master/src/store_json.py to save data to the couch db instance. I haven't used couchdb before, but you would need to store the connection string / database location information somewhere, so maybe the underlying .JSON file can contain this information, and the actual database calls happen in store_json.py / JsonStore class.
Option 2 You can add a new store type for couch db, but that involves a bit more work - for e.g. you would need to update /master/src/store.py to include a reference to your new custom data store (currently the lists are maintained as files, so you would need some placeholder file, maybe .couchdb or something so that the correct store instance is loaded). You would need to update formats.py to recognise the new couchdb store type, and add a new file store_couchdb.py with method signature similar to store_json.py. This is a bit more involving that option 1.
Either way, at the moment, a todo item is passed along as a dictionary once its read from a file. If you open up the .json file the workflow generates, you can see the required keys of the todo dict. Please have a look at the code and files mentioned to get an idea though. Hope I've explained in a way to help you get started...
From: BenziAhamed BenziAhamed Reply: BenziAhamed/todo [email protected] Date: 09. Oktober 2013 at 17:26:47 To: BenziAhamed/todo [email protected] Subject: Re: [todo] how to integrate json store to use couchdb? (#2)
One way you can put the data in the cloud is using a file sync service like Dropbox for e.g. - so if you gave multiple Mac machines, you can still use and work on the same todo lists. You can use the setup keyword to specify a target folder (somewhere inside your root Dropbox folder). It doesn't matter which format is used (JSON, Taskpaper etc), as long as the underlying files are synced up, you should be able to access the same todo items and lists across machines.
That being said, for couchdb integration, I can think of two approaches.
Option 1 One is to tweak /master/src/store_json.py to save data to the couch db instance. I haven't used couchdb before, but you would need to store the connection string / database location information somewhere, so maybe the underlying .JSON file can contain this information, and the actual database calls happen in store_json.py / JsonStore class.
Option 2 You can add a new store type for couch db, but that involves a bit more work - for e.g. you would need to update /master/src/store.py to include a reference to your new custom data store (currently the lists are maintained as files, so you would need some placeholder file, maybe .couchdb or something so that the correct store instance is loaded). You would need to update formats.py to recognise the new couchdb store type, and add a new file store_couchdb.py with method signature similar to store_json.py. This is a bit more involving that option 1.
Either way, at the moment, a todo item is passed along as a dictionary once its read from a file. If you open up the .json file the workflow generates, you can see the required keys of the todo dict. Please have a look at the code and files mentioned to get an idea though. Hope I've explained in a way to help you get started...
Reply to this email directly or view it on GitHub: https://github.com/BenziAhamed/todo/issues/2#issuecomment-25980412
Benzi
That's perfect -- thanks!
MfG/Cheers Dave Cottlehuber