[px] Made PX thread-safe.
This commit is contained in:
		
							parent
							
								
									086f93e845
								
							
						
					
					
						commit
						1d931cfb96
					
				
					 10 changed files with 2086 additions and 2037 deletions
				
			
		| 
						 | 
				
			
			@ -37,6 +37,11 @@ class ToolMixin(BaseMixin):
 | 
			
		|||
        if res in ('User', 'Group', 'Translation'): res = appName + res
 | 
			
		||||
        return res
 | 
			
		||||
 | 
			
		||||
    def home(self):
 | 
			
		||||
        '''Returns the content of px ToolWrapper.pxHome.'''
 | 
			
		||||
        tool = self.appy()
 | 
			
		||||
        return tool.pxHome({'self': tool}).encode('utf-8')
 | 
			
		||||
 | 
			
		||||
    def getHomePage(self):
 | 
			
		||||
        '''Return the home page when a user hits the app.'''
 | 
			
		||||
        # If the app defines a method "getHomePage", call it.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@ from appy.gen.mail import sendMail
 | 
			
		|||
from appy.shared.utils import executeCommand
 | 
			
		||||
from appy.gen.wrappers import AbstractWrapper
 | 
			
		||||
from appy.gen.installer import loggedUsers
 | 
			
		||||
from appy.px import Px
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------
 | 
			
		||||
_PY = 'Please specify a file corresponding to a Python interpreter ' \
 | 
			
		||||
| 
						 | 
				
			
			@ -19,6 +20,10 @@ NOT_UNO_ENABLED_PYTHON = '"%s" is not a UNO-enabled Python interpreter. ' \
 | 
			
		|||
 | 
			
		||||
# ------------------------------------------------------------------------------
 | 
			
		||||
class ToolWrapper(AbstractWrapper):
 | 
			
		||||
 | 
			
		||||
    pxHome = Px('''<p>Hello home</p>''',
 | 
			
		||||
                template=AbstractWrapper.pxTemplate, hook='content')
 | 
			
		||||
 | 
			
		||||
    def validPythonWithUno(self, value):
 | 
			
		||||
        '''This method represents the validator for field unoEnabledPython.'''
 | 
			
		||||
        if value:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ import appy.pod
 | 
			
		|||
from appy.gen import Type, Search, Ref, String, WorkflowAnonymous
 | 
			
		||||
from appy.gen.indexer import defaultIndexes
 | 
			
		||||
from appy.gen.utils import createObject
 | 
			
		||||
from appy.px import Px
 | 
			
		||||
from appy.shared.utils import getOsTempFolder, executeCommand, \
 | 
			
		||||
                              normalizeString, sequenceTypes
 | 
			
		||||
from appy.shared.xml_parser import XmlMarshaller
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +27,15 @@ class AbstractWrapper(object):
 | 
			
		|||
    '''Any real Appy-managed Zope object has a companion object that is an
 | 
			
		||||
       instance of this class.'''
 | 
			
		||||
 | 
			
		||||
    pxTemplate = Px('''
 | 
			
		||||
    <html>
 | 
			
		||||
     <head><title>:self.title</title></head>
 | 
			
		||||
     <body>
 | 
			
		||||
      <x>:content</x>
 | 
			
		||||
     </body>
 | 
			
		||||
    </html>
 | 
			
		||||
    ''', prologue=Px.xhtmlPrologue)
 | 
			
		||||
 | 
			
		||||
    # --------------------------------------------------------------------------
 | 
			
		||||
    # Class methods
 | 
			
		||||
    # --------------------------------------------------------------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue