addition to the existing 'pyang' checker. Added modal overlay displays showing the yang check results every place the yin/yang symbol is shown (red or green) to indicate the presencee and result of yang checks. Added a Yang Validation: line in the document meta-information section on the document's page in the datatracker. Added the result of the xym extaction to the yang check results, to make extration failures visible. Added the version of the used xym, pyang, and yanglint commands to the check results. Added an action to move successfully extracted and validated modules to the module library directories immediately on submission. Added the xym and pyang repositories as svn:external components, rather than listing them in requirements.txt, as there has been delays of many months between essential features in the repositories, and an actual release. We may get occasional buildbot failures if broken code is pulled in from the repository, but better that than the functionality failure of severely outdated componets. Added a new management command to re-run yang validation for active drafts for which yang modules were found at submission time, in order to pick up imported models which may have arrived in the model libraries after the draft's submission. Run daily from bin/daily. Added a table to hold version information for external commands. The yang checker output should include the version information of the used checkers, but seems unnecessary to run each command with its --version switch every time we check a module... Added a new management command to collect version information for external commands on demand. To be run daily from bin/daily. Added tests to verify that xym, pyang and yanglint information is available on the submission confirmation page, and updated the yang module contained in the test document to validate under both pyang and yanglint. Updated admin.py and resource.py files as needed. - Legacy-Id: 13630
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
from django.contrib import admin
|
|
from ietf.utils.models import VersionInfo
|
|
|
|
def name(obj):
|
|
if hasattr(obj, 'abbrev'):
|
|
return obj.abbrev()
|
|
elif hasattr(obj, 'name'):
|
|
if callable(obj.name):
|
|
name = obj.name()
|
|
else:
|
|
name = unicode(obj.name)
|
|
if name:
|
|
return name
|
|
return unicode(obj)
|
|
|
|
def admin_link(field, label=None, ordering="", display=name, suffix=""):
|
|
if not label:
|
|
label = field.capitalize().replace("_", " ").strip()
|
|
if ordering == "":
|
|
ordering = field
|
|
def _link(self):
|
|
obj = self
|
|
for attr in field.split("__"):
|
|
obj = getattr(obj, attr)
|
|
if callable(obj):
|
|
obj = obj()
|
|
if hasattr(obj, "all"):
|
|
objects = obj.all()
|
|
elif callable(obj):
|
|
objects = obj()
|
|
if not hasattr(objects, "__iter__"):
|
|
objects = [ objects ]
|
|
elif hasattr(obj, "__iter__"):
|
|
objects = obj
|
|
else:
|
|
objects = [ obj ]
|
|
chunks = []
|
|
for obj in objects:
|
|
app = obj._meta.app_label
|
|
model = obj.__class__.__name__.lower()
|
|
id = obj.pk
|
|
chunks += [ u'<a href="/admin/%(app)s/%(model)s/%(id)s/%(suffix)s">%(display)s</a>' %
|
|
{'app':app, "model": model, "id":id, "display": display(obj), "suffix":suffix, } ]
|
|
return u", ".join(chunks)
|
|
_link.allow_tags = True
|
|
_link.short_description = label
|
|
_link.admin_order_field = ordering
|
|
return _link
|
|
|
|
class VersionInfoAdmin(admin.ModelAdmin):
|
|
list_display = ['command', 'switch', 'version', 'time', ]
|
|
admin.site.register(VersionInfo, VersionInfoAdmin)
|