# IssueTrackerProduct # www.IssueTrackerProduct.com # Peter Bengtsson # # Constants for IssueTrackerProduct # import os def getEnvBool(key, default): """ return an boolean from the environment variables """ value = os.environ.get(key, default) try: value = not not int(value) except ValueError: if str(value).lower().strip() in ['yes','on','t','y']: value = 1 elif str(value).lower().strip() in ['no','off','f','n']: value = 0 else: value = default return value def getEnvInt(key, default): """ return an integer from the environment variables """ value = os.environ.get(key, default) try: return int(value) except ValueError: return default def getEnvStr(key, default): """ return a string from the environment variables """ value = os.environ.get(key, default) return str(value) true = not 0 false = not true try: True = not False except NameError: True = true False = false from I18N import _ # Optimize the output OPTIMIZE = getEnvBool('OPTIMIZE_ISSUETRACKERPRODUCT', True) # Debug # shows some verbose dev data and doesn't actually send emails DEBUG = getEnvBool('DEBUG_ISSUETRACKERPRODUCT', False) UNICODE_ENCODING = getEnvStr('UNICODE_ENCODING_ISSUETRACKERPRODUCT', 'utf-8') # Global variable if you want to disable CheckoutableTemplates # even if it's installed and working. This can be useful to disable # if you're doing development or want to supress all checked out # templates in ZODB. DISABLE_CHECKOUTABLE_TEMPLATES = getEnvBool('DISABLE_CHECKOUTABLE_TEMPLATES', False) # constants ICON_LOCATION = 'misc_/IssueTrackerProduct' ISSUETRACKER_METATYPE = 'Issue Tracker' ISSUE_METATYPE = 'Issue Tracker Issue' ISSUE_DRAFT_METATYPE = 'Issue Tracker Draft Issue' ISSUETHREAD_DRAFT_METATYPE = 'Issue Tracker Draft Issue Thread' NOTIFYABLE_METATYPE = 'Issue Tracker Notifyable' ISSUETHREAD_METATYPE = 'Issue Tracker Issue Thread' NOTIFICATION_META_TYPE = 'Issue Tracker Notification' NOTIFYABLEGROUP_METATYPE = 'Issue Tracker Notifyable Group' NOTIFYABLECONTAINER_METATYPE = 'Issue Tracker Notifyable Container' POP3ACCOUNT_METATYPE = 'Issue Tracker POP3 Account' ACCEPTINGEMAIL_METATYPE = 'Issue Tracker Accepting Email' ISSUEUSERFOLDER_METATYPE = 'Issue Tracker User Folder' ISSUEASSIGNMENT_METATYPE = 'Issue Tracker Assignment' FILTEROPTION_METATYPE = 'Issue Tracker Filter Option' REPORTSCRIPT_METATYPE = 'Issue Tracker Report Script' REPORTS_CONTAINER_METATYPE = 'Report Scripts Container' CUSTOMFIELD_METATYPE = 'Issue Tracker Custom Field' CUSTOMFIELDFOLDER_METATYPE = 'Issue Tracker Custom Field Folder' CUSTOMFIELD_VALIDATION_EXPRESSION_METATYPE = 'Issue Tracker Custom Field Validation Expression' # properties #DEFAULT_TYPES = ('general', 'announcement', 'idea', 'bug report', # 'feature request','question', # 'usability','other') DEFAULT_TYPES = (_(u'general'), _(u'announcement'), _(u'idea'), _(u'bug report'), _(u'feature request'), _(u'question'), _(u'usability'), _(u'other'), ) DEFAULT_TYPE = DEFAULT_TYPES[0] #DEFAULT_URGENCIES = ('low','normal','high','critical') DEFAULT_URGENCIES = (_(u'low'), _(u'normal'), _(u'high'), _(u'critical')) DEFAULT_ALWAYS_NOTIFY = () DEFAULT_URGENCY = DEFAULT_URGENCIES[1] DEFAULT_SECTIONS_OPTIONS = (_(u'General'), _(u'Homepage'), _(u'Other')) DEFAULT_SECTIONS = [DEFAULT_SECTIONS_OPTIONS[0]] DEFAULT_WHEN_IGNORE_WORD = 'ignored' DEFAULT_DISPLAY_DATE = '%d/%m %Y %H:%M' DEFAULT_SITEMASTER_NAME = 'Issue Tracker' DEFAULT_SITEMASTER_EMAIL = 'noreply@localhost' DEFAULT_MANAGER_ROLES = ['Manager', 'IssueTracker Manager'] DEFAULT_DEFAULT_BATCH_SIZE = getEnvInt('ITP_DEFAULT_BATCH_SIZE', 20) DEFAULT_OUTLOOK_BATCH_SIZE = getEnvInt('ITP_OUTLOOK_BATCH_SIZE', 10) DEFAULT_ALLOW_SHOW_ALL = True DEFAULT_ISSUEPREFIX = '' DEFAULT_NO_FILEATTACHMENTS = getEnvInt('ITP_NO_FILEATTACHMENTS', 3) DEFAULT_NO_FOLLOWUP_FILEATTACHMENTS = getEnvInt('ITP_NO_FOLLOWUP_FILEATTACHMENTS', 3) DEFAULT_STATUSES = (_(u'open'), _(u'taken'), _(u'on hold'), _(u'rejected'), _(u'completed')) DEFAULT_STATUSES_VERBS = (_(u'open'), _(u'take'), _(u'put on hold'), _(u'reject'), _(u'complete')) DEFAULT_DISPLAY_FORMATS = ('plaintext','structuredtext') DEFAULT_DEFAULT_DISPLAY_FORMAT = DEFAULT_DISPLAY_FORMATS[0] DEFAULT_DISPATCH_ON_SUBMIT = True DEFAULT_RANDOMID_LENGTH = getEnvInt('ITP_ID_LENGTH', 3) DEFAULT_ALLOW_ISSUEATTRCHANGE = True DEFAULT_STOP_CACHE = True DEFAULT_ALLOW_SUBSCRIPTION = False DEFAULT_PRIVATE_STATISTICS = False DEFAULT_PRIVATE_REPORTS = True DEFAULT_SAVE_DRAFTS = True DEFAULT_SHOW_CONFIDENTIAL_OPTION = False DEFAULT_SHOW_HIDEME_OPTION = False DEFAULT_SHOW_ISSUEURL_OPTION = False DEFAULT_ENCODE_EMAILDISPLAY = True DEFAULT_SHOW_ALWAYS_NOTIFY_STATUS = True DEFAULT_IMAGES_IN_MENU = True DEFAULT_USE_ISSUE_ASSIGNMENT = False DEFAULT_DISALLOW_DUPLICATE_ISSUE_SUBJECTS = False DEFAULT_CAN_ADD_NEW_SECTIONS = False DEFAULT_SIGNATURE_TEXT = _('''[title] <[url]>''') SORTORDER_ALTERNATIVES = ('issuedate','modifydate') DEFAULT_SORTORDER = SORTORDER_ALTERNATIVES[0] DEFAULT_SHOW_ID_WITH_TITLE = False DEFAULT_SHOW_CVSEXPORT_LINK = False DEFAULT_SHOW_USE_ACCESSKEYS_OPTION = True DEFAULT_SHOW_REMEMBER_SAVEDFILTER_PERSISTENTLY_OPTION = True DEFAULT_USE_AUTOSAVE = True DEFAULT_USE_ESTIMATED_TIME = False DEFAULT_USE_ACTUAL_TIME = False DEFAULT_INCLUDE_DESCRIPTION_IN_NOTIFICATIONS = False DEFAULT_USE_TELLAFRIEND = True DEFAULT_USE_TELLAFRIEND_FOR_ANONYMOUS = True DEFAULT_SHOW_DATES_CLEVERLY = True DEFAULT_SHOW_SPAMBOT_PREVENTION = False DEFAULT_SPAM_KEYWORDS = ['poker-stadium.com', ' this gets cleaned away FILTERVALUER_MAX_PER_USER = 20 # how many saved filters one person can have FILTERVALUEFOLDER_THRESHOLD_CLEANING = 1000 # when SPAMBAYES_CHECK = 'spam' # if X-Spambayes-Classification=$this delete the inbound email BTREEFOLDER2_ID = 'issues' # if a BTreeFolder2 is used, use this id POSSIBLE_USER_LISTS = ['assignments', 'added', 'followedup', 'subscribed'] MENUICONS_DATA = {'Home':{'src':'home.gif', 'size':'16x16'}, 'AddIssue':{'src':'add.gif', 'size':'16x16', 'alt':'Add Issue'}, 'QuickAddIssue':{'src':'add.gif', 'size':'16x16', 'alt':'Quick Add Issue'}, 'ListIssues':{'src':'list.gif', 'size':'16x16', 'alt':'List Issues'}, 'CompleteList':{'src':'complete.gif', 'size':'16x16', 'alt':'Complete List'}, 'User':{'src':'user.gif', 'size':'16x16'}, 'Login':{'src':'login.gif', 'size':'16x16'}, 'Logout':{'src':'logout.gif', 'size':'16x16'}, } for title, data in MENUICONS_DATA.items(): if not data.has_key('width'): data['width'] = data['size'].split('x')[0] if not data.has_key('height'): data['height'] = data['size'].split('x')[1] if not data['src'].startswith('/'): data['src'] = '/misc_/IssueTrackerProduct/%s'%data['src'] if not data.has_key('alt'): data['alt'] = title MENUICONS_DATA[title] = data