~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to horizon/horizon/api/base.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-17 10:12:25 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120217101225-5wulil2mv7f2nvnb
Tags: 2012.1~e4~20120217.1354-0ubuntu1
* debian/patches/openstack-config-settings.patch: Refreshed.
* debian/copyright: Updated copyright.
* debian/rules: Diable tests since it doesnt work without a
  virtualenv.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
2
 
3
 
# Copyright 2011 United States Government as represented by the
 
3
# Copyright 2012 United States Government as represented by the
4
4
# Administrator of the National Aeronautics and Space Administration.
5
5
# All Rights Reserved.
6
6
#
7
 
# Copyright 2011 Nebula, Inc.
 
7
# Copyright 2012 Nebula, Inc.
8
8
#
9
9
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
10
10
#    not use this file except in compliance with the License. You may obtain
69
69
    def __getattr__(self, attr):
70
70
        try:
71
71
            return self._apidict[attr]
72
 
        except KeyError, e:
 
72
        except KeyError:
73
73
            msg = 'Unknown attribute "%(attr)s" on APIResource object ' \
74
74
                  'of type "%(cls)s"' % {'attr': attr, 'cls': self.__class__}
75
75
            LOG.debug(msg)
90
90
 
91
91
 
92
92
def get_service_from_catalog(catalog, service_type):
93
 
    for service in catalog:
94
 
        if service['type'] == service_type:
95
 
            return service
 
93
    if catalog:
 
94
        for service in catalog:
 
95
            if service['type'] == service_type:
 
96
                return service
96
97
    return None
97
98
 
98
99