コード例 #1
0
   def prepare(self, exclude_normal=False):

      Ccp_Script_Args.prepare(self)

      self.add_argument('--force', dest='force',
         action='store_true', default=False,
         help='force coverage_area update')
コード例 #2
0
   def prepare(self):

      Ccp_Script_Args.prepare(self)

      # 2013.12.02:
      #
      #    SELECT z_level, COUNT(*)
      #    FROM tiles_cache_byway_segment
      #    GROUP BY z_level ORDER BY z_level;
      #
      #        z_level | count  
      #       ---------+--------
      #            130 |     59
      #            131 |     23
      #            132 |    161
      #            133 |    469
      #            134 | 483287
      #            135 |    362
      #            136 |    912
      #            137 |    217
      #            138 |     30
      #       (9 rows)
      #
      # BUG nnnn: Fix z_levels 130, 131, 137, 138 to use 132-136... save so
      #           much tilecache time...
      #
      # DEVS: Use this (temporarily) when testing tiles to make it 88.8%
      #       faster. E.g., -l 134 134
      # 
      self.add_argument(
         '-l', '--bridge', dest='bridge_levels', type=int, nargs=2,
         default=(byway.One.z_level_min, byway.One.z_level_max),
         help='For debugging: render just these bridge_levels (130 to 138)')
コード例 #3
0
ファイル: apache2sql.py プロジェクト: xchechi123x/Cyclopath
    def prepare(self):

        Ccp_Script_Args.prepare(self)

        self.add_argument(
            '--access-log',
            dest='access_log',
            default=None,
            action='store',
            help='Use the specified logfile instead of access.log.',
        )

        self.add_argument(
            '--skip-date-check',
            dest='skip_date_check',
            default=False,
            action='store_true',
            help='Import all records, regardless of timestamp.',
        )

        self.add_argument(
            '--skip-analyze',
            dest='skip_analyze',
            default=False,
            action='store_true',
            help='Skip vacuum analyze.',
        )
コード例 #4
0
 def prepare(self):
     Ccp_Script_Args.prepare(self)
     #
     self.add_argument('--create-tables',
                       dest='create_tables',
                       action='store_true',
                       default=False,
                       help='recreate the tile cache tables')
コード例 #5
0
    def prepare(self, exclude_normal=False):

        Ccp_Script_Args.prepare(self)

        self.add_argument('--force',
                          dest='force',
                          action='store_true',
                          default=False,
                          help='force coverage_area update')
コード例 #6
0
ファイル: aliases.py プロジェクト: landonb/Cyclopath
   def prepare(self):
      Ccp_Script_Args.prepare(self)
      #
      self.add_argument('-C', '--count', dest='row_count',
         action='store', default=0, type=int, required=True,
         help='the number of aliases to insert')

      self.add_argument('-O', '--offset', dest='row_offset',
         action='store', default=0, type=int, required=True,
         help='the row offset at which to start')
コード例 #7
0
   def prepare(self):

      Ccp_Script_Args.prepare(self)

      self.add_argument('-X', '--drop-table', dest='cache_table_drop',
                        default=False, action='store_true',
                        help='Drop the cache tables from the database.',)

      self.add_argument('-C', '--create-table', dest='cache_table_create',
                        default=False, action='store_true',
                        help='Create the cache tables in the database.',)
コード例 #8
0
   def prepare(self):
      Ccp_Script_Args.prepare(self)

      # Desired operation.
      self.add_argument('--update-branch', dest='update_branch',
         action='store', default=None, type=str,
         help='the name or ID of the existing branch to update')
      #
      self.add_argument('--new-branch-name', dest='new_branch_name',
         action='store', default='', type=str,
         help='the name of the new branch')
      #
      self.add_argument('--purge-branch', dest='purge_branch',
         action='store_true', default=False,
         help='delete all traces of the branch instead of creating it')

      # For new branches.
      #
      # Either:
      self.add_argument('--last-merge-rid', dest='last_merge_rid',
         action='store', default=0, type=int,
         help='the last merge revision ID, or Current if not specified')
      # or:
      self.add_argument('--is-basemap', dest='is_basemap',
         action='store_true', default=False,
         help='make a parenty branch rather than a leafy branch')

      # For new and existing branches.
      #
      self.add_argument('--callback-class', dest='callback_class',
         action='store', default='', type=str,
         help='classname of the branches module w/ process_import/_export')
      #
      self.add_argument('--tile-skins', dest='tile_skins',
         # Note: default is None, not [], so that --tile-skins all alone means
         #       to clear list of skins, so no tiles will be generated.
         action='store', default=None, type=str, nargs='*',
         help='a list of skins to use to make tiles for branch')
      #
      self.add_argument('--owners', dest='owners',
         action='store', default=[], type=str, nargs='*',
         help='a list of usernames to add to branch owners group')
      self.add_argument('--arbiters', dest='arbiters',
         action='store', default=[], type=str, nargs='*',
         help='a list of usernames to add to branch arbiters group')
      self.add_argument('--editors', dest='editors',
         action='store', default=[], type=str, nargs='*',
         help='a list of usernames to add to branch editors group')

      #
      # FIXME: Implement: Create new database from schema dump and populate
      #                   standard tables.
      """
コード例 #9
0
ファイル: make_new_branch.py プロジェクト: uohzoaix/Cyclopath
   def prepare(self):
      Ccp_Script_Args.prepare(self)

      # Desired operation.
      self.add_argument('--update-branch', dest='update_branch',
         action='store', default=None, type=str,
         help='the name or ID of the existing branch to update')
      #
      self.add_argument('--new-branch-name', dest='new_branch_name',
         action='store', default='', type=str,
         help='the name of the new branch')
      #
      self.add_argument('--purge-branch', dest='purge_branch',
         action='store_true', default=False,
         help='delete all traces of the branch instead of creating it')

      # For new branches.
      #
      # Either:
      self.add_argument('--last-merge-rid', dest='last_merge_rid',
         action='store', default=0, type=int,
         help='the last merge revision ID, or Current if not specified')
      # or:
      self.add_argument('--is-basemap', dest='is_basemap',
         action='store_true', default=False,
         help='make a parenty branch rather than a leafy branch')

      # For new and existing branches.
      #
      self.add_argument('--callback-class', dest='callback_class',
         action='store', default='', type=str,
         help='classname of the branches module w/ process_import/_export')
      #
      self.add_argument('--tile-skins', dest='tile_skins',
         # Note: default is None, not [], so that --tile-skins all alone means
         #       to clear list of skins, so no tiles will be generated.
         action='store', default=None, type=str, nargs='*',
         help='a list of skins to use to make tiles for branch')
      #
      self.add_argument('--owners', dest='owners',
         action='store', default=[], type=str, nargs='*',
         help='a list of usernames to add to branch owners group')
      self.add_argument('--arbiters', dest='arbiters',
         action='store', default=[], type=str, nargs='*',
         help='a list of usernames to add to branch arbiters group')
      self.add_argument('--editors', dest='editors',
         action='store', default=[], type=str, nargs='*',
         help='a list of usernames to add to branch editors group')

      #
      # FIXME: Implement: Create new database from schema dump and populate
      #                   standard tables.
      """
コード例 #10
0
   def prepare(self):
      Ccp_Script_Args.prepare(self)

      #
      # MAYBE: We'll probably want a new profile, 'commentable', or
      # something, that means a group cannot edit features but can
      # edit posts and/or notes, etc., maybe points, whatnot. Maybe
      # it just restricts certain types, instead, no mostly 'normal',
      # but maybe cannot edit byways and regions, say.
      self.add_argument('-p', '--profile', dest='policy_profile',
         action='store', default='standard',
         choices=(None, 'standard', 'denied',),
         help='policy profile: how to setup group\'s access')
コード例 #11
0
 def verify_handler(self):
     ok = Ccp_Script_Args.verify_handler(self)
     if self.cli_opts.recipient_file and self.cli_opts.bug_number:
         log.error(
             'Please specify either --output or --bug-number, not both')
         ok = False
     elif self.cli_opts.bug_number:
         # Use the server name in the path.
         hostname = socket.gethostname()  # E.g., 'runic', 'my.home.domain'
         dot_index = hostname.find('.')
         if dot_index > 0:
             hostname = hostname[0:dot_index]
         # else, dot_index is 0 (unexpected, e.g., ".home.domain"?)
         #    or dot_index is -1 (not found)
         self.cli_opts.recipient_file = (
             #'/ccp/bin/ccpdev/private/runic/schema/bug_%s/recipient_file'
             '/ccp/bin/ccpdev/private/%s/schema/bug_%s/recipient_file' % (
                 socket.gethostname(),
                 self.cli_opts.bug_number,
             ))
     elif not self.cli_opts.recipient_file:
         log.error('Please specify either --output or --bug-number.')
         ok = False
     num_inputs = 0
     num_inputs += 1 if self.cli_opts.email_addrs else 0
     num_inputs += 1 if self.cli_opts.usernames else 0
     num_inputs += 1 if self.cli_opts.userids else 0
     if num_inputs > 1:
         log.error(
             'Cannot specify more than one of --emails, --usernames, --userids'
         )
         ok = False
     g.assurt(self.cli_opts.split_count >= 1)
     return ok
コード例 #12
0
ファイル: emails_for_spam.py プロジェクト: landonb/Cyclopath
 def verify_handler(self):
    ok = Ccp_Script_Args.verify_handler(self)
    if self.cli_opts.recipient_file and self.cli_opts.bug_number:
       log.error(
          'Please specify either --output or --bug-number, not both')
       ok = False
    elif self.cli_opts.bug_number:
       # Use the server name in the path.
       hostname = socket.gethostname() # E.g., 'runic', 'my.home.domain'
       dot_index = hostname.find('.')
       if dot_index > 0:
          hostname = hostname[0:dot_index]
       # else, dot_index is 0 (unexpected, e.g., ".home.domain"?)
       #    or dot_index is -1 (not found)
       self.cli_opts.recipient_file = (
          #'/ccp/bin/ccpdev/private/runic/schema/bug_%s/recipient_file'
          '/ccp/bin/ccpdev/private/%s/schema/bug_%s/recipient_file'
          % (socket.gethostname(), self.cli_opts.bug_number,))
    elif not self.cli_opts.recipient_file:
       log.error('Please specify either --output or --bug-number.')
       ok = False
    num_inputs = 0
    num_inputs += 1 if self.cli_opts.email_addrs else 0
    num_inputs += 1 if self.cli_opts.usernames else 0
    num_inputs += 1 if self.cli_opts.userids else 0
    if num_inputs > 1:
       log.error(
          'Cannot specify more than one of --emails, --usernames, --userids')
       ok = False
    g.assurt(self.cli_opts.split_count >= 1)
    return ok
コード例 #13
0
ファイル: apache2sql.py プロジェクト: uohzoaix/Cyclopath
   def prepare(self):

      Ccp_Script_Args.prepare(self)

      self.add_argument(
         '--access-log', dest='access_log',
         default=None, action='store',
         help='Use the specified logfile instead of access.log.',)

      self.add_argument(
         '--skip-date-check', dest='skip_date_check',
         default=False, action='store_true',
         help='Import all records, regardless of timestamp.',)

      self.add_argument(
         '--skip-analyze', dest='skip_analyze',
         default=False, action='store_true',
         help='Skip vacuum analyze.',)
コード例 #14
0
    def prepare(self):
        Ccp_Script_Args.prepare(self)

        #
        # MAYBE: We'll probably want a new profile, 'commentable', or
        # something, that means a group cannot edit features but can
        # edit posts and/or notes, etc., maybe points, whatnot. Maybe
        # it just restricts certain types, instead, no mostly 'normal',
        # but maybe cannot edit byways and regions, say.
        self.add_argument('-p',
                          '--profile',
                          dest='policy_profile',
                          action='store',
                          default='standard',
                          choices=(
                              None,
                              'standard',
                              'denied',
                          ),
                          help='policy profile: how to setup group\'s access')
コード例 #15
0
    def prepare(self):
        Ccp_Script_Args.prepare(self)
        #
        self.add_argument('-C',
                          '--count',
                          dest='row_count',
                          action='store',
                          default=0,
                          type=int,
                          required=True,
                          help='the number of aliases to insert')

        self.add_argument('-O',
                          '--offset',
                          dest='row_offset',
                          action='store',
                          default=0,
                          type=int,
                          required=True,
                          help='the row offset at which to start')
コード例 #16
0
   def verify(self):

      verified = Ccp_Script_Args.verify(self)

      if ((self.cli_opts.bridge_levels[0] < byway.One.z_level_min)
          or (self.cli_opts.bridge_levels[1] > byway.One.z_level_max)):
         log.error('Please specify bridge levels between %d and %d, inclusive.'
                   % (byway.One.z_level_min, byway.One.z_level_max,))
         verified = False
         self.handled = True

      return verified
コード例 #17
0
    def prepare(self):

        Ccp_Script_Args.prepare(self)

        self.add_argument(
            '-X',
            '--drop-table',
            dest='cache_table_drop',
            default=False,
            action='store_true',
            help='Drop the cache tables from the database.',
        )

        self.add_argument(
            '-C',
            '--create-table',
            dest='cache_table_create',
            default=False,
            action='store_true',
            help='Create the cache tables in the database.',
        )
コード例 #18
0
ファイル: emails_for_spam.py プロジェクト: landonb/Cyclopath
 def prepare(self):
    Ccp_Script_Args.prepare(self, exclude_normal=True)
    #
    self.add_argument('--emails', dest='email_addrs',
       action='store', default=[], type=str, nargs='*', required=False,
       help='a list of email addresses to verify, or none if you want all')
    #
    self.add_argument('--usernames', dest='usernames',
       action='store', default=[], type=str, nargs='*', required=False,
       help='a list of usernames to verify, or none if you want all')
    #
    self.add_argument('--userids', dest='userids',
       action='store', default=[], type=str, nargs='*', required=False,
       help='a list of userids to verify, or none if you want all')
    #
    self.add_argument('--output', dest='recipient_file',
       action='store', default=None, type=str, required=False,
       help='the file in which to store the list of emails okay to email')
    #
    self.add_argument('--bug-number', dest='bug_number',
       action='store', default=None, type=int, required=False,
       help='the bug number, if you want to use standard paths and names')
    #
    self.add_argument('--split-count', dest='split_count',
       action='store', default=1, type=int, required=False,
       help='the number of output files to create')
    #
    self.add_argument('--force', dest='force_overwrite',
       action='store_true', default=False, required=False,
       help='overwrite the output file(s), if they exist')
    #
    self.add_argument('--sort-mode', dest='sort_mode',
       action='store', default='', type=str, required=False,
       choices=('id ASC', 'id DESC', 'email ASC', 'email DESC', 
                'username ASC', 'username DESC', 'RANDOM()',),
       help='how to order the results')
    # If you're testing, you may want to ignore dont_study, etc.
    self.add_argument('--ignore-flags', dest='ignore_flags',
       action='store_true', default=False, required=False,
       help='always email, even if dont_study.')
コード例 #19
0
   def prepare(self):
      '''Defines the CLI options for this script'''

      Ccp_Script_Args.prepare(self)

      self.add_argument('-d', '--scripts-dir', dest='scripts_dir',
         action='store', default=default_schema_dir, type=str,
         help='relative path of dir containing the schema scripts')

      self.add_argument('-I', '--run-all', dest='run_all',
         action='store_true', default=False,
         help='run all scripts, from #1, ignore upgrade_event table')

      # yesall has the same meaning as --non-interactive
      self.add_argument('-y', '--yes-all', dest='do_yesall',
         action='store_true', default=False,
         help='run all scripts without prompting (unless one fails)')

      self.add_argument('--revert', dest='do_revert',
         action='store_true', default=False,
         help='revert previous script (if revert script available)')

      self.add_argument('--noerrs', dest='do_noerrs',
         action='store_true', default=False,
         help='always ask user to check output between scripts')

      self.add_argument('--novacu', dest='do_novacu',
         action='store_true', default=False,
         help='skip vacuuming after every script (experimental)')

      self.add_argument('--dovacu', dest='do_dovacu',
         action='store_true', default=False,
         help='vacuum database after every script (experimental)')

      self.add_argument('--stopon', dest='stop_on_script',
         action='store_true', default=False,
         help='stop if the named script is next to run')
コード例 #20
0
ファイル: spam.py プロジェクト: landonb/Cyclopath
 def verify_handler(self):
    ok = Ccp_Script_Args.verify_handler(self)
    #
    if ((self.cli_opts.recipient_file
         or self.cli_opts.content_plain
         or self.cli_opts.content_html)
        and self.cli_opts.bug_number):
       log.error('%s%s'
          % ('Please specify either recipient_file, content_plain, and ',
             'content_html, or --bug-number, not both',))
       ok = False
    elif self.cli_opts.bug_number:
       self.cli_opts.recipient_file = (
          '/ccp/bin/ccpdev/schema/runic/bug_%s/recipient_file'
          % (self.cli_opts.bug_number,))
       if self.cli_opts.file_number:
          self.cli_opts.recipient_file += (
             '.%d' % (self.cli_opts.file_number,))
       self.cli_opts.content_plain = (
          '/ccp/bin/ccpdev/schema/runic/bug_%s/content_plain'
          % (self.cli_opts.bug_number,))
       self.cli_opts.content_html = (
          '/ccp/bin/ccpdev/schema/runic/bug_%s/content_html'
          % (self.cli_opts.bug_number,))
    elif (not (self.cli_opts.recipient_file
               and self.cli_opts.content_plain
               and self.cli_opts.content_html)):
       log.error('%s%s'
                 % ('Please specify either --recipient-file, --plain, ',
                    'and --html, or --bug-number.',))
    #
    file_paths = [
       self.cli_opts.recipient_file,
       self.cli_opts.content_plain,
       self.cli_opts.content_html,
       ]
    if self.cli_opts.send_test_emails:
       file_paths.append(self.cli_opts.test_emails_file)
    for fpath in file_paths:
       if not os.path.exists(fpath):
          log.error('File does not exist: "%s"' % (fpath,))
          ok = False
    #
    if self.cli_opts.send_test_emails:
       self.cli_opts.recipient_file = self.cli_opts.test_emails_file
    #
    return ok
コード例 #21
0
 def verify_handler(self):
     ok = Ccp_Script_Args.verify_handler(self)
     #
     if ((self.cli_opts.recipient_file or self.cli_opts.content_plain
          or self.cli_opts.content_html) and self.cli_opts.bug_number):
         log.error('%s%s' % (
             'Please specify either recipient_file, content_plain, and ',
             'content_html, or --bug-number, not both',
         ))
         ok = False
     elif self.cli_opts.bug_number:
         self.cli_opts.recipient_file = (
             '/ccp/bin/ccpdev/schema/runic/bug_%s/recipient_file' %
             (self.cli_opts.bug_number, ))
         if self.cli_opts.file_number:
             self.cli_opts.recipient_file += ('.%d' %
                                              (self.cli_opts.file_number, ))
         self.cli_opts.content_plain = (
             '/ccp/bin/ccpdev/schema/runic/bug_%s/content_plain' %
             (self.cli_opts.bug_number, ))
         self.cli_opts.content_html = (
             '/ccp/bin/ccpdev/schema/runic/bug_%s/content_html' %
             (self.cli_opts.bug_number, ))
     elif (not (self.cli_opts.recipient_file and self.cli_opts.content_plain
                and self.cli_opts.content_html)):
         log.error('%s%s' % (
             'Please specify either --recipient-file, --plain, ',
             'and --html, or --bug-number.',
         ))
     #
     file_paths = [
         self.cli_opts.recipient_file,
         self.cli_opts.content_plain,
         self.cli_opts.content_html,
     ]
     if self.cli_opts.send_test_emails:
         file_paths.append(self.cli_opts.test_emails_file)
     for fpath in file_paths:
         if not os.path.exists(fpath):
             log.error('File does not exist: "%s"' % (fpath, ))
             ok = False
     #
     if self.cli_opts.send_test_emails:
         self.cli_opts.recipient_file = self.cli_opts.test_emails_file
     #
     return ok
コード例 #22
0
 def verify_handler(self):
    ok = Ccp_Script_Args.verify_handler(self)
    if self.cli_opts.username == conf.anonymous_username:
       log.error('Please specify a real username (no anonymous cowards).')
       ok = False
    op_count = (  (1 if (self.cli_opts.update_branch is not None) else 0)
                + (1 if (self.cli_opts.new_branch_name) else 0)
                + (1 if (self.cli_opts.purge_branch) else 0))
    if op_count != 1:
          log.error(
       'Specify one: --update-branch, --new-branch-name, or --purge-branch.')
          ok = False
    if self.cli_opts.purge_branch:
       if not self.cli_opts.branch:
          log.error('Please use --branch to specify the branch to purge.')
          ok = False
    if self.cli_opts.last_merge_rid and self.cli_opts.is_basemap:
       log.error('Please specify either --last-merge-rid or --is-basemap.')
       ok = False
    return ok
コード例 #23
0
ファイル: make_new_branch.py プロジェクト: uohzoaix/Cyclopath
 def verify_handler(self):
    ok = Ccp_Script_Args.verify_handler(self)
    if self.cli_opts.username == conf.anonymous_username:
       log.error('Please specify a real username (no anonymous cowards).')
       ok = False
    op_count = (  (1 if (self.cli_opts.update_branch is not None) else 0)
                + (1 if (self.cli_opts.new_branch_name) else 0)
                + (1 if (self.cli_opts.purge_branch) else 0))
    if op_count != 1:
          log.error(
       'Specify one: --update-branch, --new-branch-name, or --purge-branch.')
          ok = False
    if self.cli_opts.purge_branch:
       if not self.cli_opts.branch:
          log.error('Please use --branch to specify the branch to purge.')
          ok = False
    if self.cli_opts.last_merge_rid and self.cli_opts.is_basemap:
       log.error('Please specify either --last-merge-rid or --is-basemap.')
       ok = False
    return ok
コード例 #24
0
 def __init__(self):
    Ccp_Script_Args.__init__(self, script_name, script_version,
                                   usage=None)
コード例 #25
0
 def verify_handler(self):
     ok = Ccp_Script_Args.verify_handler(self)
     return ok
コード例 #26
0
 def prepare(self):
    Ccp_Script_Args.prepare(self)
コード例 #27
0
 def __init__(self):
     Ccp_Script_Args.__init__(self, script_name, script_version)
     #
     self.groups_none_use_public = True
コード例 #28
0
ファイル: spam.py プロジェクト: landonb/Cyclopath
   def prepare(self):
      Ccp_Script_Args.prepare(self, exclude_normal=True)

      self.add_argument('--subject', dest='email_subject',
         action='store', default='', type=str, required=True,
         help='the subject of the email')

      #
      self.add_argument('--recipients', dest='recipient_file',
         action='store', default=None, type=str, required=False,
         help='file of user IDs (or maybe usernames or email addresses')
      #
      self.add_argument('--plain', dest='content_plain',
         action='store', default=None, type=str, required=False,
         help='file containing the email plaintext')
      #
      self.add_argument('--html', dest='content_html',
         action='store', default=None, type=str, required=False,
         help='file containing the email html')
      # Or, instead of the last three:
      self.add_argument('--bug-number', dest='bug_number',
         action='store', default=None, type=int, required=False,
         help='the bug number, if you want to use standard paths and names')
      #
      self.add_argument('--file-number', dest='file_number',
         action='store', default=None, type=int, required=False,
         help='the file number of the emails_for_spam-created file')

      #
      self.add_argument('--test', dest='send_test_emails',
         action='store_true', default=False,
         help='if set, send emails to the users listed in the test file')
      #
      self.add_argument('--test-file', dest='test_emails_file',
         action='store', type=str, required=False,
         default='/ccp/bin/ccpdev/schema/runic/spam_test_uids',
         help='the location of the test email user IDs')
      # To test the code without sending even test emails, try this.
      self.add_argument('--do-not-email', dest='do_not_email',
         action='store_true', default=False, required=False,
         help='do not even send test emails, just test the code.')
      # Generally when you test you'll want to ignore dont_study, etc.
      self.add_argument('--ignore-flags', dest='ignore_flags',
         action='store_true', default=False, required=False,
         help='always email, even if dont_study.')

      #
      # MAGIC_NUMBER: 0.3 seconds seems... reasonable. We've not tested
      #               anything smaller (circa 2012.11.12).
      self.add_argument('--delay-time', dest='delay_time',
         action='store', default=0.3, type=float,
         help='if nonzero, wait time between sendmail calls')
      #
      self.add_argument('--dont-shake', dest='dont_shake',
         action='store_true', default=True,
         help='if set, use a variable delay time each time')

      #
      self.add_argument('--mail-from', dest='mail_from',
         action='store', default=conf.mail_from_addr, type=str,
         help='used to override CONFIG.mail_from_addr')
      #
      self.add_argument('--bcc-size', dest='bcc_size',
         action='store', default=0, type=int,
         help='number of recipients to Bcc at once (per sendmail call)')
コード例 #29
0
ファイル: spam.py プロジェクト: landonb/Cyclopath
 def __init__(self):
    Ccp_Script_Args.__init__(self, script_name, script_version)
コード例 #30
0
 def prepare(self):
     Ccp_Script_Args.prepare(self)
コード例 #31
0
 def verify_handler(self):
    ok = Ccp_Script_Args.verify_handler(self)
    return ok
コード例 #32
0
ファイル: apache2sql.py プロジェクト: xchechi123x/Cyclopath
 def __init__(self):
     Ccp_Script_Args.__init__(self, script_name, script_version)
コード例 #33
0
    def prepare(self):
        Ccp_Script_Args.prepare(self, exclude_normal=True)

        self.add_argument('--subject',
                          dest='email_subject',
                          action='store',
                          default='',
                          type=str,
                          required=True,
                          help='the subject of the email')

        #
        self.add_argument(
            '--recipients',
            dest='recipient_file',
            action='store',
            default=None,
            type=str,
            required=False,
            help='file of user IDs (or maybe usernames or email addresses')
        #
        self.add_argument('--plain',
                          dest='content_plain',
                          action='store',
                          default=None,
                          type=str,
                          required=False,
                          help='file containing the email plaintext')
        #
        self.add_argument('--html',
                          dest='content_html',
                          action='store',
                          default=None,
                          type=str,
                          required=False,
                          help='file containing the email html')
        # Or, instead of the last three:
        self.add_argument(
            '--bug-number',
            dest='bug_number',
            action='store',
            default=None,
            type=int,
            required=False,
            help='the bug number, if you want to use standard paths and names')
        #
        self.add_argument(
            '--file-number',
            dest='file_number',
            action='store',
            default=None,
            type=int,
            required=False,
            help='the file number of the emails_for_spam-created file')

        #
        self.add_argument(
            '--test',
            dest='send_test_emails',
            action='store_true',
            default=False,
            help='if set, send emails to the users listed in the test file')
        #
        self.add_argument(
            '--test-file',
            dest='test_emails_file',
            action='store',
            type=str,
            required=False,
            default='/ccp/bin/ccpdev/schema/runic/spam_test_uids',
            help='the location of the test email user IDs')
        # To test the code without sending even test emails, try this.
        self.add_argument(
            '--do-not-email',
            dest='do_not_email',
            action='store_true',
            default=False,
            required=False,
            help='do not even send test emails, just test the code.')
        # Generally when you test you'll want to ignore dont_study, etc.
        self.add_argument('--ignore-flags',
                          dest='ignore_flags',
                          action='store_true',
                          default=False,
                          required=False,
                          help='always email, even if dont_study.')

        #
        # MAGIC_NUMBER: 0.3 seconds seems... reasonable. We've not tested
        #               anything smaller (circa 2012.11.12).
        self.add_argument('--delay-time',
                          dest='delay_time',
                          action='store',
                          default=0.3,
                          type=float,
                          help='if nonzero, wait time between sendmail calls')
        #
        self.add_argument('--dont-shake',
                          dest='dont_shake',
                          action='store_true',
                          default=True,
                          help='if set, use a variable delay time each time')

        #
        self.add_argument('--mail-from',
                          dest='mail_from',
                          action='store',
                          default=conf.mail_from_addr,
                          type=str,
                          help='used to override CONFIG.mail_from_addr')
        #
        self.add_argument(
            '--bcc-size',
            dest='bcc_size',
            action='store',
            default=0,
            type=int,
            help='number of recipients to Bcc at once (per sendmail call)')
コード例 #34
0
 def parse(self):
     Ccp_Script_Args.parse(self)
コード例 #35
0
ファイル: make_new_branch.py プロジェクト: uohzoaix/Cyclopath
 def __init__(self):
    Ccp_Script_Args.__init__(self, script_name, script_version)
    #
    self.groups_none_use_public = True
コード例 #36
0
ファイル: item_loader_test.py プロジェクト: landonb/Cyclopath
 def prepare(self):
    Ccp_Script_Args.prepare(self)
    #
    self.add_argument('--create-tables', dest='create_tables',
       action='store_true', default=False,
       help='recreate the tile cache tables')
コード例 #37
0
 def prepare(self):
     Ccp_Script_Args.prepare(self, exclude_normal=True)
     #
     self.add_argument(
         '--emails',
         dest='email_addrs',
         action='store',
         default=[],
         type=str,
         nargs='*',
         required=False,
         help='a list of email addresses to verify, or none if you want all'
     )
     #
     self.add_argument(
         '--usernames',
         dest='usernames',
         action='store',
         default=[],
         type=str,
         nargs='*',
         required=False,
         help='a list of usernames to verify, or none if you want all')
     #
     self.add_argument(
         '--userids',
         dest='userids',
         action='store',
         default=[],
         type=str,
         nargs='*',
         required=False,
         help='a list of userids to verify, or none if you want all')
     #
     self.add_argument(
         '--output',
         dest='recipient_file',
         action='store',
         default=None,
         type=str,
         required=False,
         help='the file in which to store the list of emails okay to email')
     #
     self.add_argument(
         '--bug-number',
         dest='bug_number',
         action='store',
         default=None,
         type=int,
         required=False,
         help='the bug number, if you want to use standard paths and names')
     #
     self.add_argument('--split-count',
                       dest='split_count',
                       action='store',
                       default=1,
                       type=int,
                       required=False,
                       help='the number of output files to create')
     #
     self.add_argument('--force',
                       dest='force_overwrite',
                       action='store_true',
                       default=False,
                       required=False,
                       help='overwrite the output file(s), if they exist')
     #
     self.add_argument('--sort-mode',
                       dest='sort_mode',
                       action='store',
                       default='',
                       type=str,
                       required=False,
                       choices=(
                           'id ASC',
                           'id DESC',
                           'email ASC',
                           'email DESC',
                           'username ASC',
                           'username DESC',
                           'RANDOM()',
                       ),
                       help='how to order the results')
     # If you're testing, you may want to ignore dont_study, etc.
     self.add_argument('--ignore-flags',
                       dest='ignore_flags',
                       action='store_true',
                       default=False,
                       required=False,
                       help='always email, even if dont_study.')
コード例 #38
0
 def verify(self):
    verified = Ccp_Script_Args.verify(self)
コード例 #39
0
ファイル: spam.py プロジェクト: landonb/Cyclopath
 def parse(self):
    Ccp_Script_Args.parse(self)