Skip to content

Commit

Permalink
Exclude the lastupdate variable from the name-clash check in `Synap…
Browse files Browse the repository at this point in the history
…ses` -- otherwise `Synapses` targetting `Synapses` are not possible
  • Loading branch information
mstimberg committed Mar 17, 2015
1 parent e67cfb2 commit 2cbc635
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions brian2/synapses/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,10 @@ def _create_variables(self, equations, user_dtype=None):
# Add all the pre and post variables with _pre and _post suffixes
for name in getattr(self.source, 'variables', {}).iterkeys():
# Raise an error if a variable name is also used for a synaptic
# variable
if name in equations.names:
error_msg = ('The post-synaptic variable {name} has the same '
# variable (we ignore 'lastupdate' to allow connections from another
# Synapses object)
if name in equations.names and name != 'lastupdate':
error_msg = ('The pre-synaptic variable {name} has the same '
'name as a synaptic variable, rename the synaptic '
'variable ').format(name=name)
if name+'_syn' not in self.variables:
Expand All @@ -936,9 +937,10 @@ def _create_variables(self, equations, user_dtype=None):
source=self.source.name))
for name in getattr(self.target, 'variables', {}).iterkeys():
# Raise an error if a variable name is also used for a synaptic
# variable
if name in equations.names:
error_msg = ("The pre-synaptic variable '{name}' has the same "
# variable (we ignore 'lastupdate' to allow connections to another
# Synapses object)
if name in equations.names and name != 'lastupdate':
error_msg = ("The post-synaptic variable '{name}' has the same "
"name as a synaptic variable, rename the synaptic "
"variable ").format(name=name)
if name+'_syn' not in self.variables:
Expand Down

0 comments on commit 2cbc635

Please sign in to comment.