Exemplo n.º 1
0
 def create(self):
     self.newSessionId = self._create_new_id()
     self.model.insert(
         id=self.newSessionId
         ,created_time=helpers.get_datetime()
         ,accessed_time=helpers.get_datetime()
         ,expire_time=helpers.get_datetime(self.get_max_age())
         ,remote_addr=self.clientModel.ip
     )
Exemplo n.º 2
0
 def __init__(self
     ,servermodelDependence=servermodel.Collection(dbpath=config.Config().databasePath)
     ,configDependence=config.Config()
     ,helpersDependence=helpers
     ,clientModelDependence=clientModel.Model()
 ):
     self.servermodel = servermodelDependence
     self.config = configDependence
     self.helpers = helpersDependence
     self.clientModel = clientModelDependence
     self.model = self._get_sessions_model()
     # remove expired sessions
     self.model.remove(
         where="expire_time < ?",
         params=helpers.get_datetime()
     )
     self.clientID = self._get_client_id()
import os
import sys
import unittest


# change directroy for import my libraries
os.chdir('../..')
currentDirectory = os.getcwd()
sys.path.append(currentDirectory)
sys.path.append(currentDirectory + '/framework')
from framework import helpers

print(helpers.get_datetime())
print(helpers.get_datetime(3600))