## ## Copyright (c) 2006 Jason Dillon ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. ## ## ## $Id: config.py 77 2009-08-25 12:06:19Z mindwanderer $ ## from p4spam import log class Configurator: def __init__(this): this.log = log.getLogger(this) def read(this, filename): assert filename != None this.log.debug("Reading configuration from file: %s" % filename) lnames = locals() gnames = globals() # Read/parse the configuration execfile(filename, gnames, lnames) this.dumpNamespace(lnames, "Locals") this.dumpNamespace(gnames, "Globals") this.validate(lnames) for key in lnames.keys(): gnames[key] = lnames[key] def validate(this, namespace): pass def dumpNamespace(this, namespace, title): assert namespace != None assert title != None this.log.debug(title) for key in namespace.keys(): this.log.debug(" %s = %s" % (key, namespace[key])) __configurator = Configurator() def read(filename): __configurator.read(filename) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## ## Configuration Defaults ## P4_CMD="p4" P4_PORT=None P4_USER=None # This is the actual command-line that will be used to execute `p4` P4_CMDLINE=(P4_CMD,) if P4_PORT != None: P4_CMDLINE.append('-p') P4_CMDLINE.append(P4_PORT) if P4_USER != None: P4_CMDLINE.append('-u') P4_CMDLINE.append(P4_USER) SMTP_HOST = "localhost:25" SPAM_ENABLED = False SPAM_USERS = True REPEAT = False SLEEPTIME = 60 FORCE_STARTING_CHANGE = None SAVE_LAST_CHANGE_ENABLED = True MAX_DIFF_LINES = 1000 MAX_DIFF_LINE_LENGTH = 1000 MAX_SUBJECT_LINE_LENGTH = 200 MAX_BATCH = 10 # The format used for the subject line, needs to %s one for the change #, another for the comment SUBJECT_FORMAT = '[P4] #%s - %s' SUBJECT_NEW_LINES = 'strip' # If set to None, then the email from the change description will be used FROM_ADDR = None # How the email address from change description will be formatted FROM_ADDR_FORMAT = '"%(fullname)s (Perforce)" <%(email)s>' ADMIN_BCC_ADDR = None DISABLE_DIFF_FOR_FILETYPE = [] LAST_CHANGELIST_COUNTER = 'p4spam.lastchange' CHANGE_LIST_URL = "http://perforce.mycompany.com/changelist.php?change=%s" PATH_VIEW_URL = "http://perforce.mycompany.com:8666/%s" FILE_HISTORY_URL = "http://perforce.mycompany.com/history.php?path=%s" JIRA_BROWSE_URL = "https://issues.mycompany.com/browse/%s" P4WEB_HOST = 'http://perforce.mycompany.com:8666' P4WEB_JOB_VIEW_URL = P4WEB_HOST + '/@md=d&cd=//&c=XH3@/%s?ac=111' P4WEB_CHANGELIST_ULK = P4WEB_HOST + '/@md=d&cd=//&c=vcZ@/%s?ac=10' USER_HEADER = None USER_BODY_HEADER = None USER_BODY_FOOTER = None HTML_STYLE = ''' #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch a { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch a { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } ''' SUBSCRIPTIONS = {} SUBSCRIPTIONS_ENABLED = True USER_REVIEWS_ENABLED = True