You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/06/08 11:24:47 UTC

[incubator-ponymail-foal] branch master updated: refactor and init host and remote by default

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d7726b  refactor and init host and remote by default
1d7726b is described below

commit 1d7726bb6ff8e81c4d8985207dbf5835cafa29f3
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Jun 8 13:24:19 2021 +0200

    refactor and init host and remote by default
---
 server/plugins/session.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/server/plugins/session.py b/server/plugins/session.py
index ad5562d..e0e967d 100644
--- a/server/plugins/session.py
+++ b/server/plugins/session.py
@@ -73,20 +73,19 @@ class SessionObject:
     def __init__(self, server: plugins.server.BaseServer, **kwargs):
         self.database = None
         self.server = server
-        if not kwargs:
-            now = int(time.time())
-            self.created = now
-            self.last_accessed = now
-            self.credentials = None
-            self.cookie = str(uuid.uuid4())
-            self.cid = None
-            self.host = "??"
-            self.remote = "??"
-        else:
+        self.created = int(time.time())
+        self.host = "??"
+        self.remote = "??"
+        if kwargs:
             self.last_accessed = kwargs.get("last_accessed", 0)
             self.credentials = SessionCredentials(kwargs.get("credentials"))
             self.cookie = kwargs.get("cookie", "___")
             self.cid = kwargs.get("cid")
+        else:
+            self.last_accessed = self.created
+            self.credentials = None
+            self.cookie = str(uuid.uuid4())
+            self.cid = None
 
 
 async def get_session(