Permalink
Browse files

fixes issue #264

Conflicts:

	publisher/models.py
  • Loading branch information...
1 parent 77a0b99 commit 6a928bd510dda3b4b4362b78b13ab8626d6a1985 @digi604 digi604 committed Dec 1, 2009
Showing with 6 additions and 30 deletions.
  1. +3 −4 cms/utils/helpers.py
  2. +3 −26 publisher/models.py
@@ -32,8 +32,7 @@ def reversion_register(model_class, fields=None, follow=(), format="xml", exclud
# auto exclude publisher fields
exclude_fields += ['publisher_is_draft', 'publisher_public', 'publisher_state']
- import reversion
- #if exclude_fields:
fields = filter(lambda name: not name in exclude_fields, fields)
-
- reversion.register(model_class, fields, follow, format)
+
+ from cms.utils import reversion_hacks
+ reversion_hacks.register_draft_only(model_class, fields, follow, format)
View
@@ -130,13 +130,9 @@ def publish(self, excluded_models=None, first_instance=True):
########################################################################
# perform saving
# publish copy - all behind this requires public instance to have pk
-
- self._publisher_pre_save_public(public_copy)
-
+
self._publisher_save_public(public_copy)
-
- self._publisher_post_save_public(public_copy)
-
+
# store public model relation for current instance (only) for newly
# created items
@@ -230,31 +226,12 @@ def publish(self, excluded_models=None, first_instance=True):
public_copy._publisher_delete_marked()
return public_copy
- def _publisher_pre_save_public(self, obj):
- """We dont wanna public object to be under reversions. If they are
- installed, just stop reversioning - bit of hacking to reversion.
- """
- if 'reversion' in settings.INSTALLED_APPS:
- import reversion
- self.old_reversion_state_depth = reversion.revision._state.depth
- # commented out because of bugs
- # see http://github.com/digi604/django-cms-2.0/issues/#issue/264
- #reversion.revision._state.depth = - 10000
-
-
def _publisher_save_public(self, obj):
"""Save method for object which should be published. obj is a instance
of the same class as self.
"""
return obj.save()
-
- def _publisher_post_save_public(self, obj):
- """Public objects were saved, start reversioning.
- """
- if 'reversion' in settings.INSTALLED_APPS:
- import reversion
- reversion.revision._state.depth = self.old_reversion_state_depth
-
+
def _collect_delete_marked_sub_objects(self, seen_objs, parent=None, nullable=False, excluded_models=None):
if excluded_models is None:
excluded_models = [self.__class__]

0 comments on commit 6a928bd

Please sign in to comment.