-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move test_bot_Bot to test_bot, add a FakeRemote utility class
- Loading branch information
Dustin J. Mitchell
committed
Aug 16, 2010
1 parent
9b375f3
commit 404ae5d
Showing
2 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from twisted.internet import defer | ||
|
||
class FakeRemote: | ||
""" | ||
Wrap a local object to make it look like it's remote | ||
""" | ||
def __init__(self, original, method_prefix="remote_"): | ||
self.original = original | ||
self.method_prefix = method_prefix | ||
|
||
def callRemote(self, meth, *args, **kwargs): | ||
fn = getattr(self.original, self.method_prefix + meth) | ||
return defer.maybeDeferred(fn, *args, **kwargs) |