Author: hwright
Date: Tue Aug  3 22:08:06 2010
New Revision: 982047

URL: http://svn.apache.org/viewvc?rev=982047&view=rev
Log:
Stub out a couple of other file types, and use a complete item (rather than
just the content) when determining the file type.

Modified:
    labs/mouse/match.py

Modified: labs/mouse/match.py
URL: 
http://svn.apache.org/viewvc/labs/mouse/match.py?rev=982047&r1=982046&r2=982047&view=diff
==============================================================================
--- labs/mouse/match.py (original)
+++ labs/mouse/match.py Tue Aug  3 22:08:06 2010
@@ -19,6 +19,7 @@
 #
 '''The match module for Mouse.'''
 
+import guesser
 
 
 class UnknownResult(object):
@@ -28,13 +29,48 @@ class UnknownResult(object):
     self.license_family = '?????'
     self.license_approved = False
     self.type_name = 'standard'
+    self.include_sample = True
 
   @staticmethod
-  def match(content):
+  def match(item):
     return True
 
 
+class NoticeResult(object):
+
+  def __init__(self):
+    self.type_name = 'notice'
+
+  @staticmethod
+  def match(item):
+    return False
+
+
+class ArchiveResult(object):
+
+  def __init__(self):
+    self.type_name = 'archive'
+
+  @staticmethod
+  def match(item):
+    return False
+
+
+class BinaryResult(object):
+
+  def __init__(self):
+    self.type_name = 'binary'
+
+  @staticmethod
+  def match(item):
+    return False
+
+
 _match_order = [
+    NoticeResult,
+    ArchiveResult,
+    BinaryResult,
+
     # we don't need UnknownResult in this list, since it will be returned
     # from do_match() by default.
     # UnknownResult,
@@ -46,7 +82,7 @@ def do_match(item):
      if the content of item matches that class, instantiate and return the
      result.'''
   for m in _match_order:
-    if m.match(item.get_content()):
+    if m.match(item):
       return m()
 
   return UnknownResult()



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to