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

Source Code for Module turbogears.i18n.sogettext.model

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