http://couchapp.org/page/couchapp-python
On 20 December 2012 14:36, Scott Weber <[email protected]> wrote: > Ok, than can someone provide a definition of 'CouchApp'...? > > I googled and found a 'couchapp'. I followed the instructions, which were to > attach an Index.html file to a design document. Then when I browse to > 127.0.0.1:5984/whatever/_design/doc/index.html the 'couchapp' just gives me a > list of the databases in the server (hyperlinked). If I click on one, it > redirects me back to Futon. > > It would appear there is some big unexplained world of couch 'APPS' out there, > unrelated to what I found in the online book. > > ----- Original Message ---- > From: Aliaksandr Barysiuk <[email protected]> > To: [email protected] > Sent: Thu, December 20, 2012 12:43:03 AM > Subject: Re: Design docs and javascript function unreadable...? > > Scott, > > As Robert Newson mentioned you can edit files locally in your favorite editor > and then use couchapp (kanso, erica?) to > > push the app to couchdb. > > Thank's > > Alex > > On 20/12/12 04:32, Scott Weber wrote: >> Mark, >> I am looking at the JSON string because FUTON is the only tool I have that >>gives >> me an interface. >> >> I also took the JSON dos and put it in a file, and used curl to upload it. >> It >> still rejects it. >> >> In both cases, these are the only tools I am aware of. They are the only > things >> described in the tutorial book. They are the instructions I am following. >> >> The online book functions all have newlines, tabs, comments, etc... It is > only >> natural that someone reading it would copy and paste them into the design doc >>in >> order to test. >> >> My example design doc is below. It only can be installed (using FUTON or > curl) >> when all the whitespace is stripped out manually by me. >> >> I cannot see how manually creating a slightly more complex function then >> these >> examples would not be begging for mistakes when forced to de-beautify it >> manually for loading in through FUTON or curl. >> >> There is no way to just tell "validate_doc_update" to load a function from a >> whatever.js file? So the function can remain readable? >> >> >> { >> "_id": "_design/example", >> "_rev": "4-942673df70142b3c1d181628f93e1184", >> "validate_doc_update": >> "function(newDoc, oldDoc, userCtx) { >> function require(field, message) { >> message = message || field; >> throw({forbidden : message}); >> }; >> if (!newDoc.session) { return; } // if it's not a session document... >> if (newdoc.BoxNumber && (newdoc.BoxNumber) != oldDoc.BoxNumber)) { >> require('BoxNumber','Box Number cannot change'); >> } >> }", >> "views": { >> "foo": { >> "map": "function(doc){ emit(doc._id, doc._rev)}" >> } >> } >> } >> >> >> >> ----- Original Message ---- >> From: Mark Hahn <[email protected]> >> To: user <[email protected]> >> Sent: Wed, December 19, 2012 6:29:54 PM >> Subject: Re: Design docs and javascript function unreadable...? >> >> Seriously. >> >> It is stored as json and control chars aren't allowed in json strings. >> All tools should handle the conversion in and out. Futon handles it >> fine. My custom scripts handle it fine. Why would you be looking at >> the json string directly? >> >> On Wed, Dec 19, 2012 at 4:08 PM, Scott Weber <[email protected]> >> wrote: >>> Clearly, this can't be the way it is supposed to behave. >>> >>> I must be missing something, somewhere... >>> >>> In a design doc, I put a function to validate. I used to >>> validate_doc_update >>> key of the design JSON. All taken from examples in the guide. Then I found >>> out... >>> >>> The javascript in the design doc cannot have newlines..? cannot have >>> tabs..? >>> Cannot be formatted so that it's readable..? Seriously? >>> >>> There has to be a way to put readable code into this. What am I missing? > All >>> the code in the "The Definitive Guide' is loaded with comments, line breaks, >>> etc... >>> >>> -Scott
