euscanwww: Use Version.tag to be more DRY
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
b838f3cb59
commit
effab2015b
@ -44,9 +44,8 @@ class BaseFeed(Feed):
|
|||||||
def item_link(self, vlog):
|
def item_link(self, vlog):
|
||||||
kwargs = {'category': vlog.package.category,
|
kwargs = {'category': vlog.package.category,
|
||||||
'package': vlog.package.name}
|
'package': vlog.package.name}
|
||||||
return "%s#version-%s-%s:%s-%s" % (
|
return "%s#version-%s" % (
|
||||||
reverse('djeuscan.views.package', kwargs=kwargs),
|
reverse('djeuscan.views.package', kwargs=kwargs), vlog.tag
|
||||||
vlog.version, vlog.revision, vlog.slot, vlog.overlay,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def item_pubdate(self, vlog):
|
def item_pubdate(self, vlog):
|
||||||
|
@ -98,3 +98,12 @@ def get_layman_repos():
|
|||||||
lay = Layman(config=settings.LAYMAN_CONFIG)
|
lay = Layman(config=settings.LAYMAN_CONFIG)
|
||||||
installed_overlays = lay.get_installed()
|
installed_overlays = lay.get_installed()
|
||||||
return lay.get_all_info(installed_overlays)
|
return lay.get_all_info(installed_overlays)
|
||||||
|
|
||||||
|
|
||||||
|
def versiontag_to_attrs(tag):
|
||||||
|
import re
|
||||||
|
match = re.match(r"(.+)-(.+):(\d+)-(.+)", tag)
|
||||||
|
if match:
|
||||||
|
return match.groups()
|
||||||
|
else:
|
||||||
|
None
|
||||||
|
@ -156,6 +156,11 @@ class Version(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
|
unique_together = ['package', 'slot', 'revision', 'version', 'overlay']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tag(self):
|
||||||
|
return '%s-%s:%s-%s' % (self.version, self.revision, self.slot,
|
||||||
|
self.overlay)
|
||||||
|
|
||||||
def cpv(self):
|
def cpv(self):
|
||||||
return '%s/%s-%s%s' % (
|
return '%s/%s-%s%s' % (
|
||||||
self.package.category, self.package.name, self.version,
|
self.package.category, self.package.name, self.version,
|
||||||
@ -196,6 +201,11 @@ class VersionLog(models.Model):
|
|||||||
|
|
||||||
objects = VersionLogManager()
|
objects = VersionLogManager()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tag(self):
|
||||||
|
return '%s-%s:%s-%s' % (self.version, self.revision, self.slot,
|
||||||
|
self.overlay)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
txt = '+ ' if self.action == self.VERSION_ADDED else '- '
|
txt = '+ ' if self.action == self.VERSION_ADDED else '- '
|
||||||
txt += '%s/%s-%s-%s:%s [%s]' % (
|
txt += '%s/%s-%s-%s:%s [%s]' % (
|
||||||
@ -209,10 +219,6 @@ class VersionLog(models.Model):
|
|||||||
self.full_clean()
|
self.full_clean()
|
||||||
super(VersionLog, self).save(*args, **kwargs)
|
super(VersionLog, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def tag(self):
|
|
||||||
return '%s-%s:%s-[%s]' % (self.version, self.revision, self.slot,
|
|
||||||
self.overlay)
|
|
||||||
|
|
||||||
|
|
||||||
class EuscanResult(models.Model):
|
class EuscanResult(models.Model):
|
||||||
package = models.ForeignKey(Package)
|
package = models.ForeignKey(Package)
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<ul>
|
<ul>
|
||||||
{% for version in upstream %}
|
{% for version in upstream %}
|
||||||
<li id="version-{{ version.version }}-{{version.revision }}:{{ version.slot }}-{{ version.overlay }}">
|
<li id="version-{{ version.tag }}">
|
||||||
<img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />
|
<img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />
|
||||||
|
|
||||||
{% if version.vtype and not version.vtype|is_stable %}
|
{% if version.vtype and not version.vtype|is_stable %}
|
||||||
|
Loading…
Reference in New Issue
Block a user