# Copyright (C) 2012 Mag. Christian Tanzer. All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. [email protected] # **************************************************************************** # This package is part of the package GTW. # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.RST.__init__ # # Purpose # Framework for RESTful web services # # Revision Dates # 6-Jun-2012 (CT) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW RST = Package_Namespace () GTW._Export ("RST") del Package_Namespace ### __END__ GTW.RST.__init__
>>> session3.get ("name"), session.name (None, 'user1') >>> session3.get ("lang"), session.lang (None, None) """ def exists (self, sid) : return sid in _Store_ # end def exists def remove (self) : try : del _Store_ [self.sid] except KeyError : pass # end def remove def save (self) : _Store_ [self.sid] = self._data # end def save def _load (self) : return _Store_.get (self.sid, {}).copy () # end def _load # end class Memory_Session if __name__ != "__main__" : GTW._Export ("*") ### __END__ GTW.Memory_Session
# Copyright (C) 2007-2010 Martin Glück. All rights reserved # Langstrasse 4, A--2244 Spannberg, Austria. [email protected] # **************************************************************************** # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.Werkzeug.__init__ # # Purpose # Some wrappers/extensions to the werkzeug WSGI utilities # (werkzeug.pocoo.org) # # Revision Dates # 20-Mar-2010 (MG) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW Werkzeug = Package_Namespace() GTW._Export("Werkzeug") del Package_Namespace ### __END__ GTW.Werkzeug.__init__
try : with Locked_File (self.file_name, "rb") as f : cargo = f.read () except Exception as exc : print \ ( ">>> Exception" , exc , "when trying to load session data from" , self.file_name , file = sys.stderr ) else : try : result = cPickle.loads (cargo) except Exception as exc : print \ ( ">>> Exception" , exc , "when trying to unpickle session data from" , self.file_name , file = sys.stderr ) return result # end def _load # end class File_Session if __name__ != "__main__" : GTW._Export ("*") ### __END__ GTW.File_Session
# -*- coding: utf-8 -*- # Copyright (C) 2009 Mag. Christian Tanzer All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. [email protected] # **************************************************************************** # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.OMP.__init__ # # Purpose # Package defining Object Model Parts # # Revision Dates # 30-Dec-2009 (CT) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW OMP = Package_Namespace () GTW._Export ("OMP") del Package_Namespace ### __END__ GTW.OMP.__init__
# Copyright (C) 2014 Mag. Christian Tanzer. All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. [email protected] # **************************************************************************** # This package is part of the package GTW. # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.MF3.__init__ # # Purpose # Package providing support for MOM forms, 3rd edition # # Revision Dates # 24-Apr-2014 (CT) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW MF3 = Package_Namespace () GTW._Export ("MF3") del Package_Namespace ### __END__ GTW.MF3.__init__
# Copyright (C) 2012 Mag. Christian Tanzer. All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. [email protected] # **************************************************************************** # This package is part of the package GTW. # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.RST.__init__ # # Purpose # Framework for RESTful web services # # Revision Dates # 6-Jun-2012 (CT) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW RST = Package_Namespace() GTW._Export("RST") del Package_Namespace ### __END__ GTW.RST.__init__
# Copyright (C) 2007-2010 Martin Glück. All rights reserved # Langstrasse 4, A--2244 Spannberg, Austria. [email protected] # **************************************************************************** # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.Werkzeug.__init__ # # Purpose # Some wrappers/extensions to the werkzeug WSGI utilities # (werkzeug.pocoo.org) # # Revision Dates # 20-Mar-2010 (MG) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW Werkzeug = Package_Namespace () GTW._Export ("Werkzeug") del Package_Namespace ### __END__ GTW.Werkzeug.__init__
# Copyright (C) 2014 Mag. Christian Tanzer. All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. [email protected] # **************************************************************************** # This package is part of the package GTW. # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # **************************************************************************** # #++ # Name # GTW.MF3.__init__ # # Purpose # Package providing support for MOM forms, 3rd edition # # Revision Dates # 24-Apr-2014 (CT) Creation # ««revision-date»»··· #-- from _TFL.Package_Namespace import Package_Namespace from _GTW import GTW MF3 = Package_Namespace() GTW._Export("MF3") del Package_Namespace ### __END__ GTW.MF3.__init__
return getattr(self.__super, name) return self.get(name) # end def __getattr__ def __getitem__(self, key): return self._data[key] # end def __getitem__ def __setattr__(self, name, value): if name in self._non_data_attrs: return self.__super.__setattr__(name, value) else: self._data[name] = value return value # end def __setattr__ def __setitem__(self, key, value): self._data[key] = value # end def __setitem__ # end class Session if __name__ != "__main__": GTW._Export("Session") ### __END__ GTW.Session
def __getattr__ (self, name) : if name.startswith ("__") and name.endswith ("__") : ### Placate inspect.unwrap of Python 3.5, ### which accesses `__wrapped__` and eventually throws `ValueError` return getattr (self.__super, name) return self.get (name) # end def __getattr__ def __getitem__ (self, key) : return self._data [key] # end def __getitem__ def __setattr__ (self, name, value) : if name in self._non_data_attrs : return self.__super.__setattr__ (name, value) else : self._data [name] = value return value # end def __setattr__ def __setitem__ (self, key, value) : self._data [key] = value # end def __setitem__ # end class Session if __name__ != "__main__" : GTW._Export ("Session") ### __END__ GTW.Session