Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from toutpt/master

Add mapping between classifiers and versions
  • Loading branch information...
commit b7532f0cd096607d1bfb091d8b5e91214077e8ac 2 parents beb69a4 + 9cf4132
@aclark4life aclark4life authored
Showing with 26 additions and 0 deletions.
  1. +25 −0 Products/PloneSoftwareCenter/browser/pypi.py
  2. +1 −0  docs/HISTORY.txt
View
25 Products/PloneSoftwareCenter/browser/pypi.py
@@ -3,6 +3,7 @@
"""
import re
import hashlib
+from decimal import Decimal, InvalidOperation
from AccessControl import getSecurityManager
from AccessControl import Unauthorized
@@ -347,8 +348,32 @@ def _get_package(self, normalized_name, name, version, msg=None):
(version, name))
release = releases._getOb(version)
+ self._map_classifiers_to_compatibility(project, release)
+
return project, release
+ def _map_classifiers_to_compatibility(self, project, release):
+ versions = []
+ CLASSIFIER_BASE = 'Framework :: Plone :: '
+ supported_versions = [classifier[len(CLASSIFIER_BASE):] for classifier in \
+ self.request.form.get('classifiers', [])\
+ if classifier.startswith(CLASSIFIER_BASE)]
+
+ for supported_version in supported_versions:
+ try:
+ Decimal(supported_version)
+ except InvalidOperation:
+ continue
+ versions.append('Plone %s' % supported_version)
+
+ vocab = release.getCompatibilityVocab()
+ compats = []
+ for version in versions:
+ if version in vocab:
+ compats.append(version)
+ if compats:
+ release.setCompatibility(compats)
+
def _get_classifiers(self):
"""returns current classifiers"""
sc = self.context
View
1  docs/HISTORY.txt
@@ -17,6 +17,7 @@ Changelog
- Update classifiers [toutpt]
- Update TROVE.txt [toutpt]
- Update default available versions of Plone [toutpt]
+- Add mapping between classifiers and Plone release version when release using pypi api [toutpt]
1.6.3 (2011-06-19)
------------------
Please sign in to comment.
Something went wrong with that request. Please try again.