Problem with CouchApp 0.5.1

64 views
Skip to first unread message

Nils Breunese

unread,
Dec 9, 2009, 8:12:53 AM12/9/09
to CouchApp
Hello,

I just upgraded to CouchApp 0.5.1, from version 0.4. I added a view to
my app and then wanted to push the new version to our test server
(CouchDB 0.10.0). The result was that I couldn't find the design
document in CouchDB anymore, it looked like the current design
document was removed and the new version was not pushed. However,
CouchApp did not show any error messages.

Running the push again with verbose output enabled shows this:

----
$ couchapp -v push schedule http://couchdb.test.vpro.nl:5984/guide
[INFO] push views/gidsblog-by-end/map.js
[INFO] push views/vpro-radio-by-end/map.js
[INFO] push views/vpro-by-end/map.js
[INFO] push views/events-by-program-id/map.js
[INFO] push views/vpro-tv-by-end/map.js
[INFO] push vendor/couchapp/date.js
[INFO] push vendor/couchapp/couchapp.js
[INFO] push vendor/couchapp/README.md
[INFO] push vendor/couchapp/path.js
[INFO] push vendor/couchapp/template.js
[INFO] push lib/helpers/math.js
[INFO] push lib/helpers/template.js
[INFO] push lib/templates/example.html
[INFO] push language
[INFO] push templates/atom/head.html
[INFO] push lists/atom.js
[INFO] attach vendor/couchapp/jquery.couchapp.js
[INFO] Visit your CouchApp here:
http://couchdb.test.vpro.nl:5984/guide/schedule/index.html
----

However, in Futon I don't see any design documents for this database.
I also noted that /guide/_design/schedule returns
{"error":"not_found","reason":"missing"}, while /guide/schedule does
seem to return the new design document! Is this the new location for
design documents? (I haven't done much with this code for a while.)
According to http://wiki.apache.org/couchdb/HTTP_view_API it is still /
db/_design/designdocname/_view/viewname. I'm confused now. Any ideas?

Nils Breunese.

Benoit Chesneau

unread,
Dec 9, 2009, 9:11:21 AM12/9/09
to couc...@googlegroups.com
There is a change introduced in couchapp 0.5. You need to put an _id
file in your couchapp containing _design/schedule . This to make the
difference between a design doc or a "simple" doc. the _id is created
during the generate or via the clone if it doesn't exist. Let me know
if it doesn't work for you.

- benoît

Nils Breunese

unread,
Dec 9, 2009, 9:40:37 AM12/9/09
to couc...@googlegroups.com
Benoit Chesneau wrote:

> There is a change introduced in couchapp 0.5. You need to put an _id
> file in your couchapp containing _design/schedule . This to make the
> difference between a design doc or a "simple" doc. the _id is created
> during the generate or via the clone if it doesn't exist. Let me know
> if it doesn't work for you.

Ah, I missed this change. I have added an _id file to my couchapp. Now
when I try to push my couchapp I get this error:

----
[CRITICAL] string indices must be integers
Traceback (most recent call last):
File "/usr/local/bin/couchapp", line 5, in <module>
pkg_resources.run_script('Couchapp==0.5.1', 'couchapp')
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 448,
in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1166,
in run_script
execfile(script_filename, namespace, namespace)
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/EGG-INFO/scripts/couchapp",
line 28, in <module>
couchapp.dispatch.run()
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/couchapp/dispatch.py",
line 29, in run
sys.exit(dispatch(sys.argv[1:]))
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/couchapp/dispatch.py",
line 40, in dispatch
return _dispatch(ui, args)
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/couchapp/dispatch.py",
line 85, in _dispatch
return fun(ui, path, *args, **opts)
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/couchapp/commands.py",
line 68, in push
localdoc.push(dbs, opts.get('no_atomic', False))
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/couchapp/localdoc.py",
line 114, in push
db.save_doc(doc)
File
"/usr/local/lib/python2.6/dist-packages/Couchapp-0.5.1-py2.6.egg/couchapp/couchdbclient.py",
line 386, in save_doc
doc.update({ '_id': res['id'], '_rev': res['rev']})
TypeError: string indices must be integers
----

Nils.

Benoit Chesneau

unread,
Dec 9, 2009, 9:56:25 AM12/9/09
to couc...@googlegroups.com
On Wed, Dec 9, 2009 at 3:40 PM, Nils Breunese <N.Bre...@vpro.nl> wrote:
> Benoit Chesneau wrote:
>
>> There is a change introduced in couchapp 0.5. You need to put an _id
>> file in your couchapp containing _design/schedule . This to make the
>> difference between a design doc or a "simple" doc. the _id is created
>> during the generate or via the clone if it doesn't exist. Let me know
>> if it doesn't work for you.
>
> Ah, I missed this change. I have added an _id file to my couchapp. Now
> when I try to push my couchapp I get this error:
>

how looks your _id file ? It should be docid on one line.

Benoit Chesneau

unread,
Dec 9, 2009, 9:59:11 AM12/9/09
to couc...@googlegroups.com
I can't reproduce your error here :

enlil:~ benoitc$ couchapp generate test
enlil:~ benoitc$ cd test/
enlil:test benoitc$ ls
_attachments _id couchapp.json lists shows updates vendor views
enlil:test benoitc$ more _id
_design/test
enlil:test benoitc$ couchapp push testdb
[INFO] database testdb created.
[INFO] Visit your CouchApp here:
http://127.0.0.1:5984/testdb/_design/test/index.html

Nils Breunese

unread,
Dec 9, 2009, 10:13:41 AM12/9/09
to couc...@googlegroups.com
Looks fine to me:

----
$ cat schedule/_id
_design/schedule
----

Nils Breunese.

Nils Breunese

unread,
Dec 9, 2009, 10:14:43 AM12/9/09
to couc...@googlegroups.com
Benoit Chesneau wrote:

> I can't reproduce your error here :
>
> enlil:~ benoitc$ couchapp generate test
> enlil:~ benoitc$ cd test/
> enlil:test benoitc$ ls
> _attachments _id couchapp.json lists shows updates vendor views
> enlil:test benoitc$ more _id
> _design/test
> enlil:test benoitc$ couchapp push testdb
> [INFO] database testdb created.
> [INFO] Visit your CouchApp here:
> http://127.0.0.1:5984/testdb/_design/test/index.html

My old couchapp doesn't have a couchapp.json file. Could that be the
problem?

Nils.

Benoit Chesneau

unread,
Dec 9, 2009, 10:51:46 AM12/9/09
to couc...@googlegroups.com
On Wed, Dec 9, 2009 at 4:14 PM, Nils Breunese <N.Bre...@vpro.nl> wrote:
> My old couchapp doesn't have a couchapp.json file. Could that be the
> problem?
>
> Nils.
No. (just retried without)) I'm trying to see what could the problem
but didn't find anything for now.

- benoit

Benoit Chesneau

unread,
Dec 9, 2009, 11:10:09 AM12/9/09
to couc...@googlegroups.com
> --
what give you the result of an --export ?

couchapp push --export yourapp

do you have _id in ?

Nils Breunese

unread,
Dec 9, 2009, 11:42:05 AM12/9/09
to couc...@googlegroups.com
Benoit Chesneau wrote:

> what give you the result of an --export ?
>
> couchapp push --export yourapp
>
> do you have _id in ?

The export returns an error:

----
$ couchapp push --export schedule
[ERROR] couchapp error: You aren't in a couchapp.
----

Nils.

Benoit Chesneau

unread,
Dec 9, 2009, 12:06:59 PM12/9/09
to couc...@googlegroups.com
yes export works only in couchapp . That was a bug (fixed in latest head) .

Nils Breunese

unread,
Dec 10, 2009, 4:35:51 AM12/10/09
to couc...@googlegroups.com
When I run this command in the couchapp directory, it also fails:

----
$ cd schedule
$ couchapp push --export .
[ERROR] couchapp error: You aren't in a couchapp.
----

Nils.

Benoit Chesneau

unread,
Dec 10, 2009, 5:08:39 AM12/10/09
to couc...@googlegroups.com
Do you have .couchapprc inside ?

Nils Breunese

unread,
Dec 10, 2009, 5:33:12 AM12/10/09
to couc...@googlegroups.com
Benoit Chesneau wrote:

>>>> The export returns an error:
>>>>
>>>> ----
>>>> $ couchapp push --export schedule
>>>> [ERROR] couchapp error: You aren't in a couchapp.
>>>> ----
>>>>
>>> yes export works only in couchapp . That was a bug (fixed in latest head) .
>> When I run this command in the couchapp directory, it also fails:
>>
>> ----
>> $ cd schedule
>> $ couchapp push --export .
>> [ERROR] couchapp error: You aren't in a couchapp.
>> ----
>>
>> Nils.
>
> Do you have .couchapprc inside ?

No.

Nils.

Benoit Chesneau

unread,
Dec 10, 2009, 6:19:33 AM12/10/09
to couc...@googlegroups.com
Ah sorry, I didn't updated the main tree, only my github repo. Done
now. TEsted here it works. I think I'm on my day "couldn't reproduce"
;) Let me know for the _id i will add proper tests in the afternoon

- benoit

Benoit Chesneau

unread,
Dec 10, 2009, 10:40:52 AM12/10/09
to couc...@googlegroups.com
On Wed, Dec 9, 2009 at 4:13 PM, Nils Breunese <N.Bre...@vpro.nl> wrote:

>> how looks your _id file ? It should be docid on one line.
>
> Looks fine to me:
>
> ----
> $ cat schedule/_id
> _design/schedule
>

I just reproduced your error. It happend when there is a a null zero
or a "\n" at the end. vim add one for example. Make sure to have _id
on one line. I will fix it later today.

- benoit

Chris Anderson

unread,
Dec 10, 2009, 2:32:00 PM12/10/09
to couc...@googlegroups.com
On Wed, Dec 9, 2009 at 6:11 AM, Benoit Chesneau <bche...@gmail.com> wrote:
> On Wed, Dec 9, 2009 at 2:12 PM, Nils Breunese <n.bre...@vpro.nl> wrote:
>> Hello,
>>
>> I just upgraded to CouchApp 0.5.1, from version 0.4. I added a view to
>> my app and then wanted to push the new version to our test server
>> (CouchDB 0.10.0). The result was that I couldn't find the design
>> document in CouchDB anymore, it looked like the current design
>> document was removed and the new version was not pushed. However,
>> CouchApp did not show any error messages.

I don't like this feature change.

We should assume we are pushing design documents unless the user
specifies otherwise. I think the ID should be specifiable on the
command line as well, so that one directory on the filesystem can be
pushed with different IDs easily.

I don't like the idea that users have to do extra work (create an _id
file) to get the basics done. I think we can support pushing normal
(non-design) documents without adding an extra step for the basic use
case.

Chris
> --
>
> You received this message because you are subscribed to the Google Groups "CouchApp" group.
> To post to this group, send email to couc...@googlegroups.com.
> To unsubscribe from this group, send email to couchapp+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/couchapp?hl=en.
>
>
>



--
Chris Anderson
http://jchrisa.net
http://couch.io

Benoit Chesneau

unread,
Dec 10, 2009, 3:06:54 PM12/10/09
to couc...@googlegroups.com
On Thu, Dec 10, 2009 at 8:32 PM, Chris Anderson <jch...@apache.org> wrote:
> On Wed, Dec 9, 2009 at 6:11 AM, Benoit Chesneau <bche...@gmail.com> wrote:
>> On Wed, Dec 9, 2009 at 2:12 PM, Nils Breunese <n.bre...@vpro.nl> wrote:
>>> Hello,
>>>
>>> I just upgraded to CouchApp 0.5.1, from version 0.4. I added a view to
>>> my app and then wanted to push the new version to our test server
>>> (CouchDB 0.10.0). The result was that I couldn't find the design
>>> document in CouchDB anymore, it looked like the current design
>>> document was removed and the new version was not pushed. However,
>>> CouchApp did not show any error messages.
>
> I don't like this feature change.
>
> We should assume we are pushing design documents unless the user
> specifies otherwise. I think the ID should be specifiable on the
> command line as well, so that one directory on the filesystem can be
> pushed with different IDs easily.
>
> I don't like the idea that users have to do extra work (create an _id
> file) to get the basics done. I think we can support pushing normal
> (non-design) documents without adding an extra step for the basic use
> case.
>
> Chris
>
>

Extra step don't exist if you use generate or init. or clone your old
doc. But I'm agree with the fact that "_id" could be annoying. On the
other hand some people find annoying too to create .couchapprc and the
couchapp init needed for that though they don't find it annoying for
git or hg.

We can step back but then how to manage case where you want to push a
set of docs. That is what I'm trying to solve here ie how to
differentiate doc from ddoc. Also the command line option is good for
simple push but not for multiple doc push.

What we could do is to make the default _design/.... and then only
consider it could be a doc if it has the _id file. Would it solve this
"issue"? The optional parameter could be added easily. If it's ok i
could make the change tonight and release 0.5.2.

- benoit

Chris Anderson

unread,
Dec 10, 2009, 3:12:32 PM12/10/09
to couc...@googlegroups.com
yes that completely solves it. by default we should use the old
behavior, but I agree we should respect the _id file if it exists. I
think we should not create the _id file on generate or clone, as well,
but I'm not as strongly opinionated about that.

Thanks,
Chris

>
> - benoit

Benoit Chesneau

unread,
Dec 10, 2009, 3:47:29 PM12/10/09
to couc...@googlegroups.com
On Thu, Dec 10, 2009 at 9:12 PM, Chris Anderson <jch...@apache.org> wrote:

>
> yes that completely solves it. by default we should use the old
> behavior, but I agree we should respect the _id file if it exists. I
> think we should not create the _id file on generate or clone, as well,
> but I'm not as strongly opinionated about that.
>
Change have done in latest head.

- benoît

Nils Breunese

unread,
Dec 15, 2009, 11:24:55 AM12/15/09
to couc...@googlegroups.com
Ok, I have upgraded to couchapp 0.5.2. 'couchapp push --export .' now
seems to work. I can also push the app to CouchDB again.

I also noticed I had two design documents called schedule according to
Futon. Upon further inspection I seemed to have both "_design/schedule"
and "_design/schedule\u000a". After deleting both design docs and
pushing again everything seemed to be fine again.

Nils Breunese.

Benoit Chesneau

unread,
Dec 15, 2009, 11:37:31 AM12/15/09
to couc...@googlegroups.com
On Tue, Dec 15, 2009 at 5:24 PM, Nils Breunese <N.Bre...@vpro.nl> wrote:

> Ok, I have upgraded to couchapp 0.5.2. 'couchapp push --export .' now
> seems to work. I can also push the app to CouchDB again.
>
> I also noticed I had two design documents called schedule according to
> Futon. Upon further inspection I seemed to have both "_design/schedule"
> and "_design/schedule\u000a". After deleting both design docs and
> pushing again everything seemed to be fine again.
>
> Nils Breunese.
>
That's good to know :) Sorry for the problem caused by 0.5.1 update.
Month coming is about adding tests and doc so hopefully these problems
won't appear anymore.

- benoit
Reply all
Reply to author
Forward
0 new messages