Index: /trunk/AutoAttach/autoattach/handler.py
===================================================================
--- /trunk/AutoAttach/autoattach/handler.py	(revision 39)
+++ /trunk/AutoAttach/autoattach/handler.py	(revision 40)
@@ -1,12 +1,11 @@
+from trac.attachment import Attachment
 from trac.core import Component, implements
 from trac.wiki.api import IWikiMacroProvider
-from trac.attachment import Attachment
 import os
-from trac.env import IEnvironmentSetupParticipant
 
 _inbox = 'inbox'
 
 class Handler(Component):
-    implements(IWikiMacroProvider, IEnvironmentSetupParticipant)
+    implements(IWikiMacroProvider)
     
     #IWikiMacroProvider methods
@@ -27,20 +26,13 @@
             if attachment.filename in newfiles:
                 newfiles.remove(attachment.filename) # avoid overwrite
-        this_page.author = __package__
+        if len(newfiles) == 0:
+            return
         for filename in newfiles:
-            filepath = os.path.join(path, filename)
-            stat = os.stat(filepath)
-            this_page.insert(filename, file(filepath), stat.st_size)
+            fullpath = os.path.join(path, filename)
+            if not os.path.isfile(fullpath):
+                continue # skip it
+            stat = os.stat(fullpath)
+            this_page = Attachment(self.env, parent.realm, parent.id)
+            this_page.author = __package__ # attacher name
+            this_page.insert(filename, file(fullpath), stat.st_size)
             self.log.debug('ATTACHED NEW FILE: %s' % filename)
-   
-    # IEnvironmentSetupParticipant methods
-    def environment_created(self):
-        """Create the inbox directory."""
-        if self.env.path:
-            os.mkdir(os.path.join(self.env.path, _inbox))
-
-    def environment_needs_upgrade(self, db):
-        return False
-
-    def upgrade_environment(self, db):
-        pass
