Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 48137 invoked from network); 24 Jul 2009 22:28:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jul 2009 22:28:09 -0000 Received: (qmail 46586 invoked by uid 500); 24 Jul 2009 22:29:14 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 46492 invoked by uid 500); 24 Jul 2009 22:29:13 -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 46481 invoked by uid 99); 24 Jul 2009 22:29:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2009 22:29:13 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.132.248 as permitted sender) Received: from [209.85.132.248] (HELO an-out-0708.google.com) (209.85.132.248) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2009 22:29:03 +0000 Received: by an-out-0708.google.com with SMTP id b2so957104ana.5 for ; Fri, 24 Jul 2009 15:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=nRuGft9tkrfSJ5Ca+XTpE48Amf3Ow1Vpfy8QAdaUkOg=; b=aHy8k6P03wverhlcTBSTFNaYJG6Du+Khsjbep6uDO62skiILWaoP5hcC+BgdDr2M5u I+0AtqfVvEPaRISpoNgQGNcU8piIy2qk6mtVOgrmOzeQio5a76aszBFPMW7m+F/K+ZKV V6LDl+VOIh34pAJPEUNflOF6YdlRZEE3eXDWg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=avjw8Mn3QBNOfn/2qYo4H1dfjv/G/+xfrzyWmkyJ4Oxz09KvXBrOnnDg58ZqHX82F1 LuqEUzox18bW64d7MAyMAxDqR4sp00k8v97nHke/Uzu8q7ReFEALh0jzurHkwS5MMQwr 0XWUDwMIT7foFJY6Bjg8NuZtJtsXgbCgIVW1s= MIME-Version: 1.0 Received: by 10.100.250.16 with SMTP id x16mr5203299anh.25.1248474522865; Fri, 24 Jul 2009 15:28:42 -0700 (PDT) In-Reply-To: <921000907241506j35ec42ddh8e964b309eca22a0@mail.gmail.com> References: <921000907241219p6c78d5a8pee915294ed0af06d@mail.gmail.com> <921000907241506j35ec42ddh8e964b309eca22a0@mail.gmail.com> Date: Fri, 24 Jul 2009 18:28:42 -0400 Message-ID: Subject: Re: switching between response content type in show? how to trigger html response inst of default xml From: Paul Davis To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Another shot in the dark, care to try quoting the html value so that it's {"html": ...} On Fri, Jul 24, 2009 at 6:06 PM, Nitin Borwankar wrote= : > Hi Chris, > > In CouchDBX 0.9 on Leopard adding ?format=3Dhtml =A0hangs and then gives = foll > error > > {"error":"noproc","reason":"{gen_server,call,\n > [couch_query_servers,{ret_proc,<<\"javascript\">>,<0.16450.0>}]}"} > > Same behavior when you remove the xml: key/val pair and leave just the ht= ml: > > I don't see anything in the code or the template that may be a problem do > you ? > > Nitin > > 37% of all statistics are made up on the spot > -------------------------------------------------------------------------= ------------ > Nitin Borwankar > nborwankar@gmail.com > > > On Fri, Jul 24, 2009 at 2:49 PM, Chris Anderson wrote= : > >> On Fri, Jul 24, 2009 at 12:19 PM, Nitin Borwankar >> wrote: >> > Hi guys, >> > >> > so the list/show coding is going well - have the show running except f= or >> one >> > blocker - I am using curl to invoke the show (alost identical to examp= le) >> in >> > couch app as follows - change dthe name from example to show_details i= n >> both >> > the shows code and lib/template - id in this request is "aacosta" =A0-= the >> > template just returns a doc with the id in it >> > >> > curl $CDB/ptest2/_design/vt2/_show/show_details/aacosta >> > >> > >> > =A0 >> > >> > >> > two questions >> > >> > Why is the xml being sent back by default? What is the right param to >> pass >> > in to trigger the html? >> > >> > show function is as follows >> > >> > >> > function(doc, req) { >> > =A0// !code lib/helpers/template.js >> > =A0// !json lib.templates >> > >> > =A0respondWith(req, { >> > =A0 =A0html : function() { >> > =A0 =A0 =A0var html =3D template(lib.templates.show_details, doc); >> > =A0 =A0 =A0return {body:html} >> > =A0 =A0}, >> > =A0 =A0xml : function() { >> > =A0 =A0 =A0return { >> > =A0 =A0 =A0 =A0body : >> > =A0 =A0 =A0} >> > =A0 =A0} >> > =A0}) >> > }; >> >> Accept header handling in browsers is so bad I'm starting to wish I'd >> never written that code. Kinda want to strip it out altogether. >> >> I believe Rails just stopped supporting the Accept header for the same >> reason. (They've moved to URLs like /path/object.xml due to lack of >> browser support for Accept.) >> >> To make a long story short, for the time being you can request: >> >> $CDB/ptest2/_design/vt2/_show/show_details/aacosta?format=3Dhtml >> >> to override the format. >> >> Chris >> >> > >> > >> > html template is as follows >> > >> > >> > >> > >> > =A0 >> > =A0 =A0Details >> > =A0 >> > =A0 >> > =A0 =A0
>> > =A0 =A0 =A0

<% doc._id %>

>> > =A0 =A0
>> > =A0 >> > >> > >> > >> > >> > Thanks much, >> > >> > >> > >> > >> > 37% of all statistics are made up on the spot >> > >> ------------------------------------------------------------------------= ------------- >> > Nitin Borwankar >> > nborwankar@gmail.com >> > >> >> >> >> -- >> Chris Anderson >> http://jchrisa.net >> http://couch.io >> >