|
a/ForgeChat/forgechat/model/chat.py |
|
b/ForgeChat/forgechat/model/chat.py |
1 |
from datetime import datetime
|
1 |
from datetime import datetime
|
2 |
|
2 |
|
3 |
from pylons import g
|
3 |
from ming import schema as S
|
|
|
4 |
from ming.orm import FieldProperty, Mapper
|
|
|
5 |
from ming.orm.declarative import MappedClass
|
4 |
|
6 |
|
5 |
from ming import schema as S
|
|
|
6 |
from ming.orm import MappedClass, FieldProperty
|
|
|
7 |
from allura import model as M
|
7 |
from allura import model as M
|
8 |
|
8 |
|
9 |
class ChatChannel(MappedClass):
|
9 |
class ChatChannel(MappedClass):
|
10 |
|
10 |
|
11 |
class __mongometa__:
|
11 |
class __mongometa__:
|
|
... |
|
... |
15 |
|
15 |
|
16 |
_id = FieldProperty(S.ObjectId)
|
16 |
_id = FieldProperty(S.ObjectId)
|
17 |
project_id = FieldProperty(S.ObjectId)
|
17 |
project_id = FieldProperty(S.ObjectId)
|
18 |
app_config_id = FieldProperty(S.ObjectId)
|
18 |
app_config_id = FieldProperty(S.ObjectId)
|
19 |
channel = FieldProperty(str)
|
19 |
channel = FieldProperty(str)
|
20 |
|
20 |
|
21 |
class ChatMessage(M.Artifact):
|
21 |
class ChatMessage(M.Artifact):
|
22 |
class __mongometa__:
|
22 |
class __mongometa__:
|
23 |
name='chat_message'
|
23 |
name='chat_message'
|
24 |
indexes = [ 'timestamp' ]
|
24 |
indexes = [ 'timestamp' ]
|
25 |
type_s='Chat Message'
|
25 |
type_s='Chat Message'
|
|
... |
|
... |
59 |
|
59 |
|
60 |
@property
|
60 |
@property
|
61 |
def timestamp_hour(self):
|
61 |
def timestamp_hour(self):
|
62 |
return self.timestamp.strftime('%H:%M:%S')
|
62 |
return self.timestamp.strftime('%H:%M:%S')
|
63 |
|
63 |
|
64 |
MappedClass.compile_all()
|
64 |
Mapper.compile_all()
|