Subversion Repositories SmartDukaan

Rev

Rev 20172 | Rev 20344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20172 Rev 20343
Line 8... Line 8...
8
from email.mime.text import MIMEText
8
from email.mime.text import MIMEText
9
from email.mime.multipart import MIMEMultipart
9
from email.mime.multipart import MIMEMultipart
10
from BeautifulSoup import BeautifulSoup
10
from BeautifulSoup import BeautifulSoup
11
from dtr.utils.utils import ungzipResponse
11
from dtr.utils.utils import ungzipResponse
12
import json
12
import json
-
 
13
import chardet
13
 
14
 
14
con = None
15
con = None
15
parser = optparse.OptionParser()
16
parser = optparse.OptionParser()
16
parser.add_option("-m", "--m", dest="mongoHost",
17
parser.add_option("-m", "--m", dest="mongoHost",
17
                      default="localhost",
18
                      default="localhost",
Line 212... Line 213...
212
            <th>Description</th>
213
            <th>Description</th>
213
            <th>Page Url</th>
214
            <th>Page Url</th>
214
            </tr></thead>
215
            </tr></thead>
215
            <tbody>"""
216
            <tbody>"""
216
    for item in exceptionList:
217
    for item in exceptionList:
-
 
218
        encoding =  chardet.detect(item.pageurl)
-
 
219
        try:
-
 
220
            item.pageurl = item.pageurl.decode(encoding.get('encoding'))
-
 
221
        except:
-
 
222
            item.pageurl = item.pageurl.decode(encoding.get('latin-1'))
217
        message+="""<tr>
223
        message+="""<tr>
218
        <td style="text-align:center">"""+(item.identifier)+"""</td>
224
        <td style="text-align:center">"""+(item.identifier)+"""</td>
219
        <td style="text-align:center">"""+(categoryMap.get(item.category))+"""</td>
225
        <td style="text-align:center">"""+(categoryMap.get(item.category))+"""</td>
220
        <td style="text-align:center">"""+str(item.rank)+"""</td>
226
        <td style="text-align:center">"""+str(item.rank)+"""</td>
221
        <td style="text-align:center">"""+str(item.product_name)+"""</td>
227
        <td style="text-align:center">"""+str(item.product_name)+"""</td>