incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nitin Borwankar <ni...@borwankar.com>
Subject Re: switching between response content type in show? how to trigger html response inst of default xml
Date Fri, 24 Jul 2009 22:50:14 GMT
Also if it matters I am using couchapp 0.2 - does that matter ?
When I last looked the default versions of jquery and jquery.couch.js were
1.2.6 and 0.8 in couchapp code eg templates/example.html
while the corresponding versions in couch 0.9 were 1.3.1 and of course 0.9
respectively.

Nitin


37% of all statistics are made up on the spot
-------------------------------------------------------------------------------------
Nitin Borwankar
nborwankar@gmail.com


On Fri, Jul 24, 2009 at 3:47 PM, Nitin Borwankar <nitin@borwankar.com>wrote:

> Hi Paul,
>
> No change - still the same error.
>
>
>  curl $CDB/ptest2/_design/vt2/_show/show_details/aacosta?format=html
>
> {"error":"noproc","reason":"{gen_server,call,\n
> [couch_query_servers,{ret_proc,<<\"javascript\">>,<0.19458.0>}]}"}
>
>
>
> Has anyone gotten list views to work on 0.9 ?
> I can't be the only one having this problem right?
> Or are most people not using couchapp ?
>
> Nitin
>
> 37% of all statistics are made up on the spot
>
> -------------------------------------------------------------------------------------
> Nitin Borwankar
> nborwankar@gmail.com
>
>
> On Fri, Jul 24, 2009 at 3:28 PM, Paul Davis <paul.joseph.davis@gmail.com>wrote:
>
>> 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<nitin@borwankar.com>
>> wrote:
>> > 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 <jchris@apache.org>
>> wrote:
>> >
>> >> On Fri, Jul 24, 2009 at 12:19 PM, Nitin Borwankar<nitin@borwankar.com>
>> >> 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
>> >> >
>> >> > <xml>
>> >> >  <node value="aacosta"/>
>> >> > </xml>
>> >> >
>> >> > 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 : <xml><node value={doc._id}/></xml>
>> >> >      }
>> >> >    }
>> >> >  })
>> >> > };
>> >>
>> >> 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
>> >> >
>> >> >
>> >> > <!DOCTYPE html>
>> >> > <html>
>> >> >  <head>
>> >> >    <title>Details</title>
>> >> >  </head>
>> >> >  <body>
>> >> >    <div id="docid">
>> >> >      <h1><% doc._id %></h1>
>> >> >    </div>
>> >> >  </body>
>> >> >
>> >> > </html>
>> >> >
>> >> >
>> >> > 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
>> >>
>> >
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message