Changeset 5676 for main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py
- Timestamp:
- 25 Jan 2011, 13:21:00 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py
r5670 r5676 21 21 ## 22 22 """ 23 The root for applica tions.23 The root for applicants. 24 24 """ 25 25 import grok 26 26 from waeup.sirp.interfaces import IWAeUPSIRPPluggable 27 from waeup.sirp.applica tions.interfaces import IApplicationsRoot27 from waeup.sirp.applicants.interfaces import IApplicantsRoot 28 28 29 class ApplicationsRoot(grok.Container): 30 """The root of student applications-related components. 29 class ApplicantsRoot(grok.Container): 30 """The root of applicants-related components. It contains primarily 31 containers for applicants. 31 32 """ 32 grok.implements(IApplica tionsRoot)33 grok.implements(IApplicantsRoot) 33 34 34 def addApplica tionContainer(self, container, name=None):35 """Add an applica tioncontainer.35 def addApplicantsContainer(self, container, name=None): 36 """Add an applicants container. 36 37 37 Adds an applica tioncontainer that implements `interface`38 Adds an applicants container that implements `interface` 38 39 under the name `name`. 39 40 40 41 `container` 41 42 the container instance to be added. Should 42 implement :class:`IApplica tionContainer`.43 implement :class:`IApplicantsContainer`. 43 44 44 45 `name` 45 46 the name under which the container will be accessible. We 46 47 usually use names like ``pume_2011`` to indicate, that the 47 new container will contain student applica tions for a48 new container will contain student applicants for a 48 49 certain screening type (``pume``) and of the year 2011. 49 50 … … 52 53 return 53 54 54 class Applica tionsPlugin(grok.GlobalUtility):55 """A WAeUPSIRPPlugin that creates an applica tions root in portal.55 class ApplicantsPlugin(grok.GlobalUtility): 56 """A WAeUPSIRPPlugin that creates an applicants root in portal. 56 57 57 58 This plugin should be called by a typical … … 62 63 Implements :class:`waeup.sirp.interfaces.IWAeUPSIRPPluggable` 63 64 """ 64 grok.name('applica tions')65 grok.name('applicants') 65 66 grok.implements(IWAeUPSIRPPluggable) 66 log_prefix = 'Applica tionsPlugin'67 log_prefix = 'ApplicantsPlugin' 67 68 68 69 def setup(self, site, name, logger): 69 """Create a new :class:`Applica tionsRoot` instance in `site`.70 """Create a new :class:`ApplicantsRoot` instance in `site`. 70 71 """ 71 site['applica tions'] = ApplicationsRoot()72 site['applicants'] = ApplicantsRoot() 72 73 logger.info( 73 '%s: Installed applica tions root.' % (self.log_prefix,)74 '%s: Installed applicants root.' % (self.log_prefix,) 74 75 ) 75 76 return 76 77 77 78 def update(self, site, name, logger): 78 """Update site wide ``applica tions`` root.79 """Update site wide ``applicants`` root. 79 80 80 If the site already contains a suitable ``applica tions`` root,81 If the site already contains a suitable ``applicants`` root, 81 82 leave it that way. If not create one and delete the old one if 82 83 appropriate. 83 84 """ 84 app_folder = site.get('applica tions', None)85 app_folder = site.get('applicants', None) 85 86 site_name = getattr(site, '__name__', 'Unnamed Site?') 86 if IApplica tionsRoot.providedBy(app_folder):87 # Applica tions up to date. Return.87 if IApplicantsRoot.providedBy(app_folder): 88 # Applicants up to date. Return. 88 89 logger.info( 89 90 '%s: Updating site at %s: Nothing to do.' % ( … … 92 93 return 93 94 elif app_folder is not None: 94 # Applica tions need update. Remove old instance.95 # Applicants need update. Remove old instance. 95 96 logger.warn( 96 '%s: Outdated applica tions folder detected at site %s.'97 '%s: Outdated applicants folder detected at site %s.' 97 98 'Removing it.' % (self.log_prefix, site_name) 98 99 ) 99 del site['applica tions']100 # Add new applica tions.100 del site['applicants'] 101 # Add new applicants. 101 102 logger.info( 102 103 '%s: Updating site at %s. Installing ' 103 'applica tions.' % (self.log_prefix, site_name,)104 'applicants.' % (self.log_prefix, site_name,) 104 105 ) 105 106 self.setup(site, name, logger)
Note: See TracChangeset for help on using the changeset viewer.