lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

db["index.html"] isn't happy #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the couchdb web interface to create a database
2. Create a document in the database called "index.html"
3. try to access it w/ the library

What is the expected output? What do you see instead?
I was trying to store the contents of an HTML file in a document entry
called index.html
May not be a legal couchdb action

What version of the product are you using? On what operating system?
couchdb - Apache CouchDB 0.8.0-incubating

Please provide any additional information below.

Original issue reported on code.google.com by wjh...@gmail.com on 14 Oct 2008 at 12:52

GoogleCodeExporter commented 8 years ago
This works for me. Please reopen if you can provide more specifics, in 
particular about what exactly isn't 
working, and what the error looks like (traceback etc).

Original comment by cmlenz on 5 Nov 2008 at 4:33

GoogleCodeExporter commented 8 years ago
Maybe I'm just using an old level;

[wjhuie@alex ~]$ python
Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:51) 
[GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import couchdb
>>> s = couchdb.server("http://192.168.1.99/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'server'
>>> s = couchdb.Server("http://192.168.1.99")
>>> db = s['file_upload']
>>> f = db['index.html']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/CouchDB-0.4-py2.5.egg/couchdb/client.py",
line 253, in __getitem__
  File "/usr/lib/python2.5/site-packages/CouchDB-0.4-py2.5.egg/couchdb/client.py",
line 646, in get
  File "/usr/lib/python2.5/site-packages/CouchDB-0.4-py2.5.egg/couchdb/client.py",
line 688, in _request
couchdb.client.ResourceNotFound: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 
2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /file_upload/index.html was not found on this server.</p>
<hr>
<address>Apache/2.2.9 (Fedora) Server at 192.168.1.99 Port 80</address>
</body></html>

>>> dir(couchdb)
['Database', 'Document', 'PreconditionFailed', 'ResourceConflict',
'ResourceNotFound', 'Row', 'Server', 'ServerError', 'ViewResults', 
'__builtins__',
'__doc__', '__file__', '__loader__', '__name__', '__path__', '__version__', 
'client']
>>> couchdb.__version__
'0.4'
>>> 

Original comment by wjh...@gmail.com on 5 Nov 2008 at 6:20

GoogleCodeExporter commented 8 years ago
Does that help?

Original comment by wjh...@gmail.com on 5 Nov 2008 at 6:20

GoogleCodeExporter commented 8 years ago
I made a mistake on the sample output (I left off the port)...
Tried this again and it works! Sorry for the mistake!

>>> s = couchdb.Server("http://192.168.1.99:5984")
>>> for i in s['sample']: print i
... 
main
>>> db = s['file_upload']
>>> for i in db: print i
... 
index.html
test
>>> f = db['index.html']
>>> print f
<Document u'index.html'@u'2690183077' {u'data': u'something'}>

Original comment by wjh...@gmail.com on 5 Nov 2008 at 6:29