Revision aab4d540 snf-astakos-app/astakos/im/queue/userevent.py

b/snf-astakos-app/astakos/im/queue/userevent.py
35 35

  
36 36
from time import time
37 37
from hashlib import sha1
38
from random import random
39 38

  
40 39
class UserEvent(object):
41
    def __init__(self, client, user, eventType, details={}):
40
    def __init__(self, client, user, eventType, details=None):
42 41
        self.eventVersion = '1'
43 42
        self.occurredMillis = int(time() * 1000)
44 43
        self.receivedMillis = self.occurredMillis
......
47 46
        self.isActive = user.is_active
48 47
        self.role = 'default'
49 48
        self.eventType = eventType
50
        self.details = details
49
        self.details = details or {}
51 50
        hash = sha1()
52
        hash.update(json.dumps([client, self.userID, self.isActive, self.role,
53
                                self.eventType, self.details, self.occurredMillis]))
51
        hash.update(json.dumps([client,
52
                self.userID,
53
                self.isActive,
54
                self.role,
55
                self.eventType,
56
                self.details,
57
                self.occurredMillis
58
                ]
59
            )
60
        )
54 61
        self.id = hash.hexdigest()
55 62
    
56 63
    def format(self):

Also available in: Unified diff