Permalink
Browse files

Fix beta versioning to be more generic test versioning

This allows us to specify both beta and rc versions.

Requires SQL:

ALTER TABLE core_version RENAME COLUMN beta TO testing;
ALTER TABLE core_version ALTER COLUMN testing TYPE integer USING CASE WHEN testing THEN 2 ELSE 0 END;
  • Loading branch information...
1 parent fdd6d91 commit f31c58ddaab82b4ad5fface09f8c384590153ae2 @mhagander mhagander committed Aug 22, 2013
Showing with 34 additions and 27 deletions.
  1. +1 −1 pgweb/core/feeds.py
  2. +17 −7 pgweb/core/models.py
  3. +1 −1 pgweb/core/views.py
  4. +3 −3 pgweb/docs/struct.py
  5. +6 −6 pgweb/docs/views.py
  6. +5 −8 pgweb/misc/forms.py
  7. +1 −1 templates/docs/index.html
View
@@ -13,7 +13,7 @@ class VersionFeed(Feed):
title_template = 'core/version_rss_title.html'
def items(self):
- return Version.objects.filter(tree__gt=0).filter(beta=False)
+ return Version.objects.filter(tree__gt=0).filter(testing=0)
def item_link(self, obj):
return "http://www.postgresql.org/docs/%s/static/%s" % (obj.tree, obj.relnotes)
View
@@ -5,14 +5,21 @@
from datetime import datetime
+TESTING_CHOICES = (
+ (0, 'Release'),
+ (1, 'Release candidate'),
+ (2, 'Beta'),
+ )
+TESTING_SHORTSTRING = ('', 'rc', 'beta')
+
class Version(PgModel, models.Model):
tree = models.DecimalField(max_digits=3, decimal_places=1, null=False, blank=False, unique=True)
- latestminor = models.IntegerField(null=False, blank=False, default=0, help_text="For beta versions, latestminor means latest beta number. For other releases, it's the latest minor release number in the tree.")
+ latestminor = models.IntegerField(null=False, blank=False, default=0, help_text="For testing versions, latestminor means latest beta/rc number. For other releases, it's the latest minor release number in the tree.")
reldate = models.DateField(null=False, blank=False)
relnotes = models.CharField(max_length=32, null=False, blank=False)
current = models.BooleanField(null=False, blank=False, default=False)
supported = models.BooleanField(null=False, blank=False, default=True)
- beta = models.BooleanField(null=False, blank=False, default=False, help_text="For beta versions, latestminor means beta number")
+ testing = models.IntegerField(null=False, blank=False, default=0, help_text="Testing level of this release. latestminor indicates beta/rc number", choices=TESTING_CHOICES)
docsloaded = models.DateTimeField(null=True, blank=True, help_text="The timestamp of the latest docs load. Used to control indexing and info on developer docs.")
firstreldate = models.DateField(null=False, blank=False, help_text="The date of the .0 release in this tree")
eoldate = models.DateField(null=False, blank=False, help_text="The planned EOL date for this tree")
@@ -22,17 +29,20 @@ def __unicode__(self):
@property
def versionstring(self):
- if not self.beta:
- return "%s.%s" % (self.tree, self.latestminor)
+ return self.buildversionstring(self.latestminor)
+
+ def buildversionstring(self, minor):
+ if not self.testing:
+ return "%s.%s" % (self.tree, minor)
else:
- return "%sbeta%s" % (self.tree, self.latestminor)
+ return "%s%s%s" % (self.tree, TESTING_SHORTSTRING[self.testing], minor)
@property
def treestring(self):
- if not self.beta:
+ if not self.testing:
return self.tree
else:
- return "%s beta" % self.tree
+ return "%s %s" % (self.tree, TESTING_SHORTSTRING[self.testing])
def save(self):
# Make sure only one version at a time can be the current one.
View
@@ -79,7 +79,7 @@ def community(request):
# List of supported versions
def versions(request):
return render_to_response('support/versioning.html', {
- 'versions': Version.objects.filter(tree__gt=0).filter(beta=False),
+ 'versions': Version.objects.filter(tree__gt=0).filter(testing=0),
}, NavContext(request, 'support'))
re_staticfilenames = re.compile("^[0-9A-Z/_-]+$", re.IGNORECASE)
View
@@ -9,14 +9,14 @@ def get_struct():
# Can't use a model here, because we don't (for some reason) have a
# hard link to the versions table here
curs = connection.cursor()
- curs.execute("SELECT d.version, d.file, v.docsloaded, v.beta FROM docs d INNER JOIN core_version v ON v.tree=d.version ORDER BY d.version DESC")
+ curs.execute("SELECT d.version, d.file, v.docsloaded, v.testing FROM docs d INNER JOIN core_version v ON v.tree=d.version ORDER BY d.version DESC")
# Start priority is higher than average but lower than what we assign
# to the current version of the docs.
docprio = 0.8
lastversion = None
- for version, filename, loaded, beta in curs.fetchall():
+ for version, filename, loaded, testing in curs.fetchall():
# Decrease the priority with 0.1 for every version of the docs
# we move back in time, until we reach 0.1. At 0.1 it's unlikely
# to show up in a general search, but still possible to reach
@@ -28,7 +28,7 @@ def get_struct():
yield ('docs/%s/static/%s' % (version==0 and 'devel' or version,
filename),
- beta and 0.1 or docprio, # beta versions always get 0.1 in prio
+ testing and 0.1 or docprio, # beta/rc versions always get 0.1 in prio
loaded)
# Also yield the current version urls, with the highest
View
@@ -48,7 +48,7 @@ def docpage(request, version, typ, filename):
page = get_object_or_404(DocPage, version=ver, file=fullname)
versions = DocPage.objects.filter(file=fullname).extra(select={
'supported':"COALESCE((SELECT supported FROM core_version v WHERE v.tree=version), 'f')",
- 'beta':"CASE WHEN (SELECT beta FROM core_version v WHERE v.tree=version)='t' THEN true WHEN version=0 THEN true ELSE false END",
+ 'testing':"COALESCE((SELECT testing FROM core_version v WHERE v.tree=version),0)",
}).order_by('-supported', '-version').only('version', 'file')
if typ=="interactive":
@@ -59,8 +59,8 @@ def docpage(request, version, typ, filename):
return render_to_response('docs/docspage.html', {
'page': page,
'supported_versions': [v for v in versions if v.supported],
- 'devel_versions': [v for v in versions if not v.supported and v.beta],
- 'unsupported_versions': [v for v in versions if not v.supported and not v.beta],
+ 'devel_versions': [v for v in versions if not v.supported and v.testing],
+ 'unsupported_versions': [v for v in versions if not v.supported and not v.testing],
'title': page.title,
'doc_type': typ,
'comments': comments,
@@ -76,7 +76,7 @@ def redirect_root(request, version):
return HttpResponseRedirect("/docs/%s/static/" % version)
def root(request):
- versions = Version.objects.filter(Q(supported=True) | Q(beta=True,tree__gt=0)).order_by('-tree')
+ versions = Version.objects.filter(Q(supported=True) | Q(testing__gt=0,tree__gt=0)).order_by('-tree')
return render_to_response('docs/index.html', {
'versions': versions,
}, NavContext(request, 'docs'))
@@ -108,14 +108,14 @@ def _find_pdf(self, pagetype):
return 0
def manuals(request):
- # We don't include beta's here. Why?
+ # We don't include beta/rc's here. Why?
versions = Version.objects.filter(supported=True).order_by('-tree')
return render_to_response('docs/manuals.html', {
'versions': [_VersionPdfWrapper(v) for v in versions],
}, NavContext(request, 'docs'))
def manualarchive(request):
- versions = Version.objects.filter(beta=False,supported=False,tree__gt=0).order_by('-tree')
+ versions = Version.objects.filter(testing=0,supported=False,tree__gt=0).order_by('-tree')
return render_to_response('docs/archive.html', {
'versions': [_VersionPdfWrapper(v) for v in versions],
}, NavContext(request, 'docs'))
View
@@ -6,16 +6,13 @@
class _version_choices():
def __iter__(self):
yield ('-1', '** Select version')
- q = Q(supported=True) | Q(beta=True)
+ q = Q(supported=True) | Q(testing__gt=0)
for v in Version.objects.filter(q):
for minor in range(v.latestminor,-1,-1):
- if not v.beta:
- s = "%s.%s" % (v.tree, minor)
- else:
- # For beta versions, there is no beta0
- if minor==0: continue
- s = "%s.beta%s" % (v.tree, minor)
- yield (s,s)
+ if not v.testing or minor>0:
+ # For beta/rc versions, there is no beta0, so exclude it
+ s = v.buildversionstring(minor)
+ yield (s,s)
yield ('Unsupported/Unknown', 'Unsupported/Unknown')
class SubmitBugForm(forms.Form):
@@ -22,7 +22,7 @@
<dt>Online Manuals</dt>
<dd>
{%for v in versions%}
- <p><b>{{v.treestring}}</b> ({%if not v.beta%}<a href="/docs/{{v.tree}}/interactive/index.html">with</a>/{%endif%}<a href="/docs/{{v.tree}}/static/index.html">without</a> comments)</p>
+ <p><b>{{v.treestring}}</b> ({%if not v.testing%}<a href="/docs/{{v.tree}}/interactive/index.html">with</a>/{%endif%}<a href="/docs/{{v.tree}}/static/index.html">without</a> comments)</p>
{%endfor%}
</dd>
<dt>Translated Manuals</dt>

0 comments on commit f31c58d

Please sign in to comment.