proxy.py (3101:6cce868ddaa6) proxy.py (3105:993f1abefd67)
1# Copyright (c) 2004-2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 27 unchanged lines hidden (view full) ---

36class BaseProxy(object):
37 def __init__(self, search_self, search_up):
38 self._search_self = search_self
39 self._search_up = search_up
40 self._multiplier = None
41
42 def __setattr__(self, attr, value):
43 if not attr.startswith('_'):
1# Copyright (c) 2004-2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 27 unchanged lines hidden (view full) ---

36class BaseProxy(object):
37 def __init__(self, search_self, search_up):
38 self._search_self = search_self
39 self._search_up = search_up
40 self._multiplier = None
41
42 def __setattr__(self, attr, value):
43 if not attr.startswith('_'):
44 raise AttributeError, 'cannot set attribute on proxy object'
44 raise AttributeError, \
45 "cannot set attribute '%s' on proxy object" % attr
45 super(BaseProxy, self).__setattr__(attr, value)
46
47 # support multiplying proxies by constants
48 def __mul__(self, other):
49 if not isinstance(other, (int, long, float)):
50 raise TypeError, "Proxy multiplier must be integer"
51 if self._multiplier == None:
52 self._multiplier = other

--- 141 unchanged lines hidden ---
46 super(BaseProxy, self).__setattr__(attr, value)
47
48 # support multiplying proxies by constants
49 def __mul__(self, other):
50 if not isinstance(other, (int, long, float)):
51 raise TypeError, "Proxy multiplier must be integer"
52 if self._multiplier == None:
53 self._multiplier = other

--- 141 unchanged lines hidden ---