This patch provides unification of "old style" and normal actions.
For those that would need to keep the "old style" actions as they were
a configuration variable could be set in the Application.config

OldStyleActions = [1|0]

This defaults to false if not provided.

I have some pages that rely on this unification.  It does provide for
backward compatibility if the user so desires.

I'd like to see this in before the next fabled release of Webware for
Python.

Also as a side note, our Webware powered site is up and running.  The
bulk of the application is not visible to the world, but the
www.shipeze.com is just another context. :)
-- 
Karl Putland
Director of Technical Operations
ShipEze Inc
Index: Page.py
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/Page.py,v
retrieving revision 1.25
diff -c -r1.25 Page.py
*** Page.py	27 Sep 2002 01:57:51 -0000	1.25
--- Page.py	2 Oct 2002 04:14:53 -0000
***************
*** 47,69 ****
  		req = transaction.request()
  
  		# Check for actions
  		for action in self.actions():
! 			if req.hasField('_action_%s' % action) or (req.hasField('_action_%s.x' % action) and req.hasField('_action_%s.y' % action)):
  				if self._actionSet().has_key(action):
  					self.handleAction(action)
  					return
  
- 		# Support old style actions from 0.5.x and below.
- 		if req.hasField('_action_'):
- 			action = self.methodNameForAction(req.field('_action_'))
- 			actions = self._actionSet()
- 			if actions.has_key(action):
- 				self.preAction(action)
- 				apply(getattr(self, action), (transaction,))
- 				self.postAction(action)
- 				return
- 			else:
- 				raise PageError, "Action '%s' is not in the public list of actions, %s, for %s." % (action, actions.keys(), self)
  
  		self.writeHTML()
  
--- 47,77 ----
  		req = transaction.request()
  
  		# Check for actions
+ 		# Support old style actions from 0.5.x and below.
+ 		#
+ 		# Don't know as I like probing the applications configutatin 
+ 		# as it increases coupling, but seems like the best place to put it.
+ 		if self._transaction().application().setting('OldStyleActions',0):
+ 			if req.hasField('_action_'):
+ 				action = self.methodNameForAction(req.field('_action_'))
+ 				actions = self._actionSet()
+ 				if actions.has_key(action):
+ 					self.preAction(action)
+ 					apply(getattr(self, action), (transaction,))
+ 					self.postAction(action)
+ 					return
+ 				else:
+ 					raise PageError, "Action '%s' is not in the public list of actions, %s, for %s." % (action, actions.keys(), self)
+ 
  		for action in self.actions():
! 			if (req.hasField('_action_%s' % action) or 
! 				(req.hasField('_action_%s.x' % action) and req.hasField('_action_%s.y' % action) or 
! 				(req.hasField('_action_') and req.value('_action_') == action ))
! 				):
  				if self._actionSet().has_key(action):
  					self.handleAction(action)
  					return
  
  
  		self.writeHTML()
  

Reply via email to