Permalink
Browse files

Fixes

  • Loading branch information...
1 parent 2b4ed58 commit af9c355eb8c20831120e8714e18046b870a740b7 @akaspin committed Jan 16, 2012
Showing with 8 additions and 9 deletions.
  1. +1 −1 ChangeLog
  2. +1 −1 couchdb-conduit.cabal
  3. +1 −1 src/Database/CouchDB/Conduit/DB.hs
  4. +5 −6 src/Database/CouchDB/Conduit/Design.hs
View
2 ChangeLog
@@ -1,4 +1,4 @@
- 16.01.2011, Version 0.2.1 * Secure DB. 16.01.2011, Version 0.2.0.1 * Avoid escaping path in couch' 16.01.2011, Version 0.2.0 * Low-lewel API * "Don't care" versions of couchPut. * Brain-free couchRev'. * All database methods ignores DB in connection. * couchPutDB' renamed to couchPutDB_. * Database replication. 14.01.2011, Version 0.1.3.0 * Safe version of couchViewPut 14.01.2011, Version 0.1.2.0 * Authentification 11.01.2011, Version 0.1.1.0
+ 16.01.2011, Version 0.2.1.1 * Fixes for couchViewPut and couchSecureDB. 16.01.2011, Version 0.2.1 * Secure DB. 16.01.2011, Version 0.2.0.1 * Avoid escaping path in couch' 16.01.2011, Version 0.2.0 * Low-lewel API * "Don't care" versions of couchPut. * Brain-free couchRev'. * All database methods ignores DB in connection. * couchPutDB' renamed to couchPutDB_. * Database replication. 14.01.2011, Version 0.1.3.0 * Safe version of couchViewPut 14.01.2011, Version 0.1.2.0 * Authentification 11.01.2011, Version 0.1.1.0
* API Changes. `couchViewPut` moved to Database.CouchDB.Design and lost
language argument.
* Tests. 10.01.2011, Version 0.1.0.1
View
2 couchdb-conduit.cabal
@@ -1,5 +1,5 @@
name: couchdb-conduit
-version: 0.2.1
+version: 0.2.1.1
cabal-version: >= 1.8
build-type: Simple
stability: Experimental
View
2 src/Database/CouchDB/Conduit/DB.hs
@@ -94,7 +94,7 @@ couchSecureDB :: MonadCouch m =>
-> [B.ByteString] -- ^ Readers names
-> ResourceT m ()
couchSecureDB p adminRoles adminNames readersRoles readersNames =
- couch HT.methodPut (`B.append` B.append "/" p) [] []
+ couch HT.methodPut (const $ p `B.append` "/_security") [] []
reqBody protect'
>> return ()
where
View
11 src/Database/CouchDB/Conduit/Design.hs
@@ -21,7 +21,8 @@ import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import Database.CouchDB.Conduit (MonadCouch, CouchError, Path, mkPath, Revision)
-import Database.CouchDB.Conduit.Internal.Doc (couchGetWith, couchPutWith)
+import Database.CouchDB.Conduit.Internal.Doc (couchGetWith,
+ couchPutWith_, couchPutWith')
-- | Put view in design document if it not exists. If design document does
-- not exist, it will be created.
@@ -56,11 +57,9 @@ couchViewPutInt :: MonadCouch m =>
-> ResourceT m Revision
couchViewPutInt prot designName viewName mapF reduceF = do
-- Get design or empty object
- (rev, A.Object d) <- getDesignDoc path
- let extractedView = extractViews d
- if extractedView /= M.empty && prot
- then return rev
- else couchPutWith A.encode path rev [] $ inferViews (purge_ d)
+ (_, A.Object d) <- getDesignDoc path
+ if prot then couchPutWith_ A.encode path [] $ inferViews (purge_ d)
+ else couchPutWith' A.encode path [] $ inferViews (purge_ d)
where
path = designDocPath designName
inferViews d = A.Object $ M.insert "views" (addView d) d

0 comments on commit af9c355

Please sign in to comment.