Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 51F7CDD1A for ; Thu, 20 Dec 2012 14:37:21 +0000 (UTC) Received: (qmail 93269 invoked by uid 500); 20 Dec 2012 14:37:20 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 92929 invoked by uid 500); 20 Dec 2012 14:37:18 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 92901 invoked by uid 99); 20 Dec 2012 14:37:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Dec 2012 14:37:17 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [98.136.216.227] (HELO nm32-vm4.bullet.mail.gq1.yahoo.com) (98.136.216.227) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Dec 2012 14:37:07 +0000 Received: from [98.137.12.61] by nm32.bullet.mail.gq1.yahoo.com with NNFMP; 20 Dec 2012 14:36:46 -0000 Received: from [98.139.44.80] by tm6.bullet.mail.gq1.yahoo.com with NNFMP; 20 Dec 2012 14:36:45 -0000 Received: from [127.0.0.1] by omp1017.access.mail.sp2.yahoo.com with NNFMP; 20 Dec 2012 14:36:45 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 893772.90287.bm@omp1017.access.mail.sp2.yahoo.com Received: (qmail 85526 invoked by uid 60001); 20 Dec 2012 14:36:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s1024; t=1356014205; bh=RxpKHAf9zRV3shS2dhZdkpCK6SA3Wsg4vlYtpO0UPps=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=qeNkZ8HA3NpUds1VqFSqV8sayJV8pC+3PoCvJAt4GBQYNWG1DpxTvGeSUJWGheNM3CA15bZ499xbPaj4nFK54Klc6iEZNR72am1+xLBRdh1pCkOdG5xY5/cscMntDUlKOxYTUemgYo3ndbjZ4lTLY4gS8+/1BqJczqXHAJFjFM0= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=3GYQlVIpnK02R2nWlnyJ4tnaaa69Nym3MGOMXdF/mH0XzYR/FZvzds8YqjYrLLDkpHM4L4rCV/aTT7VYmZv+ixSgmqmtgCGLJUWCf8Dem9q2AECA1NQly3GfbmzgGI1lvj7FZSrWROjxQn2hxyLm7gE4H6wOKa86gd1WQ50vymU=; X-YMail-OSG: BXehwtEVM1ngGuNx.LhnYudSb1JgofALkxKZzAVL2tiJ.U2 YaE1nrcWeHtyo.WgpBNnCiLvCwriPzi8mwibFG8uGVY.m8eA.Xg5vwj4mHDp LOmHDpzRqqNr7kyIZR5RPCRTV0odSt9Km.e30ai4PQXd4iSNio1.k3zu5t0D H9aMIjnxMcMPxOiPHPjeTop6QikZAds0Gje02Om6OV9iaAB6ihNPBEOdjGev 6.MTkRTuZtnuSDCsMP49MSO005Eyf0Xmqp.1n.fOykh1vhX8ifEw5qlhHTG6 cdIv4CCAmv1iT.IEXlhyHgqZfkNH_Q5GgVwEPjTvwntfWgFmYe78hYHNSVb6 iz.gtcpUCB09SFInBBt.j8kb96CHVAExttn0qA8ytzytwrddr2IGM084TIRJ UlqvzELpSHIi7P8sc1sltwowVyE6bWVf7JWcubNdCBFoxD7T.lU09c_.WfRj Sg9upn5e_P.IBVVZ9_6WEeP3z.VgrgIJhG60yhfJ9tw8eK5XiX6m3JfTnbU6 gyR_3PyjOA7PqtSARD.fnWrsJHe_A4iTAW8kblrM5UMsXFaR4Byxptmq6tkL pPQ5pPpGHpI06nYGblGFnsAOlF3CfQnn12UH7BEyyDVb9ZduSN493G9fCnA- - Received: from [99.189.12.49] by web181705.mail.ne1.yahoo.com via HTTP; Thu, 20 Dec 2012 06:36:44 PST X-Rocket-MIMEInfo: 001.001,T2ssIHRoYW4gY2FuIHNvbWVvbmUgcHJvdmlkZSBhIGRlZmluaXRpb24gb2YgJ0NvdWNoQXBwJy4uLj8KCkkgZ29vZ2xlZCBhbmQgZm91bmQgYSAnY291Y2hhcHAnLiAgSSBmb2xsb3dlZCB0aGUgaW5zdHJ1Y3Rpb25zLCB3aGljaCB3ZXJlIHRvIAphdHRhY2ggYW4gSW5kZXguaHRtbCBmaWxlIHRvIGEgZGVzaWduIGRvY3VtZW50LiAgVGhlbiB3aGVuIEkgYnJvd3NlIHRvIAoxMjcuMC4wLjE6NTk4NC93aGF0ZXZlci9fZGVzaWduL2RvYy9pbmRleC5odG1sIHRoZSAnY291Y2hhcHAnIGp1c3QgZ2l2ZXMgbWUgYSABMAEBAQE- X-Mailer: YahooMailRC/718 YahooMailWebService/0.8.129.483 References: <1355962106.12878.YahooMailRC@web181706.mail.ne1.yahoo.com> <1355967159.2425.YahooMailRC@web181706.mail.ne1.yahoo.com> <50D2B359.505@gmail.com> Message-ID: <1356014204.33801.YahooMailRC@web181705.mail.ne1.yahoo.com> Date: Thu, 20 Dec 2012 06:36:44 -0800 (PST) From: Scott Weber Subject: Re: Design docs and javascript function unreadable...? To: user@couchdb.apache.org In-Reply-To: <50D2B359.505@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked by ClamAV on apache.org 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 To: user@couchdb.apache.org 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 > To: user > 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 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