[damned-lies] [vertimus] Fix various errors



commit 19a9158a3872b00c3033b98aba1b35690ad34d13
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat May 21 17:59:10 2011 +0200

    [vertimus] Fix various errors

 vertimus/feeds.py  |   16 ++++++++--------
 vertimus/models.py |   22 +++++++++++-----------
 vertimus/views.py  |    2 +-
 3 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/vertimus/feeds.py b/vertimus/feeds.py
index cce91b0..fd40bd9 100644
--- a/vertimus/feeds.py
+++ b/vertimus/feeds.py
@@ -59,10 +59,10 @@ class LatestActionsByLanguage(Feed):
 
     def item_link(self, item):
         link = urlresolvers.reverse('vertimus_by_names',
-                                    args=(item.state.branch.module.name,
-                                          item.state.branch.name,
-                                          item.state.domain.name,
-                                          item.state.language.locale))
+                                    args=(item.state_db.branch.module.name,
+                                          item.state_db.branch.name,
+                                          item.state_db.domain.name,
+                                          item.state_db.language.locale))
         return "%s#%d" % (link, item.id)
 
     def item_pubdate(self, item):
@@ -103,10 +103,10 @@ class LatestActionsByTeam(Feed):
 
     def item_link(self, item):
         link = urlresolvers.reverse('vertimus_by_names',
-                                    args=(item.state.branch.module.name,
-                                          item.state.branch.name,
-                                          item.state.domain.name,
-                                          item.state.language.locale))
+                                    args=(item.state_db.branch.module.name,
+                                          item.state_db.branch.name,
+                                          item.state_db.domain.name,
+                                          item.state_db.language.locale))
         return "%s#%d" % (link, item.id)
 
     def item_pubdate(self, item):
diff --git a/vertimus/models.py b/vertimus/models.py
index 13dd9db..d35d179 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -345,6 +345,17 @@ class ActionAbstract(models.Model):
         except:
             return False
 
+    def merged_file(self):
+        """If available, returns the merged file as a dict: {'url':'path':'filename'}"""
+        mfile_url = mfile_path = mfile_name = None
+        if self.file:
+            mfile_url = self.file.url[:-3] + ".merged.po"
+            mfile_path = self.file.path[:-3] + ".merged.po"
+            mfile_name = os.path.basename(mfile_path)
+            if not os.access(mfile_path, os.R_OK):
+                mfile_url = mfile_path = mfile_name = None
+        return {'url': mfile_url, 'path': mfile_path, 'filename': mfile_name}
+
     @classmethod
     def get_action_history(cls, state=None, sequence=None):
         """
@@ -410,17 +421,6 @@ class Action(ActionAbstract):
                 arch_action = self.new_by_name('AA', person=self.person)
                 arch_action.apply_on(self.state_db)
 
-    def merged_file(self):
-        """If available, returns the merged file as a dict: {'url':'path':'filename'}"""
-        mfile_url = mfile_path = mfile_name = None
-        if self.file:
-            mfile_url = self.file.url[:-3] + ".merged.po"
-            mfile_path = self.file.path[:-3] + ".merged.po"
-            mfile_name = os.path.basename(mfile_path)
-            if not os.access(mfile_path, os.R_OK):
-                mfile_url = mfile_path = mfile_name = None
-        return {'url': mfile_url, 'path': mfile_path, 'filename': mfile_name}
-
     def get_previous_action_with_po(self):
         """
         Return the previous Action with an uploaded file related to the
diff --git a/vertimus/views.py b/vertimus/views.py
index f06e704..eb86eda 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -147,7 +147,7 @@ def vertimus_diff(request, action_id_1, action_id_2, level):
     else:
         ActionReal = Action
     action_1 = get_object_or_404(ActionReal, pk=action_id_1)
-    state = action_1.state
+    state = action_1.state_db
 
     file_path_1 = action_1.merged_file()['path'] or action_1.file.path
     reduced = is_po_reduced(file_path_1)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]