Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
push by djc.ochtman - Retrieve information about view definition synchronization (fixes #183... on 2012-09-20 08:12 GMT
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
couchdb-pyt...@googlecode.com  
View profile  
 More options Sep 20 2012, 4:12 am
From: couchdb-pyt...@googlecode.com
Date: Thu, 20 Sep 2012 08:12:39 +0000
Local: Thurs, Sep 20 2012 4:12 am
Subject: [couchdb-python] push by djc.ochtman - Retrieve information about view definition synchronization (fixes #183... on 2012-09-20 08:12 GMT
Revision: be6cfa2f2f74
Branch:   default
Author:   Alexander Shorin <kxe...@gmail.com>
Date:     Thu Sep 20 01:12:21 2012
Log:      Retrieve information about view definition synchronization (fixes  
#183).
http://code.google.com/p/couchdb-python/source/detail?r=be6cfa2f2f74

Modified:
  /couchdb/design.py
  /couchdb/tests/design.py

=======================================
--- /couchdb/design.py  Tue Feb 22 16:06:06 2011
+++ /couchdb/design.py  Thu Sep 20 01:12:21 2012
@@ -38,8 +38,8 @@
      The view is not yet stored in the database, in fact, design doc doesn't
      even exist yet. That can be fixed using the `sync` method:

-    >>> view.sync(db)
-
+    >>> view.sync(db)                                       #doctest:  
+ELLIPSIS
+    [(True, '_design/tests', ...)]
      >>> design_doc = view.get_doc(db)
      >>> design_doc                                          #doctest:  
+ELLIPSIS
      <Document '_design/tests'@'...' {...}>
@@ -54,7 +54,8 @@
      >>> def my_map(doc):
      ...     yield doc['somekey'], doc['somevalue']
      >>> view = ViewDefinition('test2', 'somename', my_map,  
language='python')
-    >>> view.sync(db)
+    >>> view.sync(db)                                       #doctest:  
+ELLIPSIS
+    [(True, '_design/test2', ...)]
      >>> design_doc = view.get_doc(db)
      >>> design_doc                                          #doctest:  
+ELLIPSIS
      <Document '_design/test2'@'...' {...}>
@@ -139,7 +140,7 @@

          :param db: the `Database` instance
          """
-        type(self).sync_many(db, [self])
+        return type(self).sync_many(db, [self])

      @staticmethod
      def sync_many(db, views, remove_missing=False, callback=None):
@@ -197,7 +198,7 @@
                      callback(doc)
                  docs.append(doc)

-        db.update(docs)
+        return db.update(docs)

  def _strip_decorators(code):
=======================================
--- /couchdb/tests/design.py    Tue Feb 22 16:06:06 2011
+++ /couchdb/tests/design.py    Thu Sep 20 01:12:21 2012
@@ -26,6 +26,16 @@
          design_doc = db.get('_design/foo')
          self.assertTrue(design_doc['views']['foo']['options'] == options)

+    def test_retrieve_view_defn(self):
+       '''see issue 183'''
+        view_def = design.ViewDefinition('foo', 'bar', 'baz')
+        result = view_def.sync(self.db)
+        self.assertTrue(isinstance(result, list))
+        self.assertEqual(result[0][0], True)
+        self.assertEqual(result[0][1], '_design/foo')
+        doc = self.db[result[0][1]]
+        self.assertEqual(result[0][2], doc['_rev'])
+

  def suite():
      suite = unittest.TestSuite()


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »