[Community] Replacing code from ZCO 0.7.1 in ZCO 0.7.0 in Overview.py?

Kai Hänninen kai.hanninen at mbconcert.fi
Thu Apr 6 00:11:18 EEST 2006


Hi Jagadish

The ZCO 0.7.0 code assumes that there is a MapRenderer instance with an 
id 'mapper' available in the acquisition context that it can use to 
render the overview. If you've used the createPrimaGISDemo script you 
should have such a MapRenderer instance in your system. For some reason 
or another this does not seem to be the case for you though and that is 
why you get an AttributeError.

More recent versions of ZCO come with a CMF compatible tool called 
'portal_gis' that provides the map rendering services of MapRenderer. 
This means that ZCO needs to be installed using the portal_quickinstall 
tool (which the PrimaGIS installer will do automatically for you).

I would suggest you try out the latest releases for both ZCO and 
PrimaGIS if this is possible. You can download them from

   http://www.gispython.org/downloads/zope/

ZCO is currently at version 0.7.2 and PrimaGIS at 0.5.1. If this is not 
an option then you need to provide the MapRenderer instance in you ZODB 
that the overview can use.

--Kai




Jagadish Metla wrote:
>    Hi all,
> 
> I am trying to run PrimaGIS 0.5.0 on ZCO 0.7.0 and trying to figure out the error :
> 
> "C:\Program Files\Plone 2\Data\Products\ZCO\overview.py", line 55, in overview
>       m = self.mapper
>   'attribute error: mapper'
> 
> (event.log is listed at the bottom of this mail)
>  
> I've noticed that the code at the error location (line 55 in overview.py) in ZCO 0.7.0 is changed in the 0.7.1 release. So, I tried manually replacing  it without success, but  I doubt that the error could be sorted with some correction there. Could someone make better sense out of those changes and suggest me what I might have to correct? 
> 
> 
> # symbolizer.py in zco 0.7.0 has:
> 
>     def overview(self, width=64, height=64, format='image/png;mode=RGB', bgcolor='#ffffff'):
>         """Return a thumbnail picture of the layer"""         
>         m = self.mapper
>         image = m.draw(self, format=format, size=[int(width), int(height)], 
>                        bgcolor=bgcolor)
> 
>         self.REQUEST.RESPONSE.setHeader('Content-type', image.mimetype)
>         return image.getdata()
> -----------------------------------------
> 
> # which is replaced in zco 0.7.1 as:
> 
>     def overview(self, width=64, height=64, format='image/png;mode=RGB', bgcolor='#ffffff'):
>         """Return a thumbnail picture of the layer"""
>         m =  getattr(self,
>                     'mapper',
>                     getattr(self, 'portal_gis'))
>         image = m.draw(self, format=format, size=[int(width), int(height)], 
>                        bgcolor=bgcolor)
> 
>         self.REQUEST.RESPONSE.setHeader('Content-type', image.mimetype)
>         return image.getdata()
> 
> ----------------------------------------------
> # and overview.py in zco.07.0 has:
> 
>         # acquire MapRenderer from the environment 
>         m =  self.mapper
>         store = self.getDataStore()
> 
> -----------------------------------------
> 
> # which is replaced in zco 0.7.1 as:
> 
>         # acquire MapRenderer from the environment
>         try:
>             m = self.mapper
>         except AttributeError:
>             m = self.portal_gis
> 
>         store = self.getDataStore()
> ---------------------------------------------------------------
> Is 'portal_gis' added in  PrimaGIS 0.5.1 and so not available in PrimaGIS 0.5.0?.
> 
> thank you in advance,
> Jagadish
> 
>  
> ps: This is what I have in my event.log:
>  2006-04-03T22:21:20 ERROR(200) SiteError  http://localhost:8080/Plone/demo/primagis/world_borders/view
>  Traceback (most recent call last):
>    File "C:\Program Files\Plone  2\Zope\lib\python\ZPublisher\Publish.py", line 101, in publish
>      request, bind=1)
>    File "C:\Program Files\Plone 2\Zope\lib\python\ZPublisher\mapply.py", line 88, in mapply
>      if debug is not None: return debug(object,args,context)
>    File "C:\Program Files\Plone 2\Zope\lib\python\ZPublisher\Publish.py", line 39, in call_object
>      result=apply(object,args) # Type s<cr> to step into published object.
>    File "C:\Program Files\Plone 2\Data\Products\PrimaGIS\PrimaGISLayer.py", line 129, in view
>      height=height)
>    File "C:\Program Files\Plone 2\Data\Products\ZCO\overview.py", line 55, in overview
>      m = self.mapper
>  'attribute error: mapper'
> 		
> ---------------------------------
> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1&cent;/min.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Community mailing list
> Community at lists.gispython.org
> http://lists.gispython.org/mailman/listinfo/community


-- 
Kai Hänninen                  +358-50-558-7935
Software engineer             www.mbconcert.fi
MB Concert Ky                 kai.hanninen at mbconcert.fi



More information about the Community mailing list