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')
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')
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", )
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"
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]) ]
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" )
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')
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')
def update_params(self, d): super(LocalCSSLink, self).update_params(d) d["link"] = url(self.name)
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'}) ]