From: <al...@us...> - 2010-01-14 16:18:42
|
Revision: 13643 http://translate.svn.sourceforge.net/translate/?rev=13643&view=rev Author: alaaosh Date: 2010-01-14 16:18:27 +0000 (Thu, 14 Jan 2010) Log Message: ----------- brilliant I put this base.TranslationStore overrides in the wrong model class Modified Paths: -------------- src/trunk/Pootle/local_apps/pootle_store/models.py Modified: src/trunk/Pootle/local_apps/pootle_store/models.py =================================================================== --- src/trunk/Pootle/local_apps/pootle_store/models.py 2010-01-14 15:35:15 UTC (rev 13642) +++ src/trunk/Pootle/local_apps/pootle_store/models.py 2010-01-14 16:18:27 UTC (rev 13643) @@ -180,24 +180,6 @@ newunit.update(unit) return newunit - def findunit(self, source): - # find using hash instead of index - source_hash = md5_f(source.encode("utf-8")).hexdigest() - try: - return self.units.get(source_hash=source_hash) - except Unit.DoesNotExist: - return None - - def findid(self, id): - unitid_hash = md5_f(id.encode("utf-8")).hexdigest() - try: - return self.units.get(unitid_hash=unitid_hash) - except Unit.DoesNotExist: - return None - - def getids(self): - return self.units.values_list('unitid', flat=True) - def getorig(self): unit = self.store.file.store.units[self.index] if self.getid() == unit.getid(): @@ -208,7 +190,6 @@ unit = self.store.file.store.findid(self.getid()) return unit - def sync(self, unit): """sync in file unit with translations from db""" if unit.hasplural(): @@ -234,7 +215,6 @@ self.unitid = unit.getid() self.unitid_hash = md5_f(self.unitid.encode("utf-8")).hexdigest() - def update_from_form(self, newvalues): """update the unit with a new target, value, comments or fuzzy state""" if newvalues.has_key('target'): @@ -376,6 +356,24 @@ self.file.addunit(self.file.store.UnitClass.buildfromunit(unit)) + def findunit(self, source): + # find using hash instead of index + source_hash = md5_f(source.encode("utf-8")).hexdigest() + try: + return self.units.get(source_hash=source_hash) + except Unit.DoesNotExist: + return None + + def findid(self, id): + unitid_hash = md5_f(id.encode("utf-8")).hexdigest() + try: + return self.units.get(unitid_hash=unitid_hash) + except Unit.DoesNotExist: + return None + + def getids(self): + return self.units.values_list('unitid', flat=True) + ############################### Stats ############################ @getfromcache This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |