damned-lies r1359 - in trunk: . vertimus
- From: stephaner svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1359 - in trunk: . vertimus
- Date: Sun, 18 Jan 2009 17:04:19 +0000 (UTC)
Author: stephaner
Date: Sun Jan 18 17:04:19 2009
New Revision: 1359
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1359&view=rev
Log:
2009-01-18 StÃphane Raimbault <stephane raimbault gmail com>
* vertimus/models.py: Order by ID instead of created, it avoids a
possible problem with the dumb MySQL database (where datetime
precision is limited to second) when two actions are done in the
same second.
Modified:
trunk/ChangeLog
trunk/vertimus/models.py
Modified: trunk/vertimus/models.py
==============================================================================
--- trunk/vertimus/models.py (original)
+++ trunk/vertimus/models.py Sun Jan 18 17:04:19 2009
@@ -267,11 +267,11 @@
if os.path.splitext(base)[1] == ".tar":
ext = ".tar" + ext
filename = "%s-%s-%s-%s-%s%s" % (instance.state_db.branch.module.name,
- instance.state_db.branch.name,
- instance.state_db.domain.name,
- instance.state_db.language.locale,
- instance.state_db.id,
- ext)
+ instance.state_db.branch.name,
+ instance.state_db.domain.name,
+ instance.state_db.language.locale,
+ instance.state_db.id,
+ ext)
return "%s/%s" % (settings.UPLOAD_DIR, filename)
class ActionDb(models.Model):
@@ -286,7 +286,7 @@
class Meta:
db_table = 'action'
- ordering = ('-created',)
+ ordering = ('-id',)
def get_action(self):
action = eval('Action' + self.name)()
@@ -296,9 +296,9 @@
def get_previous_action_with_po(self):
""" Returns the previous action with an uploaded file related to the same state """
try:
- act = ActionDb.objects.filter(file__endswith=".po", state_db=self.state_db,
- created__lt=self.created).latest('created')
- return act.get_action()
+ action_db = ActionDb.objects.filter(file__endswith=".po", state_db=self.state_db,
+ id__lt=self.id).latest('id')
+ return action_db.get_action()
except ActionDb.DoesNotExist:
return None
@@ -306,7 +306,7 @@
def get_action_history(cls, state_db):
if state_db:
return [va_db.get_action() for va_db in ActionDb.objects.filter(
- state_db__id=state_db.id).order_by('created')]
+ state_db__id=state_db.id).order_by('id')]
else:
return []
@@ -633,7 +633,7 @@
try:
# Exclude himself
action_db = ActionDb.objects.filter(state_db__id=state._state_db.id).exclude(
- name__in=['WC', 'UNDO']).order_by('-created')[1]
+ name__in=['WC', 'UNDO']).order_by('-id')[1]
action = action_db.get_action()
return action._new_state()
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]