comparison roundup/configuration.py @ 5231:8743b7226dc7

Fix issue with retreiving raw template files using the @@file mechanism. This changes the static_files option in config.ini from supporting a single directory to support multiple directories. If one of the directory elements is '-' (i.e. a lone hyphen) the search is stopped and the TEMPLATES directory is not searched. Since the TEMPLATES directory is not searched the raw templates aren't accessed. See: https://sourceforge.net/p/roundup/mailman/message/35773357/ Message subject: showing template sources to all for details. Also check in CHANGES.txt that mentions a couple of other small improvements in the roundup-admin command.
author John Rouillard <rouilj@ieee.org>
date Tue, 11 Apr 2017 22:20:13 -0400
parents 4c48180555fb
children c5dd7b151ec2
comparison
equal deleted inserted replaced
5230:62a88d69ac52 5231:8743b7226dc7
377 _val = Option.get(self) 377 _val = Option.get(self)
378 if _val and not os.path.isabs(_val): 378 if _val and not os.path.isabs(_val):
379 _val = os.path.join(self.config["HOME"], _val) 379 _val = os.path.join(self.config["HOME"], _val)
380 return _val 380 return _val
381 381
382 class MultiFilePathOption(Option):
383
384 """List of space seperated File or directory path name
385
386 Paths may be either absolute or relative to the HOME. None
387 is returned if there are no elements.
388
389 """
390
391 class_description = "The space separated paths may be either absolute or\n" \
392 "relative to the directory containing this config file."
393
394 def get(self):
395 pathlist = []
396 _val = Option.get(self)
397 for elem in _val.split():
398 if elem and not os.path.isabs(elem):
399 pathlist.append(os.path.join(self.config["HOME"], elem))
400 else:
401 pathlist.append(elem)
402 if pathlist:
403 return pathlist
404 else:
405 return None
406
382 class FloatNumberOption(Option): 407 class FloatNumberOption(Option):
383 408
384 """Floating point numbers""" 409 """Floating point numbers"""
385 410
386 def str2value(self, value): 411 def str2value(self, value):
524 "Templating engine to use.\n" 549 "Templating engine to use.\n"
525 "Possible values are 'zopetal' for the old TAL engine\n" 550 "Possible values are 'zopetal' for the old TAL engine\n"
526 "ported from Zope, or 'chameleon' for Chameleon."), 551 "ported from Zope, or 'chameleon' for Chameleon."),
527 (FilePathOption, "templates", "html", 552 (FilePathOption, "templates", "html",
528 "Path to the HTML templates directory."), 553 "Path to the HTML templates directory."),
529 (NullableFilePathOption, "static_files", "", 554 (MultiFilePathOption, "static_files", "",
530 "Path to directory holding additional static files\n" 555 "A list of space separated directory paths (or a single\n"
531 "available via Web UI. This directory may contain\n" 556 "directory). These directories hold additional static\n"
532 "sitewide images, CSS stylesheets etc. and is searched\n" 557 "files available via Web UI. These directories may\n"
533 "for these files prior to the TEMPLATES directory\n" 558 "contain sitewide images, CSS stylesheets etc. If a '-'\n"
534 "specified above. If this option is not set, all static\n" 559 "is included, the list processing ends and the TEMPLATES\n"
535 "files are taken from the TEMPLATES directory"), 560 "directory is not searched after the specified\n"
561 "directories. If this option is not set, all static\n"
562 "files are taken from the TEMPLATES directory."),
536 (MailAddressOption, "admin_email", "roundup-admin", 563 (MailAddressOption, "admin_email", "roundup-admin",
537 "Email address that roundup will complain to if it runs\n" 564 "Email address that roundup will complain to if it runs\n"
538 "into trouble.\n" 565 "into trouble.\n"
539 "If no domain is specified then the config item\n" 566 "If no domain is specified then the config item\n"
540 "mail -> domain is added."), 567 "mail -> domain is added."),

Roundup Issue Tracker: http://roundup-tracker.org/