diff options
author | Tom Rondeau <trondeau@vt.edu> | 2011-05-02 12:35:16 +0100 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2011-05-02 12:35:16 +0100 |
commit | 207a2ae73bd5d6cab201bb57ed8db64fd54cfd90 (patch) | |
tree | 3a828f115fdf011b7f78e45d75c45b7c4912a046 /grc/base/Connection.py | |
parent | 7a91b8226f71d75b027beb466f965bbba97c07a8 (diff) | |
parent | a92cb89b5529728d9fce781aff85916b3879fbdd (diff) |
Merge branch 'mergeme/grc/cross_platform_work'
Diffstat (limited to 'grc/base/Connection.py')
-rw-r--r-- | grc/base/Connection.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/grc/base/Connection.py b/grc/base/Connection.py index 94d4751b28..3ce7fd07f9 100644 --- a/grc/base/Connection.py +++ b/grc/base/Connection.py @@ -1,5 +1,5 @@ """ -Copyright 2008, 2009 Free Software Foundation, Inc. +Copyright 2008-2011 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -37,10 +37,12 @@ class Connection(Element): for port in (porta, portb): if port.is_source(): source = port if port.is_sink(): sink = port - assert(source and sink) + if not source: raise ValueError('Connection could not isolate source') + if not sink: raise ValueError('Connection could not isolate sink') #ensure that this connection (source -> sink) is unique for connection in self.get_parent().get_connections(): - assert not (connection.get_source() is source and connection.get_sink() is sink) + if connection.get_source() is source and connection.get_sink() is sink: + raise Exception('This connection between source and sink is not unique.') self._source = source self._sink = sink @@ -62,8 +64,8 @@ class Connection(Element): Element.validate(self) source_type = self.get_source().get_type() sink_type = self.get_sink().get_type() - try: assert source_type == sink_type - except AssertionError: self.add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type)) + if source_type != sink_type: + self.add_error_message('Source type "%s" does not match sink type "%s".'%(source_type, sink_type)) def get_enabled(self): """ |