~mpontillo/maas/discovery-js-factory

« back to all changes in this revision

Viewing changes to src/maasserver/websockets/handlers/timestampedmodel.py

  • Committer: Mike Pontillo
  • Date: 2016-09-02 20:25:22 UTC
  • Revision ID: mike.pontillo@canonical.com-20160902202522-3gid0v8jz1sn0hri
Add discovery websocket handler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
"""The nodes handler for the WebSocket connection."""
5
5
 
6
6
__all__ = [
7
 
    "dehydrate_datetime",
8
7
    "TimestampedModelHandler",
9
8
    ]
10
9
 
11
10
from maasserver.websockets.base import Handler
12
 
 
13
 
 
14
 
DATETIME_FORMAT = "%a, %d %b. %Y %H:%M:%S"
15
 
 
16
 
 
17
 
def dehydrate_datetime(datetime):
18
 
    """Convert the `datetime` to string with `DATETIME_FORMAT`."""
19
 
    return datetime.strftime(DATETIME_FORMAT)
 
11
from maasserver.websockets import dehydrate_datetime
20
12
 
21
13
 
22
14
class TimestampedModelHandler(Handler):