From: Tony Mack Date: Wed, 31 Aug 2011 20:09:11 +0000 (-0400) Subject: Merge branch 'master' of ssh://git.planet-lab.org/git/sfa X-Git-Tag: sfa-1.0-36~48 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a7b42c544132c8126182a3b48cf1876e0292efe4;hp=e4ed8d79fc63d91c5f76c9a06a4d0b7d802831b1;p=sfa.git Merge branch 'master' of ssh://git.planet-lab.org/git/sfa --- diff --git a/sfa.spec b/sfa.spec index 684a9235..27d34acd 100644 --- a/sfa.spec +++ b/sfa.spec @@ -1,6 +1,6 @@ %define name sfa %define version 1.0 -%define taglevel 33 +%define taglevel 35 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}} %global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" ) @@ -196,6 +196,13 @@ fi [ "$1" -ge "1" ] && service sfa-cm restart || : %changelog +* Tue Aug 30 2011 Thierry Parmentelat - sfa-1.0-35 +- new method record.get_field for sface + +* Mon Aug 29 2011 Thierry Parmentelat - sfa-1.0-34 +- new option -c to sfa-nuke-plc.py +- CreateSliver fixed for admin-only slice tags + * Wed Aug 24 2011 Tony Mack - sfa-1.0-32 - Fixed exploit that allowed an authorities to issue certs for objects that dont belong to them. - Fixed holes in certificate verification logic. diff --git a/sfa/util/record.py b/sfa/util/record.py index a539f620..8a50a65e 100644 --- a/sfa/util/record.py +++ b/sfa/util/record.py @@ -207,6 +207,22 @@ class SfaRecord(Row): """ return GID(string=self.gid) + ## + # Returns the value of a field + + def get_field(self, fieldname, default=None): + # sometimes records act like classes, and sometimes they act like dicts + try: + return getattr(self, fieldname) + except AttributeError: + try: + return self[fieldname] + except KeyError: + if default != None: + return default + else: + raise + ## # Returns a list of field names in this record.