diff --git a/Products/zms/IZMSCatalogConnector.py b/Products/zms/IZMSCatalogConnector.py index ab8de807d..429263928 100644 --- a/Products/zms/IZMSCatalogConnector.py +++ b/Products/zms/IZMSCatalogConnector.py @@ -33,12 +33,12 @@ def search_json(self, REQUEST=None, RESPONSE=None): def reindex_page(self, uid, page_size, clients=False, fileparsing=True, REQUEST=None, RESPONSE=None): """ Reindex page. - @param uid the uid of the page's start-node - @param page-size the page-size - @param clients process clients - @type clients C{Boolean} - @param fileparsing parse files - @type fileparsing C{Boolean} + @param uid: the uid of the page's start-node + @param page_size: the page-size + @param clients: process clients + @type clients: C{Boolean} + @param fileparsing: parse files + @type fileparsing: C{Boolean} @param REQUEST: the triggering request @type REQUEST: ZPublisher.HTTPRequest @return log diff --git a/Products/zms/_confmanager.py b/Products/zms/_confmanager.py index 1fba24add..986b57b90 100644 --- a/Products/zms/_confmanager.py +++ b/Products/zms/_confmanager.py @@ -100,12 +100,29 @@ def forName(cls, name): # _confmanager.initConf: # ------------------------------------------------------------------------------ def initConf(self, pattern): + """ + Initialize a ZMS configuration by importing a set of configuration files + that match a given name pattern, e.g. 'unibern.*'. + The pattern should be in the format C{prefix:pattern}, where actually + only C{pattern} is the part of the filename to match using function fnmatch(). + If a matching file is found and it ends with '.zip', it will be imported + as a configuration package. Otherwise, it will be imported as a a single XML + file or - if prefixed with C{conf:} as a set of configuration files from + the ZMS conf-folder. + The full list of available configuration files is aggrgated by the method + L{ConfManager.getConfFiles}. + + @param pattern: String-pattern to filter filenames. + @type pattern: C{string} + @return: None + @rtype: C{None} + """ standard.writeBlock( self, '[initConf]: pattern='+pattern) prefix = pattern.split(':')[0] pattern = pattern.split(':')[1] files = self.getConfFiles() for filename in files: - if filename.startswith(prefix) and 'theme.default' not in filename: + if filename.startswith(prefix): # and 'theme.default' not in filename: label = files[filename] if fnmatch(label,'*%s-*'%pattern): standard.writeBlock( self, '[initConf]: filename='+filename) @@ -193,6 +210,23 @@ def getConfXmlFile(self, file): # ConfManager.importConf: # -------------------------------------------------------------------------- def importConf(self, file, syncIfNecessary=True): + """ + Imports configuration from the given file and processes + it in the context according to its filename. + + @param file: The path to the configuration file to be imported. + @type file: C{str} + @param syncIfNecessary: Flag indicating whether to synchronize object attributes if necessary. Defaults to True. + @type syncIfNecessary: C{bool}, optional + @return: A message indicating the result of the import operation. + @rtype: C{str} + + Notes: + - The method identifies the type of configuration file based on its filename and processes it accordingly. + - Hidden files created by MacOSX (starting with '._') are ignored. + - If the filename contains specific substrings (e.g., '.charfmt.', '.filter.', etc.), the corresponding import method is called. + - If synchronization is necessary and the syncIfNecessary flag is True, the object's attributes are synchronized. + """ message = '' syncNecessary = False filename, xmlfile = self.getConfXmlFile( file) @@ -241,7 +275,13 @@ def getPluginIds(self, path=[]): security.declareProtected('ZMS Administrator', 'getConfFiles') def getConfFiles(self, pattern=None, REQUEST=None, RESPONSE=None): """ - ConfManager.getConfFiles + Retrieve configuration files from the ZMS source code: + 1. Product/zms/conf: Sets of singular configuration files (repository-manager style, pattern-prefix 'conf:'). + 2. Product/zms/import: Classical zipped XML packages, e.g. for importing as single file via web-frontend. + + @param pattern: string, optional, pattern to filter filenames. + @param REQUEST: C(object), optional. + @param RESPONSE: C(object), optional, if provided, the method will return a JSON response. """ filenames = {} # Import-Folder. diff --git a/Products/zms/standard.py b/Products/zms/standard.py index 69afaeeb5..6e8e0c15b 100644 --- a/Products/zms/standard.py +++ b/Products/zms/standard.py @@ -178,6 +178,8 @@ def addZMSCustom(self, meta_id=None, values={}, REQUEST=None): Public alias for manage_addZMSCustom: add a custom node of the type designated by meta_id in current context. + @param self: context node + @type self: C{zmsobject.ZMSObject} @param meta_id: the meta-id / type of the new ZMSObject @type meta_id: C{str} @param values: the dictionary of initial attribut-values assigned to the new ZMSObject @@ -308,7 +310,13 @@ def set_response_headers_cache(context, request=None, cache_max_age=24*3600, cac """ Set default and dynamic cache response headers according to ZMS_CACHE_EXPIRE_DATETIME which is determined in ObjAttrs.isActive for each page element as the earliest time for invalidation. - I:Usage: Add to standard_html master template, e.g.:: + + - U{https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives} + - U{http://nginx.org/en/docs/http/ngx_http_headers_module.html#expires} + - U{https://github.com/nginxinc/nginx-wiki/blob/master/source/start/topics/examples/x-accel.rst} + + Usage: Add to standard_html master template, e.g.:: + @@ -316,11 +324,8 @@ def set_response_headers_cache(context, request=None, cache_max_age=24*3600, cac @param cache_max_age: seconds the element remains in all caches (public/proxy and private/browser) @param cache_s_maxage: seconds the element remains in public/proxy cache (value -1 means cache_s_maxage = cache_max_age) - @see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives - @see: http://nginx.org/en/docs/http/ngx_http_headers_module.html#expires - @see: https://github.com/nginxinc/nginx-wiki/blob/master/source/start/topics/examples/x-accel.rst - @returns: Tuple of expires date time in GMT as ISO8601 string and the seconds until expiration - @retype: C{tuple} + @return: Tuple of expires date time in GMT as ISO8601 string and the seconds until expiration + @rtype: C{tuple} """ if request is not None: is_preview = request.get('preview', '') == 'preview' @@ -359,8 +364,8 @@ def once(key, request): once per request @param key: the key @param request: the request - @returns: Boolean execute once - @retype: C{boolean} + @return: Boolean execute once + @rtype: C{boolean} """ req_key = 'f_%s'%key req_val = request.get(req_key,True) @@ -2249,7 +2254,7 @@ def htmldiff(original, changed): """ Wrapper for htmldiff2.render_html_diff. @param original: html-file-0 - @type context: C{str} + @type original: C{str} @param changed: html-file-1 @type changed: C{str} """ diff --git a/Products/zms/zms.py b/Products/zms/zms.py index 3b4761dab..dd95c3cb8 100644 --- a/Products/zms/zms.py +++ b/Products/zms/zms.py @@ -240,10 +240,10 @@ def manage_addZMS(self, lang, manage_lang, REQUEST, RESPONSE): ##### Configuration #### + # Initialize catalog adapter / connector. if REQUEST.get('zcatalog_init', 0)==1: - #-- Search GUI - initContent(obj, 'com.zms.search.content.xml', REQUEST) - # Initialize catalog adapter / connector. + #-- Search GUI: now is part of com.zms.catalog + # initContent(obj, 'com.zms.search.content.xml', REQUEST) _confmanager.initConf(obj, 'conf:com.zms.catalog.zcatalog') catalog_adapter = obj.getCatalogAdapter(createIfNotExists=True) catalog_connector = catalog_adapter.add_connector('zcatalog_connector') @@ -603,7 +603,8 @@ def __before_publishing_traverse__(self, object, request): key ZMS.mode.maintenance=1. The maintenance mode prevents editing content and returns an error: 503 Service Unavailable. To show a specific message the Zope object standard_error_message - should be customized, e.g. like this: + should be customized, e.g. like this:: +