示例#1
0
 def new(self, tg_errors=None, *args, **kw):
     if tg_errors:
         flash(str(tg_errors))
     expiration = datetime.utcnow() + \
         timedelta(days=config.get('buildroot_overrides.expire_after', 1))
     return dict(form=override_form, values={'expiration': expiration},
                 action=url('/override/save'), title='Buildroot Overrides')
示例#2
0
文件: new.py 项目: tyll/bodhi
 def index(self, *args, **kw):
     notice = config.get('newupdate_notice')
     if notice:
         flash(notice)
     return dict(form=update_form,
                 values=kw,
                 action=url("/save"),
                 title='New Update Form')
示例#3
0
 def new(self, tg_errors=None, *args, **kw):
     if tg_errors:
         flash(str(tg_errors))
     expiration = datetime.utcnow() + \
         timedelta(days=config.get('buildroot_overrides.expire_after', 1))
     return dict(form=override_form,
                 values={'expiration': expiration},
                 action=url('/override/save'),
                 title='Buildroot Overrides')
示例#4
0
 def new(self, tg_errors=None, *args, **kw):
     if tg_errors:
         flash(str(tg_errors))
     expiration = datetime.utcnow() + timedelta(days=config.get("buildroot_overrides.expire_after", 1))
     return dict(
         form=override_form,
         values={"expiration": expiration},
         action=url("/override/save"),
         title="Buildroot Overrides",
     )
示例#5
0
class BuildRootOverrideForm(Form):
    template = "bodhi.templates.overrideform"
    fields = [
            AutoCompleteField('builds', label='Build',
                              search_controller=url('/new/search'),
                              search_param='name', result_name='pkgs',
                              template='bodhi.templates.packagefield',
                              validator=AutoCompleteValidator()),
            TextArea('notes', validator=validators.UnicodeString(),
                     rows=13, cols=65),
            CalendarDatePicker('expiration', not_empty=False)
    ]
    submit_text = "Submit"
示例#6
0
class ObsoleteForm(RemoteForm):
    """
    A jQuery UI dialog that presents the user with a list of pending/testing
    updates for a given package.  The user is then able to instantly obsolete
    any of them with the click of a button.
    """
    action = url('/obsolete')
    update = 'post_data'
    submit_text = "Obsolete"

    def __init__(self, builds):
        super(ObsoleteForm, self).__init__()
        options = [(build.nvr, make_update_link(build)) for build in builds]
        self.fields = [
            CheckBoxList("updates", label="", options=options,
                         default=[build.nvr for build in builds])
        ]
示例#7
0
 def edit(self, build):
     """ Edit an override """
     try:
         override = BuildRootOverride.byBuild(build)
     except SQLObjectNotFound:
         flash("Cannot find override %r" % build)
         raise redirect("/override")
     values = {
         "builds": {"text": override.build, "hidden": override.build},
         "expiration": override.expiration,
         "notes": override.notes,
         "edited": override.build,
     }
     if override.date_expired:
         flash("This override is EXPIRED. Editing it will re-enable it")
     return dict(
         form=override_form, values=values, action=url("/override/save_edit"), title="Edit Buildroot Override"
     )
示例#8
0
 def edit(self, build):
     """ Edit an override """
     try:
         override = BuildRootOverride.byBuild(build)
     except SQLObjectNotFound:
         flash('Cannot find override %r' % build)
         raise redirect('/override')
     values = {
             'builds': {'text': override.build, 'hidden': override.build},
             'expiration': override.expiration,
             'notes': override.notes,
             'edited': override.build,
     }
     if override.date_expired:
         flash('This override is EXPIRED. Editing it will re-enable it')
     return dict(form=override_form, values=values,
                 action=url("/override/save_edit"),
                 title='Edit Buildroot Override')
示例#9
0
 def edit(self, build):
     """ Edit an override """
     try:
         override = BuildRootOverride.byBuild(build)
     except SQLObjectNotFound:
         flash('Cannot find override %r' % build)
         raise redirect('/override')
     values = {
         'builds': {
             'text': override.build,
             'hidden': override.build
         },
         'expiration': override.expiration,
         'notes': override.notes,
         'edited': override.build,
     }
     if override.date_expired:
         flash('This override is EXPIRED. Editing it will re-enable it')
     return dict(form=override_form,
                 values=values,
                 action=url("/override/save_edit"),
                 title='Edit Buildroot Override')
示例#10
0
文件: new.py 项目: bitlord/bodhi
 def index(self, *args, **kw):
     notice = config.get('newupdate_notice')
     if notice:
         flash(notice)
     return dict(form=update_form, values=kw, action=url("/save"),
                 title='New Update Form')
示例#11
0
 def update_params(self, d):
     super(LocalCSSLink, self).update_params(d)
     d["link"] = url(self.name)
示例#12
0
class NewUpdateForm(Form):
    template = "bodhi.templates.new"
    submit_text = "Save Update"
    update_types = config.get('update_types').split()
    request_types = ['Testing', 'Stable', 'None', None]
    fields = [
            AutoCompleteField('builds', label='Package',
                              search_controller=url('/new/search'),
                              search_param='name', result_name='pkgs',
                              template='bodhi.templates.packagefield',
                              validator=AutoCompleteValidator()),
            CheckBox('inheritance', label='Follow Build inheritance',
                     validator=validators.StringBool(),
                     default=False, attrs={'title' : 'Build Inheritance - '
                                                     'TODO'}),
            SingleSelectField('type_', label='Type', options=update_types,
                              validator=validators.OneOf(update_types)),
            SingleSelectField('request', options=request_types,
                              validator=validators.OneOf(request_types +
                                  [r.lower() for r in request_types if r]),
                              default='testing'),
            TextField('bugs', validator=BugValidator(),
                      attrs={'title' : 'Bug Numbers - A space or comma '
                                       'delimited list of bug numbers or '
                                       'aliases.  Example: #1234, 789 '
                                       'CVE-2008-0001'}),
            TextArea('notes', validator=validators.UnicodeString(),
                     rows=13, cols=65,
                     attrs={'title' : 'Advisory Notes - <p>Some details '
                                      'about this update that will appear in '
                                      'the notice.</p>'
                                      '<p><strong>Example:</strong><br />'
                                      'This is an update that fixes problems with '
                                      '**<strong>connecting to a share</strong>**.</p>'
                                      '<p>The following things *<em>break</em>*:</p>'
                                      '<p>* Browsing with `<code>gnome-app-install</code>`<br />'
                                      '* Emailing</p>'}),
            CheckBox(name='close_bugs', help_text='Automatically close bugs',
                     validator=validators.StringBool(),
                     default=True, attrs={'title' : 'Close Bugs - '
                                                    'Automatically close bugs '
                                                    'when this update is '
                                                    'pushed as stable'}),
            HiddenField('edited', default=None),
            CheckBox(name='suggest_reboot', label='Suggest Reboot',
                     validator=validators.StringBool(),
                     default=False, attrs={'title': 'Suggest Reboot - '
                                                    'Recommend that the user '
                                                    'restarts their machine '
                                                    'after installing this '
                                                    'update'}),
            CheckBox(name='autokarma', label='Enable karma automatism',
                     default=True, validator=validators.StringBool(),
                     attrs={'onchange':
                         'if ($("#form_autokarma").attr("checked")) {'
                            '$("#form_stable_karma").attr("disabled", false);'
                            'if ($("#form_stable_karma").attr("value") == 0) $("#form_stable_karma").attr("value", 3);'
                            '$("#form_unstable_karma").attr("disabled", false);'
                            'if ($("#form_unstable_karma").attr("value") == 0) $("#form_unstable_karma").attr("value", -3);'
                         ' } else { '
                            '$("#form_stable_karma").attr("disabled", true);'
                            '$("#form_unstable_karma").attr("disabled", true);'
                         '}',
                    'title': 'Karma Automatism - Enable update request '
                             'automation based on user feedback',
                            }),
            TextField('stable_karma', label='Threshold for pushing to stable',
                      validator=validators.Int(), default='3',
                      attrs={'title' : 'Stable Karma - The threshold for '
                             'automatically pushing this update to stable',
                             'size' : '1'}),
            TextField('unstable_karma', label='Threshold for unpushing',
                      validator=validators.Int(), default='-3',
                      attrs={'title' : 'Unstable Karma - The threshold for '
                             'automatically unpushing an unstable update',
                             'size' : '1'})
    ]
示例#13
0
 def update_params(self, d):
     super(LocalCSSLink, self).update_params(d)
     d["link"] = url(self.name)