2011/1/23 Alex Mandel <tech_...@wildintellect.com>

> On 01/22/2011 03:26 PM, Alessandro Pasotti wrote:
> > 2011/1/22 Gary Sherman <gsher...@geoapt.com>
> >
> >> On 1/22/11 8:57 AM, Alessandro Pasotti wrote:
> >>
> >>> 2011/1/22 Gary Sherman <gsher...@geoapt.com <mailto:
> gsher...@geoapt.com>>
> >>>
> >>>
> >>>    On 1/22/11 1:25 AM, Alessandro Pasotti wrote:
> >>>
> >>>        2011/1/22 Paolo Cavallini <cavall...@faunalia.it
> >>>        <mailto:cavall...@faunalia.it>
> >>>        <mailto:cavall...@faunalia.it <mailto:cavall...@faunalia.it>>>
> >>>
> >>>
> >>>
> >>>            Il giorno ven, 21/01/2011 alle 19.37 +0100, Alessandro
> >>>        Pasotti ha
> >>>            scritto:
> >>>
> >>>         > The missing piece was the authentication bridge with OSGEO.
> >>>
> >>>            AFAIK this is now working. If so, what prevents us from
> setting
> >>>            everything in place?
> >>>            All the best.
> >>>
> >>>
> >>>
> >>>        I'was able to login with my osgeo credentials but I couldn't
> >>>        upload a
> >>>        plugin: it fails with permission denied on the folder where the
> >>>        plugin
> >>>        files should reside.
> >>>
> >>>        Somebody with root access to the server should fix it.
> >>>
> >>>        [Errno 13] Permission denied:
> >>>        '********************/qgis/static/packages'
> >>>
> >>>    The validation of plugin packages doesn't work properly for all
> >>>    packages. My plugin that uploads and validates find on the "old"
> repo
> >>>    (pyqgis.org <http://pyqgis.org>) fails on the new site:
> >>>
> >>>
> >>>    File upload must be a valid QGIS Python plugin compressed archive.
> >>>    Cannot find __init__.py in the compressed package: this does not
> >>>    seems a valid plugin (I searched for
> pluginbuilder/Makefile__init__.py)
> >>>
> >>>    Looks like it is munging things together that shouldn't be....
> >>>
> >>>
> >>>
> >
> > Your plugin loads without errors on my dev environment (I cannot
> reproduce
> > the issue).
> >
> > I will try on the server tomorrow.
> >
> > In the meantime, I've opened a project on redmine for the django site.
> >
>
> It appears that relying on the 1st item in the zip to always be
> packagename.zip just isn't 100% reliable. My metaedit plugin fails that
> test in python but is clearly formatted correctly when extracted or
> downloaded by qgis. I did test in python by hand too and metaedit/ isn't
> in the namelist at all for some reason even though the folder is there
> when the package is extracted.
>
> Here are some possible ways to change the validator
> namelist[0].split('/') to grab whatever is before the /
> or package.split('.') to grab the name of the zip minus the ext
> - There are several other ways to do this in python with the os and path
> modules, or slicing. The nice part about package.split is that you could
> save both the packagename and ext to test if the ext is zip
>
> packagename,ext = package.split('.')
>
>
Thanks Alex,

I agree, but this would be a different check:

the intention was to check that *inside* the zip there is a folder with name
= package_name, non to check that the zip file is named package_name.

Perhaps I misunderstood the specs, but I guess that the plugin zip file
could be whatever name we like (for example I name my zipfiles with the
version postfix such as QuickWKT_0.1.zip, QuickWKT_0.2.zip etc. etc.), what
I wanted to check is that inside the zip there is a folder named
package_name (in this example "QuickWKT").


I changed the line to


        # Checks that package_name/__init__.py exists
        namelist = zip.namelist()
        try:
            package_name = namelist[0][:namelist[0].index('/')]
        except:
            raise ValidationError( _("Cannot find a folder inside the
compressed package: this does not seems a valid plugin") )



this should make it more robust


-- 
Alessandro Pasotti
w3:   www.itopen.it
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to