Пример #1
0
 def unsetup( me):
     s = me.mgr.server
     if 1:
         put_json_always( s.resource, me.scfg, body= me._org_userdbname)
         me.cur_userdbname = me._org_userdbname
     try:
         del s[ me.USERDBNAME ]
     except ResourceNotFound:
         pass
Пример #2
0
    def setup( me):
        me.setup_mgr()
        s = me.mgr.server
        USERDBNAME = me.USERDBNAME
        if me.cur_userdbname == USERDBNAME: return

        print ' dbusers=', USERDBNAME

        me.scfg = '_config/couch_httpd_auth/authentication_db'.split('/')
        if USERDBNAME in s: me.unsetup()
        try:
            me.mgr.open( USERDBNAME, new=True) #emplate= me._org_userdbname)
            #s.create( USERDBNAME )
            #me.org_userdbname = s.resource.put_json( me.scfg, body= json( USERDBNAME ))[2]
            me.org_userdbname = put_json_always( s.resource, me.scfg, body= USERDBNAME )[2]
            me.cur_userdbname = USERDBNAME

            cu.Users.DBNAME = USERDBNAME
            me.setup_extra()
        except:
            me.unsetup()
            raise