Database _security object

23 views
Skip to first unread message

Steve Ross

unread,
Sep 12, 2011, 5:08:02 PM9/12/11
to CouchDB-Python
Is there a way to load the database/_security and issue a 'put' back
to it?

Thanks

Kxepal

unread,
Sep 13, 2011, 2:51:55 AM9/13/11
to couchdb...@googlegroups.com
Hi Steve.

Currently, there is no builtin support of this resource. All you can do for now is use next solution:

import couchdb
server = couchdb.Server()
db = server['temp']
# get
status, headers, security = db.resource.get_json('_security')
# put
info = {'admins': {'names': ['root'], 'roles': ['editors']}, 'readers': {'names': [], 'roles': []}}
db.resource.put_json('_security', body=info)

--
,,,^..^,,,

Steve Ross

unread,
Sep 13, 2011, 8:37:17 AM9/13/11
to couchdb...@googlegroups.com
Thanks I ended up using httplib2 which makes things very easy but, maybe I'll switch back to using the couch lib

--
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/-/ltAt3UtFq1wJ.

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.



--
Steve Ross
web application & interface developer
http://blog.stevensross.com
[mobile] (912) 344-8113
[ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ]

Steve Ross

unread,
Sep 15, 2011, 6:15:16 PM9/15/11
to CouchDB-Python
Ok so how do i get data out of the return from get_json... when i try
to access it in dictionary syntax it blows up and the type says
"tuple"
> web application & interface developerhttp://blog.stevensross.com

Steve Ross

unread,
Sep 15, 2011, 6:50:07 PM9/15/11
to CouchDB-Python
Nevermind... looked through the source and found the answer

status, headers, data = ...get_json()

I wasn't specifying all the return objects.

Steve Ross

unread,
Sep 16, 2011, 8:38:10 AM9/16/11
to CouchDB-Python
Is there a way we can get this added to the online docs? would have saved me a bunch of time

Kxepal

unread,
Sep 16, 2011, 9:16:28 AM9/16/11
to couchdb...@googlegroups.com
I suppose better to implement native support of `_security` resource for client.Database class with documentation of how to use it. Hacking it via resource is an option, but it's on low API level and not so obliviously for the first sight(:  Could you open issue ticket at http://code.google.com/p/couchdb-python/issues/list to help us track state of this feature? I'll try to make patch on this weekends, but if you have your own - you're welcome(:


On Friday, September 16, 2011 4:38:10 PM UTC+4, Steve Ross wrote:
Is there a way we can get this added to the online docs? would have saved me a bunch of time

On Thu, Sep 15, 2011 at 6:50 PM, Steve Ross <nowh...@gmail.com> wrote:
Nevermind... looked through the source and found the answer

status, headers, data = ...get_json()

I wasn't specifying all the return objects.
On Thu, Sep 15, 2011 at 6:15 PM, Steve Ross <nowh...@gmail.com> wrote:
Ok so how do i get data out of the return from get_json... when i try
to access it in dictionary syntax it blows up and the type says
"tuple"

Steve Ross

unread,
Sep 16, 2011, 9:23:51 AM9/16/11
to couchdb...@googlegroups.com
Hah, no I don't... on that level it would also be nice to have some utility methods for copying views and anything else in a design doc.

I'm no python developer, mainly using it as a backend for administrator creation of new databases (via a registration page) sending email etc.

yeah I'll put in a feature request.

Also, does 0.8 work with 1.1x and https?

Thanks,

Steve

To view this discussion on the web visit https://groups.google.com/d/msg/couchdb-python/-/rCT6uXN6jp8J.

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.

Kxepal

unread,
Sep 16, 2011, 9:44:57 AM9/16/11
to couchdb...@googlegroups.com
On Friday, September 16, 2011 5:23:51 PM UTC+4, Steve Ross wrote:
Hah, no I don't... on that level it would also be nice to have some utility methods for copying views and anything else in a design doc.


 Design docs is just same documents as others. You are free to operate with views within ddocs as with simple document fields.

I'm no python developer, mainly using it as a backend for administrator creation of new databases (via a registration page) sending email etc.

yeah I'll put in a feature request.

Also, does 0.8 work with 1.1x and https?

 
 Yes, 0.8 works well with 1.1 and https, but it does not has native support of show/list/update functions and others while 0.9-dev does.

Thanks,

Steve

On Fri, Sep 16, 2011 at 9:16 AM, Kxepal <kxe...@gmail.com> wrote:
I suppose better to implement native support of `_security` resource for client.Database class with documentation of how to use it. Hacking it via resource is an option, but it's on low API level and not so obliviously for the first sight(:  Could you open issue ticket at http://code.google.com/p/couchdb-python/issues/list to help us track state of this feature? I'll try to make patch on this weekends, but if you have your own - you're welcome(:


On Friday, September 16, 2011 4:38:10 PM UTC+4, Steve Ross wrote:
Is there a way we can get this added to the online docs? would have saved me a bunch of time

> > To post to this group, send email to couch...@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.
>
> --
> Steve Ross
> web application & interface developerhttp://blog.stevensross.com
> [mobile] (912) 344-8113
> [ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ]

--
You received this message because you are subscribed to the Google Groups "CouchDB-Python" group.
To post to this group, send email to couch...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages