Commit 471dd19c authored by Jim Fulton's avatar Jim Fulton

Brians changes.

parent 1fddf7a3
...@@ -12,15 +12,13 @@ __doc__='''A drop-in object that represents a session. ...@@ -12,15 +12,13 @@ __doc__='''A drop-in object that represents a session.
$Id: Session.py,v 1.10 1997/12/31 17:17:04 brian Exp $''' $Id: Session.py,v 1.11 1997/12/31 19:34:57 jim Exp $'''
import time, OFS.SimpleItem, AccessControl.Role import time, OFS.SimpleItem, AccessControl.Role
import Persistence, Acquisition, Globals import Persistence, Acquisition, Globals
from string import rfind from string import rfind
_addForm=Globals.HTMLFile('sessionAdd', globals()) addForm=Globals.HTMLFile('sessionAdd', globals())
def addForm(realself, self, REQUEST, **ignored):
return _addForm(self, REQUEST)
def add(self, id, title, REQUEST=None): def add(self, id, title, REQUEST=None):
'Add a session' 'Add a session'
...@@ -32,14 +30,14 @@ def add(self, id, title, REQUEST=None): ...@@ -32,14 +30,14 @@ def add(self, id, title, REQUEST=None):
class Session(Persistence.Persistent, class Session(Persistence.Persistent,
AccessControl.Role.RoleManager, AccessControl.Role.RoleManager,
OFS.SimpleItem.Item, SimpleItem.Item,
Acquisition.Implicit): Acquisition.Implicit):
'''Model sessions as drop-in objects '''Model sessions as drop-in objects
''' '''
meta_type='Session' meta_type='Session'
icon='session' icon='misc_/OFSP/session'
manage_options=({'icon':'', 'label':'Join/Leave', manage_options=({'icon':'', 'label':'Join/Leave',
'action':'manage_main', 'target':'manage_main', 'action':'manage_main', 'target':'manage_main',
...@@ -74,8 +72,8 @@ class Session(Persistence.Persistent, ...@@ -74,8 +72,8 @@ class Session(Persistence.Persistent,
if l >= 0: cookie=cookie[:l] if l >= 0: cookie=cookie[:l]
self.cookie="%s/%s" % (cookie, id) self.cookie="%s/%s" % (cookie, id)
manage=manage_main=Globals.HTMLFile('sessionEdit', globals()) manage=manage_main=Globals.HTMLFile('session', globals())
index_html=Globals.HTMLFile('session', globals()) manage_properties=Globals.HTMLFile('sessionEdit', globals())
def title_and_id(self): def title_and_id(self):
r=Session.inheritedAttribute('title_and_id')(self) r=Session.inheritedAttribute('title_and_id')(self)
...@@ -84,18 +82,17 @@ class Session(Persistence.Persistent, ...@@ -84,18 +82,17 @@ class Session(Persistence.Persistent,
def manage_edit(self, title, REQUEST=None): def manage_edit(self, title, REQUEST=None):
'Modify a session' 'Modify a session'
self.title=title self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST) if REQUEST is not None: return self.manage_editedDialog(REQUEST)
def enter(self, REQUEST, RESPONSE): def enter(self, REQUEST, RESPONSE):
'Begin working in a session' 'Begin working in a session'
RESPONSE.setCookie( RESPONSE.setCookie(
Globals.SessionNameName, self.cookie, Globals.SessionNameName, self.cookie,
expires="Mon, 27-Dec-99 23:59:59 GMT", #expires="Mon, 27-Dec-99 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'], path=REQUEST['SCRIPT_NAME'],
) )
REQUEST[Globals.SessionNameName]=self.cookie return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
return self.index_html(self, REQUEST)
def leave(self, REQUEST, RESPONSE): def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session' 'Temporarily stop working in a session'
...@@ -104,28 +101,26 @@ class Session(Persistence.Persistent, ...@@ -104,28 +101,26 @@ class Session(Persistence.Persistent,
expires="Mon, 27-Aug-84 23:59:59 GMT", expires="Mon, 27-Aug-84 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'], path=REQUEST['SCRIPT_NAME'],
) )
REQUEST[Globals.SessionNameName]='' return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
return self.index_html(self, REQUEST)
def leave_another(self, REQUEST, RESPONSE): def leave_another(self, REQUEST, RESPONSE):
'Leave a session that may not be the current session' 'Leave a session that may not be the current session'
self.leave(REQUEST, RESPONSE) return self.leave(REQUEST, RESPONSE)
RESPONSE.setStatus(302)
RESPONSE['Location']=REQUEST['URL2']+'/manage_main'
def save(self, remark, REQUEST): def save(self, remark, REQUEST=None):
'Make session changes permanent' 'Make session changes permanent'
Globals.SessionBase[self.cookie].commit(remark) Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.index_html(self, REQUEST) if REQUEST is not None: return self.manage_main(self, REQUEST)
def discard(self, REQUEST): def discard(self, REQUEST=None):
'Discard changes made during the session' 'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort() Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.index_html(self, REQUEST) if REQUEST is not None: return self.manage_main(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty() def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.10 $'[11:-2] __version__='$Revision: 1.11 $'[11:-2]
...@@ -133,6 +128,9 @@ __version__='$Revision: 1.10 $'[11:-2] ...@@ -133,6 +128,9 @@ __version__='$Revision: 1.10 $'[11:-2]
############################################################################## ##############################################################################
# #
# $Log: Session.py,v $ # $Log: Session.py,v $
# Revision 1.11 1997/12/31 19:34:57 jim
# Brians changes.
#
# Revision 1.10 1997/12/31 17:17:04 brian # Revision 1.10 1997/12/31 17:17:04 brian
# Security update # Security update
# #
......
...@@ -12,15 +12,13 @@ __doc__='''A drop-in object that represents a session. ...@@ -12,15 +12,13 @@ __doc__='''A drop-in object that represents a session.
$Id: Version.py,v 1.10 1997/12/31 17:17:04 brian Exp $''' $Id: Version.py,v 1.11 1997/12/31 19:34:57 jim Exp $'''
import time, OFS.SimpleItem, AccessControl.Role import time, OFS.SimpleItem, AccessControl.Role
import Persistence, Acquisition, Globals import Persistence, Acquisition, Globals
from string import rfind from string import rfind
_addForm=Globals.HTMLFile('sessionAdd', globals()) addForm=Globals.HTMLFile('sessionAdd', globals())
def addForm(realself, self, REQUEST, **ignored):
return _addForm(self, REQUEST)
def add(self, id, title, REQUEST=None): def add(self, id, title, REQUEST=None):
'Add a session' 'Add a session'
...@@ -32,14 +30,14 @@ def add(self, id, title, REQUEST=None): ...@@ -32,14 +30,14 @@ def add(self, id, title, REQUEST=None):
class Session(Persistence.Persistent, class Session(Persistence.Persistent,
AccessControl.Role.RoleManager, AccessControl.Role.RoleManager,
OFS.SimpleItem.Item, SimpleItem.Item,
Acquisition.Implicit): Acquisition.Implicit):
'''Model sessions as drop-in objects '''Model sessions as drop-in objects
''' '''
meta_type='Session' meta_type='Session'
icon='session' icon='misc_/OFSP/session'
manage_options=({'icon':'', 'label':'Join/Leave', manage_options=({'icon':'', 'label':'Join/Leave',
'action':'manage_main', 'target':'manage_main', 'action':'manage_main', 'target':'manage_main',
...@@ -74,8 +72,8 @@ class Session(Persistence.Persistent, ...@@ -74,8 +72,8 @@ class Session(Persistence.Persistent,
if l >= 0: cookie=cookie[:l] if l >= 0: cookie=cookie[:l]
self.cookie="%s/%s" % (cookie, id) self.cookie="%s/%s" % (cookie, id)
manage=manage_main=Globals.HTMLFile('sessionEdit', globals()) manage=manage_main=Globals.HTMLFile('session', globals())
index_html=Globals.HTMLFile('session', globals()) manage_properties=Globals.HTMLFile('sessionEdit', globals())
def title_and_id(self): def title_and_id(self):
r=Session.inheritedAttribute('title_and_id')(self) r=Session.inheritedAttribute('title_and_id')(self)
...@@ -84,18 +82,17 @@ class Session(Persistence.Persistent, ...@@ -84,18 +82,17 @@ class Session(Persistence.Persistent,
def manage_edit(self, title, REQUEST=None): def manage_edit(self, title, REQUEST=None):
'Modify a session' 'Modify a session'
self.title=title self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST) if REQUEST is not None: return self.manage_editedDialog(REQUEST)
def enter(self, REQUEST, RESPONSE): def enter(self, REQUEST, RESPONSE):
'Begin working in a session' 'Begin working in a session'
RESPONSE.setCookie( RESPONSE.setCookie(
Globals.SessionNameName, self.cookie, Globals.SessionNameName, self.cookie,
expires="Mon, 27-Dec-99 23:59:59 GMT", #expires="Mon, 27-Dec-99 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'], path=REQUEST['SCRIPT_NAME'],
) )
REQUEST[Globals.SessionNameName]=self.cookie return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
return self.index_html(self, REQUEST)
def leave(self, REQUEST, RESPONSE): def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session' 'Temporarily stop working in a session'
...@@ -104,28 +101,26 @@ class Session(Persistence.Persistent, ...@@ -104,28 +101,26 @@ class Session(Persistence.Persistent,
expires="Mon, 27-Aug-84 23:59:59 GMT", expires="Mon, 27-Aug-84 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'], path=REQUEST['SCRIPT_NAME'],
) )
REQUEST[Globals.SessionNameName]='' return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
return self.index_html(self, REQUEST)
def leave_another(self, REQUEST, RESPONSE): def leave_another(self, REQUEST, RESPONSE):
'Leave a session that may not be the current session' 'Leave a session that may not be the current session'
self.leave(REQUEST, RESPONSE) return self.leave(REQUEST, RESPONSE)
RESPONSE.setStatus(302)
RESPONSE['Location']=REQUEST['URL2']+'/manage_main'
def save(self, remark, REQUEST): def save(self, remark, REQUEST=None):
'Make session changes permanent' 'Make session changes permanent'
Globals.SessionBase[self.cookie].commit(remark) Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.index_html(self, REQUEST) if REQUEST is not None: return self.manage_main(self, REQUEST)
def discard(self, REQUEST): def discard(self, REQUEST=None):
'Discard changes made during the session' 'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort() Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.index_html(self, REQUEST) if REQUEST is not None: return self.manage_main(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty() def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.10 $'[11:-2] __version__='$Revision: 1.11 $'[11:-2]
...@@ -133,6 +128,9 @@ __version__='$Revision: 1.10 $'[11:-2] ...@@ -133,6 +128,9 @@ __version__='$Revision: 1.10 $'[11:-2]
############################################################################## ##############################################################################
# #
# $Log: Version.py,v $ # $Log: Version.py,v $
# Revision 1.11 1997/12/31 19:34:57 jim
# Brians changes.
#
# Revision 1.10 1997/12/31 17:17:04 brian # Revision 1.10 1997/12/31 17:17:04 brian
# Security update # Security update
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment