Permalink
Browse files

Fix some relative imports for libification

  • Loading branch information...
1 parent b557365 commit 951b728851af26f9c2c692e2cdb1f0890ceb2cd3 Andrew Fleenor committed Jul 17, 2012
Showing with 16 additions and 10 deletions.
  1. +1 −1 pcap2har/http/request.py
  2. +11 −5 pcap2har/http/response.py
  3. +2 −2 pcap2har/tcp/direction.py
  4. +1 −1 pcap2har/tcp/flow.py
  5. +1 −1 pcap2har/tcp/packet.py
View
@@ -1,6 +1,6 @@
import urlparse
#import dpkt.http this is buggy
-import dpkt_http_replacement as dpkt_http
+from .. import dpkt_http_replacement as dpkt_http
import message as http
class Request(http.Message):
View
@@ -1,21 +1,27 @@
import gzip
import zlib
import cStringIO
-import dpkt_http_replacement as dpkt_http
+from .. import dpkt_http_replacement as dpkt_http
import common as http
import message
-from mediatype import MediaType
+from ..mediatype import MediaType
import logging as log
-import settings
+from .. import settings
#from http import DecodingError # exception class from parent module
from base64 import encodestring as b64encode
-# try to import UnicodeDammit from BeautifulSoup
+# try to import UnicodeDammit from BeautifulSoup,
+# starting with system and defaulting to included version
# otherwise, set the name to None
try:
- from BeautifulSoup import UnicodeDammit
+ try:
+ from BeautifulSoup import UnicodeDammit
+ except ImportError:
+ from ..BeautifulSoup import UnicodeDammit
except ImportError:
UnicodeDammit = None
+ log.warning('Can\'t find BeautifulSoup, unicode is more likely to be '
+ 'misinterpreted')
class Response(message.Message):
'''
@@ -1,8 +1,8 @@
-from sortedcollection import SortedCollection
+from ..sortedcollection import SortedCollection
import chunk as tcp
from operator import itemgetter, attrgetter
import logging as log
-import settings
+from .. import settings
import packet
class Direction:
View
@@ -2,7 +2,7 @@
import common as tcp
import seq # hopefully no name collisions
-from sortedcollection import SortedCollection
+from ..sortedcollection import SortedCollection
from dpkt.tcp import *
import logging as log
View
@@ -1,5 +1,5 @@
import dpkt
-from pcaputil import *
+from ..pcaputil import *
class Packet(object):
'''

0 comments on commit 951b728

Please sign in to comment.