Message from discussion
Writing Lists in Python?
Received: by 10.236.185.36 with SMTP id t24mr774018yhm.4.1309374556002;
Wed, 29 Jun 2011 12:09:16 -0700 (PDT)
X-BeenThere: couchdb-python@googlegroups.com
Received: by 10.91.69.31 with SMTP id w31ls315498agk.2.gmail; Wed, 29 Jun 2011
12:09:15 -0700 (PDT)
Received: by 10.91.158.2 with SMTP id k2mr159845ago.6.1309374555137;
Wed, 29 Jun 2011 12:09:15 -0700 (PDT)
Date: Wed, 29 Jun 2011 12:09:05 -0700 (PDT)
From: Kxepal <kxe...@gmail.com>
Reply-To: couchdb-python@googlegroups.com
To: couchdb-python@googlegroups.com
Message-ID: <31547772.1355.1309374545847.JavaMail.geo-discussion-forums@yqfu15>
In-Reply-To: <BANLkTi=oa7uEgE1X4AKSx8GUYwWTYPZhJg@mail.gmail.com>
Subject: Re: Writing Lists in Python?
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1353_10528604.1309374545844"
------=_Part_1353_10528604.1309374545844
Content-Type: multipart/alternative;
boundary="----=_Part_1354_21737290.1309374545845"
------=_Part_1354_21737290.1309374545845
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Just extract couchdb folder from archive over couchdb installed package:
where should be added server folder and replaced view.py by new one.
Next thing you have to do is specify version of CouchDB against that query
server will be runned (supported since 0.9 till 1.1.0).
This could be done by edition [query_server] config option to made it looks
like this (for 1.1.0 version):
python=/path/to/couchpy --couchdb-version=1.1.0
And it should work(: For more information you may build sphinx docs - there
have described all command line options, objects and usage examples.
On Wednesday, June 29, 2011 10:12:53 PM UTC+4, John Meehan wrote:
>
> Thanks! My next question, however, is how do I install the updated files?
>
> I downloaded *query-server.tar.gz* from your May 9th post in the issue 146
> thread.
>
> I'm running Ubuntu 10.04, and installed couchdb-python originally with
> easy-install. So I have the following in my
> /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/couchdb dir:
>
> -rwxr-xr-x 1 root staff 37477 2011-06-01 09:58 client.py
> -rw-r--r-- 1 root staff 45267 2011-06-01 09:58 client.pyc
> -rwxr-xr-x 1 root staff 7649 2011-06-01 09:58 design.py
> -rw-r--r-- 1 root staff 8355 2011-06-01 09:58 design.pyc
> -rwxr-xr-x 1 root staff 17607 2011-06-01 09:58 http.py
> -rw-r--r-- 1 root staff 20156 2011-06-01 09:58 http.pyc
> -rwxr-xr-x 1 root staff 534 2011-06-01 09:58 __init__.py
> -rw-r--r-- 1 root staff 687 2011-06-01 09:58 __init__.pyc
> -rwxr-xr-x 1 root staff 4441 2011-06-01 09:58 json.py
> -rw-r--r-- 1 root staff 5859 2011-06-01 09:58 json.pyc
> -rwxr-xr-x 1 root staff 22337 2011-06-01 09:58 mapping.py
> -rw-r--r-- 1 root staff 34371 2011-06-01 09:58 mapping.pyc
> -rwxr-xr-x 1 root staff 8640 2011-06-01 09:58 multipart.py
> -rw-r--r-- 1 root staff 9080 2011-06-01 09:58 multipart.pyc
> drwxr-sr-x 2 root staff 4096 2011-06-01 09:58 tests
> drwxr-sr-x 2 root staff 4096 2011-06-01 09:58 tools
> -rwxr-xr-x 1 root staff 7167 2011-06-01 09:58 view.py
> -rw-r--r-- 1 root staff 7498 2011-06-01 09:58 view.pyc
>
> (I'm assuming I need to overwrite or add the new files from the archive
> here.)
>
>
> On Wed, Jun 29, 2011 at 12:20 PM, Kxepal <kxe...@gmail.com> wrote:
>
>>
>> On Wednesday, June 29, 2011 7:58:11 PM UTC+4, John Meehan wrote:
>>>
>>> Can Lists be written in Python?
>>>
>>> What would be the Python equivalent of this example from the CouchDB
>>> wiki (http://wiki.apache.org/**couchdb/Formatting_with_Show_**and_List<http://wiki.apache.org/couchdb/Formatting_with_Show_and_List>)?
>>>
>>>
>>> function(head, req) {
>>> var row;
>>> start({
>>> "headers": {
>>> "Content-Type": "text/html"
>>> }
>>> });
>>> while(row = getRow()) {
>>> send(row.value);
>>> }
>>> }
>>
>>
>> Hi!
>>
>> Currently this could be done by using new query server from issue 146 (
>> http://code.google.com/p/couchdb-python/issues/detail?id=146)
>> Equivalent would be :
>> def fun(head, req):
>> start({
>> "headers": {"Content-Type": "text/html"}
>> })
>> for row in get_row():
>> send(row["value"])
>>
>> Notice, that get_row function is generator and any dotted notation
>> accessed attributes should be changed to getitem specification due to this
>> is dict object.
>> Also notice, that builtn query server function are respect PEP-8, so there
>> is nothing mixedCased nor CamelCase except exceptions(Forbidden, Error,
>> FatalError).
>>
>> If you would try this query server any feedback would be great(:
>>
>> --
>> ,,,^..^,,,
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "CouchDB-Python" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/couchdb-python/-/KQWWZ2-nQo0J.
>>
>> To post to this group, send email to couchdb...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> couchdb-pytho...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/couchdb-python?hl=en.
>>
>
>
------=_Part_1354_21737290.1309374545845
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Just extract couchdb folder from archive over couchdb installed package: wh=
ere should be added server folder and replaced view.py by new one.<div>Next=
thing you have to do is specify version of CouchDB against that query serv=
er will be runned (supported since 0.9 till 1.1.0).</div><div>This could be=
done by edition [query_server] config option to made it looks like this (f=
or 1.1.0 version):</div><div>python=3D/path/to/couchpy --couchdb-version=3D=
1.1.0 </div><div><br></div><div>And it should work(: For more informat=
ion you may build sphinx docs - there have described all command line optio=
ns, objects and usage examples.</div><div><br></div><div><div><div><br>On W=
ednesday, June 29, 2011 10:12:53 PM UTC+4, John Meehan wrote:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;">Thanks! My next question, however, is =
how do I install the updated files?<div><br></div><div>I downloaded <s=
pan style=3D"font-family:arial, sans-serif;font-size:12px"><b>query-server.=
tar.gz</b></span><span style=3D"font-family:arial, sans-serif;font-size:12p=
x"><wbr> from your May 9th post in the issue 146 thread. </span>=
</div>
<div><font face=3D"arial, sans-serif"><span style=3D"font-size:12px"><br></=
span></font></div><div>
<font face=3D"arial, sans-serif"><span style=3D"font-size:12px">I'm running=
Ubuntu 10.04, and installed couchdb-python originally with easy-install. &=
nbsp;So I have the following in my /usr/local/lib/python2.6/dist-<wbr>packa=
ges/CouchDB-0.8-py2.6.<wbr>egg/couchdb dir:</span></font></div>
<div><font face=3D"arial, sans-serif"><span style=3D"font-size:12px"><br></=
span></font></div><div>
-rwxr-xr-x 1 root staff 37477 2011-06-01 09:58 client.py</div><div>-rw-r--r=
-- 1 root staff 45267 2011-06-01 09:58 client.pyc</div><div>-rwxr-xr-x 1 ro=
ot staff 7649 2011-06-01 09:58 design.py</div><div>-rw-r--r-- 1 root =
staff 8355 2011-06-01 09:58 design.pyc</div>
<div>-rwxr-xr-x 1 root staff 17607 2011-06-01 09:58 http.py</div><div>-rw-r=
--r-- 1 root staff 20156 2011-06-01 09:58 http.pyc</div><div>-rwxr-xr-x 1 r=
oot staff 534 2011-06-01 09:58 __init__.py</div><div>-rw-r--r-- 1 ro=
ot staff 687 2011-06-01 09:58 __init__.pyc</div>
<div>-rwxr-xr-x 1 root staff 4441 2011-06-01 09:58 json.py</div><div>=
-rw-r--r-- 1 root staff 5859 2011-06-01 09:58 json.pyc</div><div>-rwx=
r-xr-x 1 root staff 22337 2011-06-01 09:58 mapping.py</div><div>-rw-r--r-- =
1 root staff 34371 2011-06-01 09:58 mapping.pyc</div>
<div>-rwxr-xr-x 1 root staff 8640 2011-06-01 09:58 multipart.py</div>=
<div>-rw-r--r-- 1 root staff 9080 2011-06-01 09:58 multipart.pyc</div=
><div>drwxr-sr-x 2 root staff 4096 2011-06-01 09:58 tests</div><div>d=
rwxr-sr-x 2 root staff 4096 2011-06-01 09:58 tools</div>
<div>-rwxr-xr-x 1 root staff 7167 2011-06-01 09:58 view.py</div><div>=
-rw-r--r-- 1 root staff 7498 2011-06-01 09:58 view.pyc</div><div><fon=
t face=3D"arial, sans-serif"><span style=3D"font-size:12px"><br>
</span></font></div><div><font face=3D"arial, sans-serif"><span style=3D"fo=
nt-size:12px">(I'm assuming I need to overwrite or add the new files from t=
he archive here.)</span><span style=3D"font-size:12px"><br>
</span></font></div><div><font face=3D"arial, sans-serif"><span style=3D"fo=
nt-size:12px"><br></span></font></div>
<div><font face=3D"arial, sans-serif"><span style=3D"font-size:12px"><br></=
span></font><div class=3D"gmail_quote">
On Wed, Jun 29, 2011 at 12:20 PM, Kxepal <span dir=3D"ltr"><<a>kxe...@gm=
ail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>On Wednesday, June 29, 2011 7:58:11 PM UTC+4, John Meehan wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex">Can Lists be written in Python?
<br>
<br>What would be the Python equivalent of this example from the CouchDB
<br>wiki (<a href=3D"http://wiki.apache.org/couchdb/Formatting_with_Show_an=
d_List" target=3D"_blank">http://wiki.apache.org/<u></u>couchd<wbr>b/Format=
ting_with_Show_<u></u>and_<wbr>List</a>)?
<br>
<br>function(head, req) {
<br> var row;
<br> start({
<br> "headers": {
<br> "Content-Type": "text/html"
<br> }
<br> });
<br> while(row =3D getRow()) {
<br> send(row.value);
<br> }
<br>}</blockquote><div><br></div></div><div>Hi!</div><div><br></div><div>Cu=
rrently this could be done by using new query server from issue 146 (<a hre=
f=3D"http://code.google.com/p/couchdb-python/issues/detail?id=3D146" target=
=3D"_blank">http://code.google.com/p/<wbr>couchdb-python/issues/detail?<wbr=
>id=3D146</a>)</div>
<div>Equivalent would be :</div><div>def fun(head, req):</div><div><div>&nb=
sp; start({</div><div> "headers": {"Content-Type": "text/html"=
}</div><div> })</div></div><div> for row in get_row():</div>
<div> send(row["value"])</div><div><br></div><div>Notice, that=
get_row function is generator and any dotted notation accessed attributes =
should be changed to getitem specification due to this is dict object.</div=
>
<div>Also notice, that builtn query server function are respect PEP-8, so t=
here is nothing mixedCased nor CamelCase except exceptions(Forbidden, Error=
, FatalError).</div><div><br></div><div>If you would try this query server =
any feedback would be great(:</div>
<div><br></div><div>--</div><div>,,,^..^,,,</div><div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "=
CouchDB-Python" group.<br></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msg/couchdb-python/-/KQWWZ2-nQo0J" target=3D"_blank">https://groups.go=
ogle.com/d/<wbr>msg/couchdb-python/-/KQWWZ2-<wbr>nQo0J</a>.<div><div></div>=
<div>
<br>=20
To post to this group, send email to <a>couchdb...@googlegroups.com</a>.<br=
>
To unsubscribe from this group, send email to <a>couchdb-pytho...@googlegro=
ups.<wbr>com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/couchdb-python?hl=3Den" target=3D"_blank">http://groups.google.com/<wb=
r>group/couchdb-python?hl=3Den</a>.<br>
</div></div></blockquote></div><br></div>
</blockquote></div></div></div>
------=_Part_1354_21737290.1309374545845--
------=_Part_1353_10528604.1309374545844--