Skip to content

Commit

Permalink
rref #5367
Browse files Browse the repository at this point in the history
rref #5366

ref #66
ref #65
  • Loading branch information
evrenesat committed Jul 22, 2016
1 parent d9a27cd commit 9b95fbf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions zengine/messaging/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ def is_online(self, status=None):
else:
mq_channel = self._connect_mq()
for sbs in self.subscriptions.objects.filter():
mq_channel.basic_publish(exchange=sbs.channel.key,
routing_key='',
body=json.dumps({
if sbs.channel.typ == 10:
mq_channel.basic_publish(exchange=sbs.channel.code_name,
routing_key='',
body=json.dumps({
'cmd': 'user_status',
'channel_key': sbs.channel.key,
'channel_name': sbs.name,
Expand All @@ -79,7 +80,6 @@ def is_online(self, status=None):
}))
ConnectionStatus(self.key).set(status)


def encrypt_password(self):
""" encrypt password if not already encrypted """
if self.password and not self.password.startswith('$pbkdf2'):
Expand Down
2 changes: 1 addition & 1 deletion zengine/messaging/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def serialize(self, user=None):
'content': self.body,
'type': self.typ,
'updated_at': self.updated_at,
'timestamp': self.timestamp.strftime(DATE_TIME_FORMAT),
'timestamp': self.updated_at,
'is_update': hasattr(self, 'unsaved'),
'attachments': [attachment.serialize() for attachment in self.attachment_set],
'title': self.msg_title,
Expand Down
11 changes: 6 additions & 5 deletions zengine/messaging/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def report_last_seen_message(current):
{
'view':'_zops_last_seen_msg',
'channel_key': key,
'msg_key': key,
'key': key,
'timestamp': datetime,
}
Expand Down Expand Up @@ -671,14 +671,15 @@ def delete_message(current):
# response:
{
'key': key,
'status': 'OK',
'code': 200
}
"""
try:
Message(current).objects.get(sender_id=current.user_id,
key=current.input['message_key']).delete()
current.output = {'status': 'Deleted', 'code': 200}
key=current.input['key']).delete()
current.output = {'status': 'Deleted', 'code': 200, 'key': current.input['key']}
except ObjectDoesNotExist:
raise HTTPError(404, "")

Expand Down Expand Up @@ -772,7 +773,7 @@ def get_message_actions(current):
# request:
{
'view':'_zops_get_message_actions',
'message_key': key,
'key': key,
}
# response:
{
Expand All @@ -785,7 +786,7 @@ def get_message_actions(current):
current.output = {'status': 'OK',
'code': 200,
'actions': Message.objects.get(
current.input['message_key']).get_actions_for(current.user)}
current.input['key']).get_actions_for(current.user)}


def add_to_favorites(current):
Expand Down
2 changes: 1 addition & 1 deletion zengine/tornado_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def post(self, view_name):
(r'/(\w+)', HttpHandler),
]

app = web.Application(URL_CONFS, debug=DEBUG)
app = web.Application(URL_CONFS, debug=DEBUG, autoreload=False)


def runserver(host=None, port=None):
Expand Down

0 comments on commit 9b95fbf

Please sign in to comment.