Package turbogears :: Package i18n :: Package sogettext :: Module model

Source Code for Module turbogears.i18n.sogettext.model

 1  try: 
 2   
 3      from datetime import datetime 
 4   
 5      from sqlobject import (SQLObject, ForeignKey, MultipleJoin, 
 6          DateTimeCol, StringCol, UnicodeCol) 
 7   
 8      from turbogears.database import PackageHub 
 9   
10  except ImportError: 
11   
12      pass 
13   
14  else: 
15   
16      hub = PackageHub('turbogears.i18n.sogettext') 
17      __connection__ = hub 
18   
19   
20 - class TG_Domain(SQLObject):
21
22 - class sqlmeta:
23 table = 'tg_i18n_domain' 24 defaultOrder = 'name'
25 26 name = StringCol(alternateID=True) 27 messages = MultipleJoin('TG_Message')
28 29
30 - class TG_Message(SQLObject):
31
32 - class sqlmeta:
33 table = 'tg_i18n_message' 34 defaultOrder = 'name'
35 36 name = UnicodeCol() 37 text = UnicodeCol(default='') 38 domain = ForeignKey('TG_Domain') 39 locale = StringCol(length=15) 40 created = DateTimeCol(default=datetime.now) 41 updated = DateTimeCol(default=None) 42
43 - def _set_text(self, text):
44 45 self._SO_set_text(text) 46 self.updated = datetime.now()
47