Ignore:
Timestamp:
Nov 1, 2010 5:50:32 PM (14 years ago)
Author:
mylan
Message:

Merged 3.0.5 to 3.0.7 changes from trunk into plone-4 branch version.

Merged revisions 3942-3945,3966-3976,3982-3983,3994 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.seoptimizer/trunk

........

r3942 | mylan | 2010-10-20 17:06:46 +0300 (Wed, 20 Oct 2010) | 1 line


#233: Bump version to 3.0.7, updated history

........

r3943 | olha | 2010-10-20 17:14:52 +0300 (Wed, 20 Oct 2010) | 1 line


HISTORY.txt checked

........

r3944 | olha | 2010-10-20 17:20:15 +0300 (Wed, 20 Oct 2010) | 1 line


internal README file updated

........

r3945 | mylan | 2010-10-20 18:16:14 +0300 (Wed, 20 Oct 2010) | 1 line


#233: Updated list of supported version in README.txt to 3.1+

........

r3966 | mylan | 2010-10-26 17:33:27 +0300 (Tue, 26 Oct 2010) | 1 line


#233: Reduce catch exceptions to URLError and HTTPError, log error to error_log, return link to error_log

........

r3967 | mylan | 2010-10-26 17:34:03 +0300 (Tue, 26 Oct 2010) | 1 line


#233: Update tests for catching errors on keywords calculation

........

r3968 | mylan | 2010-10-26 17:55:15 +0300 (Tue, 26 Oct 2010) | 1 line


#233: Make code more readable

........

r3969 | mylan | 2010-10-26 18:08:15 +0300 (Tue, 26 Oct 2010) | 1 line


#233: Force to get portal_transforms as utility

........

r3970 | mylan | 2010-10-26 18:14:46 +0300 (Tue, 26 Oct 2010) | 1 line


#233: little cleanup

........

r3971 | mylan | 2010-10-26 20:35:28 +0300 (Tue, 26 Oct 2010) | 1 line


#233: Force logging keywords calculation to nearest to context error_log object. Other minor fixes

........

r3972 | mylan | 2010-10-26 21:08:06 +0300 (Tue, 26 Oct 2010) | 1 line


#233: Return getting error_log with getToolByName as more flexible and accurate

........

r3973 | mylan | 2010-10-27 18:09:31 +0300 (Wed, 27 Oct 2010) | 1 line


#233: Correct HISTORY information

........

r3974 | mylan | 2010-10-27 18:16:40 +0300 (Wed, 27 Oct 2010) | 1 line


#233: Added plone.browserlayer to requirements for Plone-3.0 support

........

r3975 | mylan | 2010-10-27 18:18:13 +0300 (Wed, 27 Oct 2010) | 1 line


#233: Fixed testcases to emulate proper test environment for plone-3.0

........

r3976 | mylan | 2010-10-27 18:21:55 +0300 (Wed, 27 Oct 2010) | 1 line


#233: Described steps for use the package with plone-3.0.

........

r3982 | olha | 2010-10-29 13:16:55 +0300 (Fri, 29 Oct 2010) | 1 line


doc files corrected a bit

........

r3983 | olha | 2010-10-29 13:20:45 +0300 (Fri, 29 Oct 2010) | 1 line


wrong line spacing corrected

........

r3994 | mylan | 2010-11-01 16:59:34 +0200 (Mon, 01 Nov 2010) | 1 line


Removed devloper settings of the package configuration

........

Location:
quintagroup.seoptimizer/branches/plone4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/branches/plone4

    • Property svn:mergeinfo
      •  

        old new  
        11/quintagroup.seoptimizer/branches/refactoring2.3.0:1776-2133 
        2 /quintagroup.seoptimizer/trunk:2435-2440,2885-2901 
         2/quintagroup.seoptimizer/trunk:2435-2440,2885-2901,2903-2955 
    • Property svnmerge-integrated changed from /quintagroup.seoptimizer/trunk:1-3478,3480-3513,3515-3631,3633-3940 /quintagroup.seoptimizer/branches/refactoring2.3.0:1-3174 to /quintagroup.seoptimizer/trunk:1-3478,3480-3513,3515-3631,3633-3996 /quintagroup.seoptimizer/branches/refactoring2.3.0:1-3174
  • quintagroup.seoptimizer/branches/plone4/quintagroup/seoptimizer/browser/keywords.py

    r2902 r2958  
    1 import re, commands, urllib2 
     1import re, sys, urllib2 
    22from xml.dom import Node 
    33 
    44from zope.interface import implements 
     5from zope.component import getUtility 
    56from zope.component import queryAdapter 
    6 from zope.component import queryMultiAdapter 
     7 
     8from Acquisition import aq_acquire 
    79from Products.Five.browser import BrowserView 
    810 
     11from Products.CMFCore.utils import getToolByName 
    912from Products.CMFPlone.utils import safe_unicode, getSiteEncoding 
    10 from Products.CMFCore.utils import getToolByName 
     13from Products.PortalTransforms.interfaces import IPortalTransformsTool 
    1114 
    1215from interfaces import IValidateSEOKeywordsView 
     
    2225        text = self.request.get('text') 
    2326        ts = getToolByName(self.context, 'translation_service') 
    24         transforms = getToolByName(self.context, 'portal_transforms') 
     27        transforms = getUtility(IPortalTransformsTool) 
    2528        portal = getToolByName(self.context, 'portal_url').getPortalObject() 
    2629        isExternal = queryAdapter(portal, ISEOConfigletSchema).external_keywords_test 
     
    3538                                 context=self.context) 
    3639        # Get html page internally or with external request 
     40        error_url = "" 
    3741        if isExternal: 
    3842            # Not pass timeout option because: 
    39             # 1. its value get from the global default timeout settings by default. 
     43            # 1. its value get from the global default timeout settings. 
    4044            # 2. timeout option added in python 2.6 (so acceptable only in plone4+) 
    4145            try: 
     46                resp = urllib2.urlopen(self.context.absolute_url()) 
    4247                try: 
    43                     resp = urllib2.urlopen(self.context.absolute_url()) 
    4448                    html = resp.read() 
    4549                finally: 
    46                     'resp' in locals().keys() and resp.close() 
    47             except Exception: 
     50                    resp.close() 
     51            except (urllib2.URLError, urllib2.HTTPError), e: 
    4852                # In case of exceed timeout period or other URL connection errors. 
     53                # Get nearest to context error_log object (stolen from Zope2/App/startup.py) 
    4954                html = None 
     55                info = sys.exc_info() 
     56                elog = getToolByName(self.context, "error_log") 
     57                error_url = elog.raising(info) 
    5058        else: 
    5159            html = unicode(self.context()).encode(enc) 
     
    5361        # If no html - information about problem with page retrieval should be returned 
    5462        result = [] 
    55         if html is not None: 
     63        if html is None: 
     64            result.append("Problem with page retrieval.") 
     65            if error_url: 
     66                result.append("Details at %s." % error_url) 
     67        else: 
    5668            page_text = transforms.convert("html_to_text", html).getData() 
    5769            # check every keyword on appearing in body of html page 
     
    5971                keyword_on_page = unicode(len(re.findall(u'\\b%s\\b' % keyword, page_text, re.I|re.U))) 
    6072                result.append(' - '.join((keyword, keyword_on_page))) 
    61         else: 
    62             result.append("Problem with page retrieval") 
    6373 
    6474        return ts.utranslate(domain='quintagroup.seoptimizer', 
Note: See TracChangeset for help on using the changeset viewer.