From user-return-5617-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri Jul 24 22:07:42 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 40095 invoked from network); 24 Jul 2009 22:07:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jul 2009 22:07:41 -0000 Received: (qmail 32288 invoked by uid 500); 24 Jul 2009 22:08:45 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 32202 invoked by uid 500); 24 Jul 2009 22:08:45 -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 32192 invoked by uid 99); 24 Jul 2009 22:08:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2009 22:08:45 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of nborwankar@gmail.com designates 209.85.210.204 as permitted sender) Received: from [209.85.210.204] (HELO mail-yx0-f204.google.com) (209.85.210.204) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2009 22:08:34 +0000 Received: by yxe42 with SMTP id 42so3468072yxe.13 for ; Fri, 24 Jul 2009 15:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=9ZhCH2OoRx4QpkQE2muQRVgE+16XcZ3+JVqgN92hSC0=; b=itXJzbP8CSUDzSve110Frle9fxLI8wmElQt8eF0e3lDaa4S8cRO+Q6VEZWphtZwg7V 0J1HFNAUWajzQioSOpDSUwJSeb0OTP9UJSFD+mVoU7HZIWuVx893HcVgoCE7yWcefc91 DcQlpTu0ODRcSGHb1VqJMSTYYAjA2jbBO59Uo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=N1u4AU7OF9ot1JxR91gcZ2R3HlYI1A0ao4FupjYqTNf51/fALcCy9dx9K7gS1gEcJc E9gugabQd1MJliBr+xeoz5KlphYbWYRicidCSlYmUrnI5yBu1KEsUgzsfSZ12xmKwxvC G5yc3tDB4MZVsO2yqv+NOlwiCVzehIivIGzcA= MIME-Version: 1.0 Sender: nborwankar@gmail.com Received: by 10.231.15.77 with SMTP id j13mr1365034iba.1.1248473203998; Fri, 24 Jul 2009 15:06:43 -0700 (PDT) In-Reply-To: References: <921000907241219p6c78d5a8pee915294ed0af06d@mail.gmail.com> Date: Fri, 24 Jul 2009 15:06:43 -0700 X-Google-Sender-Auth: 9fb75f49177a597b Message-ID: <921000907241506j35ec42ddh8e964b309eca22a0@mail.gmail.com> Subject: Re: switching between response content type in show? how to trigger html response inst of default xml From: Nitin Borwankar To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0003255765f6d6e06b046f7ad134 X-Virus-Checked: Checked by ClamAV on apache.org --0003255765f6d6e06b046f7ad134 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Chris, In CouchDBX 0.9 on Leopard adding ?format=html hangs 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 html: 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 for > one > > blocker - I am using curl to invoke the show (alost identical to example) > in > > couch app as follows - change dthe name from example to show_details in > both > > the shows code and lib/template - id in this request is "aacosta" - the > > template just returns a doc with the id in it > > > > curl $CDB/ptest2/_design/vt2/_show/show_details/aacosta > > > > > > > > > > > > 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) { > > // !code lib/helpers/template.js > > // !json lib.templates > > > > respondWith(req, { > > html : function() { > > var html = template(lib.templates.show_details, doc); > > return {body:html} > > }, > > xml : function() { > > return { > > body : > > } > > } > > }) > > }; > > 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=html > > to override the format. > > Chris > > > > > > > html template is as follows > > > > > > > > > > > > Details > > > > > >
> >

<% doc._id %>

> >
> > > > > > > > > > > > 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 > --0003255765f6d6e06b046f7ad134--