Commits

Marcin Lulek committed 14c3d11

updates

  • Participants
  • Parent commits 885116a

Comments (0)

Files changed (2)

File gevent_cometd/channel.py

         self.history_size = 10
         self.history = []
 
-        # connections is global store of relationships between user and 
+        # connections is global store of relationships between user and
         # connection correlated with channels in form of:
-        # {user_id:list_of_connection_ids} 
+        # {user_id:list_of_connection_ids}
 
-    def add_message(self, message, pm_users=[], exclude_user=None):
+    def add_message(self, message, pm_users=None, exclude_user=None):
+        if not pm_users:
+            pm_users = []
         stats['total_unique_messages'] += 1
         self.last_active = datetime.datetime.utcnow()
         if self.store_history:
             self.history.append(message)
             self.history = self.history[(self.history_size) * -1:]
         message.update({'channel': self.name})
-        #message everyone subscribed except excluded
+        # message everyone subscribed except excluded
         for u, conns in self.connections.iteritems():
             if u != exclude_user:
                 for conn_id in conns:

File gevent_cometd/util.py

         return json.JSONEncoder.default(self, obj)
 
 
-def cometd_request(endpoint, payload, throw_exceptions=False, servers=[]):
+def cometd_request(endpoint, payload, throw_exceptions=False, servers=None):
     responses = []
+    if not servers:
+        servers = []
     for server in servers:
         response = {}
         url = '%s%s?%s' % (server['server'], endpoint,