~divmod-dev/divmod.org/no-addperson-2190

« back to all changes in this revision

Viewing changes to Imaginary/TRDemo/diff

  • Committer: exarkun
  • Date: 2006-02-26 02:37:39 UTC
  • Revision ID: svn-v4:866e43f7-fbfc-0310-8f2a-ec88d1da2979:trunk:4991
Merge move-pottery-to-trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: imagination/facets.py
 
2
===================================================================
 
3
--- imagination/facets.py       (revision 179)
 
4
+++ imagination/facets.py       (working copy)
 
5
@@ -24,7 +24,14 @@
 
6
     for interfaceClass in interfaceClasses:
 
7
         self.register([origInterface], interfaceClass, '', adapterFactory)
 
8
 
 
9
+def _hook(iface, ob, lookup=registry.lookup1):
 
10
+    factory = lookup(declarations.providedBy(ob), iface)
 
11
+    if factory is None:
 
12
+        return None
 
13
+    else:
 
14
+        return factory(ob)
 
15
 
 
16
+interface.adapter_hooks.append(_hook)
 
17
 _nope = object()
 
18
 
 
19
 class IReprable(Interface):
 
20
Index: imagination/wiring/web.py
 
21
===================================================================
 
22
--- imagination/wiring/web.py   (revision 179)
 
23
+++ imagination/wiring/web.py   (working copy)
 
24
@@ -12,7 +12,7 @@
 
25
 from nevow import rend
 
26
 from nevow.loaders import stan
 
27
 from nevow.tags import *
 
28
-from nevow.livepage import handler, glue, literal
 
29
+from nevow.liveevil import handler, glue, literal
 
30
 from nevow import entities
 
31
 
 
32
 getinput = literal.getinput
 
33
Index: imagination/simdata.py
 
34
===================================================================
 
35
--- imagination/simdata.py      (revision 179)
 
36
+++ imagination/simdata.py      (working copy)
 
37
@@ -98,11 +98,11 @@
 
38
             map[iface] = (map[iface][0], lazy(map[iface][1], kw))
 
39
         return ThingTemplate(templateMap=map, order=order)
 
40
 
 
41
-    def apply(self, method, *args, **kw):
 
42
+    def apply(self, methodClass, methodName, *args, **kw):
 
43
         map = self.templateMap.copy()
 
44
         order = self.order[:]
 
45
         order.append(
 
46
-            lazyApply(method.im_class, method.im_func.func_name, args, kw))
 
47
+            lazyApply(methodClass, methodName, args, kw))
 
48
         return ThingTemplate(templateMap=map, order=order)
 
49
 
 
50
     def copy(self):
 
51
Index: imagination/architecture.py
 
52
===================================================================
 
53
--- imagination/architecture.py (revision 179)
 
54
+++ imagination/architecture.py (working copy)
 
55
@@ -87,8 +87,9 @@
 
56
 
 
57
     def iterImplementors(self, interface):
 
58
         if self.closed:
 
59
-            selfish = interface(self, default=None)
 
60
-            if selfish is None:
 
61
+            try:
 
62
+                selfish = interface(self)
 
63
+            except TypeError: 
 
64
                 return iter([])
 
65
             return iter([selfish])
 
66
         else:
 
67
Index: sandbox/simplemap.py
 
68
===================================================================
 
69
--- sandbox/simplemap.py        (revision 179)
 
70
+++ sandbox/simplemap.py        (working copy)
 
71
@@ -25,17 +25,17 @@
 
72
     name="Gamma",
 
73
     description=("This room is visible through a transparent door.")).new()
 
74
 
 
75
-passage = basic.Portal.apply(architecture.IExit.between, room, room2).fill(
 
76
+passage = basic.Portal.apply(architecture.IExit, 'between', room, room2).fill(
 
77
     INoun, name="Fancy Passageway Between Alpha and Omega").new()
 
78
 
 
79
 door = basic.Door.fill(
 
80
     INoun, name="Door"
 
81
-    ).apply(architecture.IExit.between, room2, room3).new()
 
82
+    ).apply(architecture.IExit, 'between', room3, room3).new()
 
83
 
 
84
 door2 = basic.Door.fill(INoun, name="glass door"
 
85
                         ).fill(
 
86
     architecture.IExit, transparent=True).apply(
 
87
-    architecture.IExit.between, room, room4).new()
 
88
+    architecture.IExit, 'between', room, room4).new()
 
89
 
 
90
 
 
91
 book1 = basic.Book.fill(containment.ILocatable, location=room).fill(