(self, copy)
return app
Replaces couch doc with a copy of the backup ("copy").
        Returns a new Application referring to this updated couch doc.
        The returned doc should be used in place of
        the original doc, i.e. should be called as follows:
            app = app.make_reversion_to_copy(copy)
            app.save()
Replaces couch doc with a copy of the backup ("copy").
        Returns a new Application referring to this updated couch doc.
        The returned doc should be used in place of
        the original doc, i.e. should be called as follows:
            app = app.make_reversion_to_copy(copy)
            app.save()
Replaces couch doc with a copy of the backup ( copy ) . Returns a new Application referring to this updated couch doc . The returned doc should be used in place of the original doc i . e . should be called as follows : app = app . make_reversion_to_copy ( copy ) app . save ()
def make_reversion_to_copy(self, copy):
        """
        Replaces couch doc with a copy of the backup ("copy").
        Returns a new Application referring to this updated couch doc.
        The returned doc should be used in place of
        the original doc, i.e. should be called as follows:
            app = app.make_reversion_to_copy(copy)
            app.save()
        """
        if copy.copy_of != self._id:
            raise VersioningError("%s is not a copy of %s" % (copy, self))
        app = deepcopy(copy.to_json())
        app['_rev'] = self._rev
        app['_id'] = self._id
        app['version'] = self.version
        app['copy_of'] = None
        app.pop('_attachments', None)
        app.pop('external_blobs', None)
        cls = self.__class__
        app = cls.wrap(app)
        app.copy_attachments(copy)

        for form in app.get_forms():
            # reset the form's validation cache, since the form content is
            # likely to have changed in the revert!
            form.clear_validation_cache()
            form.version = None

        app.build_broken = False

        return app
def make_reversion_to_copy ( self , copy ) : if copy . copy_of != self . _id : raise VersioningError ( "%s is not a copy of %s" % ( copy , self ) ) app = deepcopy ( copy . to_json ( ) ) app [ '_rev' ] = self . _rev app [ '_id' ] = self . _id app [ 'version' ] = self . version app [ 'copy_of' ] = None app . pop ( '_attachments' , None ) app . pop ( 'external_blobs' , None ) cls = self . __class__ app = cls . wrap ( app ) app . copy_attachments ( copy ) for form in app . get_forms ( ) : # reset the form's validation cache, since the form content is # likely to have changed in the revert! form . clear_validation_cache ( ) form . version = None app . build_broken = False return app