Hi

I was trying to learn how to use plugins, so the filename could be
totally wrong. It was just a small test file not a real plugin.

I have discovered that you can't use subfolders in controller and
views. My later attempt was /controller/plugin_cart.py and /views/
plugin_cart/show.html

Thanks for creating a good Python framework. I love it.

Br.
Rune


On 6 Nov., 16:02, mdipierro <[email protected]> wrote:
> will look into this but I do not understand this file:
>
> plugin_init/default/index.html
>
> It does not look like a plugin file. If it is a view it should be
>
> views/plugin_init/index.html
>
> On Nov 6, 5:20 am, "Mr. Electronic" <[email protected]> wrote:
>
> > Hi
>
> > I tried to create a plugin and then delete the one file that was in
> > the plugin. Then I recieves an error ticket shown below.
>
> > I created a file with name plugin_init/default/index.html and then
> > clicked on the init plugin in the bottom of the init screen, looked at
> > the file and then deleted it.
>
> > Then it crashes and I think it has something do with that the plugin
> > disappears when the last file has been deleted but the admin still
> > tries to show all files that contains to the non existing plugin.
>
> > Br.
> > Mr. Electronic
>
> > Ticket 83.89.69.186.2010-11-06.11-11-12.9954ddbe-b9e6-4424-93d4-
> > ed8ea601a010
>
> > Version
> > web2py Version 1.88.2 (2010-10-29 23:04:43)
>
> > Error traceback
>
> > 1.
> > 2.
> > 3.
> > 4.
> > 5.
> > 6.
> > 7.
> > 8.
> > 9.
> > 10.
> > 11.
> > 12.
>
> > Traceback (most recent call last):
> >   File "/home/6dstudio/web2py/gluon/restricted.py", line 188, in
> > restricted
> >     exec ccode in environment
> >   File "/home/6dstudio/web2py/applications/admin/controllers/
> > default.py", line 1134, in <module>
> >   File "/home/6dstudio/web2py/gluon/globals.py", line 96, in <lambda>
> >     self._caller = lambda f: f()
> >   File "/home/6dstudio/web2py/applications/admin/controllers/
> > default.py", line 807, in plugin
> >     models=filter_plugins(models),
> >   File "/home/6dstudio/web2py/applications/admin/controllers/
> > default.py", line 803, in filter_plugins
> >     regex=re.compile('^plugin_'+plugin+'(/.*|\..*)?$')
> > TypeError: cannot concatenate 'str' and 'NoneType' objects
>
> > Error snapshot
> > Detailed traceback description
>
> >     * Exception: <type 'exceptions.TypeError'>(cannot concatenate
> > 'str' and 'NoneType' objects)
> >       Exception instance attributes
> >           o __setattr__: <method-wrapper '__setattr__' of
> > exceptions.TypeError object>
> >           o __reduce_ex__: <built-in method __reduce_ex__ of
> > exceptions.TypeError object>
> >           o __getslice__: <method-wrapper '__getslice__' of
> > exceptions.TypeError object>
> >           o __getitem__: <method-wrapper '__getitem__' of
> > exceptions.TypeError object>
> >           o __setstate__: <built-in method __setstate__ of
> > exceptions.TypeError object>
> >           o __getattribute__: <method-wrapper '__getattribute__' of
> > exceptions.TypeError object>
> >           o __str__: <method-wrapper '__str__' of exceptions.TypeError
> > object>
> >           o args: ("cannot concatenate 'str' and 'NoneType' objects",)
> >           o __reduce__: <built-in method __reduce__ of
> > exceptions.TypeError object>
> >           o __format__: <built-in method __format__ of
> > exceptions.TypeError object>
> >           o __class__: <type 'exceptions.TypeError'>
> >           o __dict__: {}
> >           o __delattr__: <method-wrapper '__delattr__' of
> > exceptions.TypeError object>
> >           o __subclasshook__: <built-in method __subclasshook__ of
> > type object>
> >           o __repr__: <method-wrapper '__repr__' of
> > exceptions.TypeError object>
> >           o __init__: <method-wrapper '__init__' of
> > exceptions.TypeError object>
> >           o __hash__: <method-wrapper '__hash__' of
> > exceptions.TypeError object>
> >           o __sizeof__: <built-in method __sizeof__ of
> > exceptions.TypeError object>
> >           o __doc__: 'Inappropriate argument type.'
> >           o __unicode__: <built-in method __unicode__ of
> > exceptions.TypeError object>
> >           o __new__: <built-in method __new__ of type object>
> >     * Python 2.6.5: /usr/bin/python
>
> > File /home/6dstudio/web2py/gluon/restricted.py in restricted at line
> > 188
> > [ code | arguments | variables ]
> > Function argument list: (code='# coding: utf8 \n\nfrom gluon.admin
> > import *\nfrom ...r(e)))\n\n\nresponse._vars=response._caller(plugin)
> > \n', environment={'A': <class 'gluon.html.A'>, 'ALLOW_TOGGLE': 'true',
> > 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class
> > 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR':
> > <class 'gluon.html.BR'>, 'CENTER': <class 'gluon.html.CENTER'>,
> > 'CHECK_VERSION': True, 'CLEANUP': <class 'gluon.validators.CLEANUP'>,
> > 'CODE': <class 'gluon.html.CODE'>, ...}, layer='/home/6dstudio/web2py/
> > applications/admin/controllers/default.py')
>
> > 183.
> > 184.
> > 185.
> > 186.
> > 187.
> > 188.
>
> > 189.
> > 190.
> > 191.
> > 192.
>
> >         if type(code) == types.CodeType:
> >             ccode = code
> >         else:
> >             ccode = compile2(code,layer)
>
> > exec ccode in environment
>
> >     except HTTP:
> >         raise
> >     except Exception:
> >         # XXX Show exception in Wing IDE if running in debugger
>
> >     * environment: {'A': <class 'gluon.html.A'>, 'ALLOW_TOGGLE':
> > 'true', 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class
> > 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR':
> > <class 'gluon.html.BR'>, 'CENTER': <class 'gluon.html.CENTER'>,
> > 'CHECK_VERSION': True, 'CLEANUP': <class 'gluon.validators.CLEANUP'>,
> > 'CODE': <class 'gluon.html.CODE'>, ...}
> >     * ccode: <code object <module> at 0x7f8b441c9e40, file
> > "/...plications/admin/controllers/default.py", line 3>
>
> > File /home/6dstudio/web2py/applications/admin/controllers/default.py
> > in <module> at line 1134
> > [ code | arguments | variables ]
> > Function argument list: ()
>
> > 1123.
> > 1124.
> > 1125.
> > 1126.
> > 1127.
> > 1128.
> > 1129.
> > 1130.
> > 1131.
> > 1132.
>
> >     session.forget()
> >     session._unlock(response)
> >     import gluon.tools
> >     import gluon.contrib.simplejson as sj
> >     try:
> >         page = gluon.tools.fetch('http://twitter.com/web2py?
> > format=json')
> >         return sj.loads(page)['#timeline']
> >     except Exception, e:
> >         return DIV(T('Unable to download because'),PRE(str(e)))
>
> > File /home/6dstudio/web2py/gluon/globals.py in <lambda> at line 96
> > [ code | arguments | variables ]
> > Function argument list: (f=<function plugin>)
>
> > 91.
> > 92.
> > 93.
> > 94.
> > 95.
> > 96.
>
> > 97.
> > 98.
> > 99.
> > 100.
>
> >         self.flash = ''           # used by the default view layout
> >         self.meta = Storage()     # used by web2py_ajax.html
> >         self.menu = []            # used by the default view layout
> >         self.files = []           # used by web2py_ajax.html
> >         self._vars = None
> > self._caller = lambda f: f()
>
> >         self._view_environment = None
> >         self._custom_commit = None
> >         self._custom_rollback = None
>
> >     * self: undefined
> >     * f: <function plugin>
>
> > File /home/6dstudio/web2py/applications/admin/controllers/default.py
> > in plugin at line 807
> > [ code | arguments | variables ]
> > Function argument list: ()
>
> > 802.
> > 803.
> > 804.
> > 805.
> > 806.
> > 807.
>
> > 808.
> > 809.
> > 810.
> > 811.
>
> >     def filter_plugins(items):
> >         regex=re.compile('^plugin_'+plugin+'(/.*|\..*)?$')
> >         return [item for item in items if regex.match(item)]
>
> >     return dict(app=app,
> > models=filter_plugins(models),
>
> >                 defines=defines,
> >                 controllers=filter_plugins(controllers),
> >                 functions=functions,
> >                 views=filter_plugins(views),
>
> >     * models: []
> >     * filter_plugins: <function filter_plugins>
>
> > File /home/6dstudio/web2py/applications/admin/controllers/default.py
> > in filter_plugins at line 803
> > [ code | arguments | variables ]
> > Function argument list: (items=[])
>
> > 798.
> > 799.
> > 800.
> > 801.
> > 802.
> > 803.
>
> > 804.
> > 805.
> > 806.
> > 807.
>
> >     if not os.path.exists(crontab):
> >         safe_open(crontab,'w').write('#crontab')
>
> >     def filter_plugins(items):
> > regex=re.compile('^plugin_'+plugin+'(/.*|\..*)?$')
>
> >         return [item for item in items if regex.match(item)]
>
> >     return dict(app=app,
> >                 models=filter_plugins(models),
>
> >     * regex: undefined
> >     * global re: <module 're' from '/usr/lib/python2.6/re.pyc'>
> >     * re.compile: <function compile>
> >     * plugin: None
>
> > locals
> > locals
> > items   :
> > []
> > plugin  :
> > None
> > request
> > request
> > ajax    :
> > False
> > application     :
> > 'admin'
> > args    :
> > ['init']
> > body    :
> > <cStringIO.StringO object>
> > cid     :
> > None
> > client  :
> > '83.89.69.186'
> > controller      :
> > 'default'
> > cookies :
> > <SimpleCookie: session_id_admin='83-89-69-186-8f...-89-69-186-3db8d937-
> > c1ef-4c43-931f-54e267fb56a9'>
> > env     :
> > <Storage {'mod_wsgi_listener_host': '', 'mod_wsg...t',
> > 'mod_wsgi_process_group': '6dstudio-web2py'}>
> > extension       :
> > 'html'
> > folder  :
> > '/home/6dstudio/web2py/applications/admin/'
> > function        :
> > 'plugin'
> > get_vars        :
> > <Storage {}>
> > now     :
> > datetime.datetime(2010, 11, 6, 11, 11, 12, 5040)
> > post_vars       :
> > <Storage {}>
> > raw_args        :
> > 'init'
> > url     :
> > <gluon.html.XML object>
> > vars    :
> > <Storage {}>
> > wsgi    :
> > <Storage {'start_response': <function <lambda> a...te', 'PATH_INFO': '/
> > admin/default/plugin/init'}}>
> > session
> > session
> > authorized      :
> > True
> > check_version   :
> > False
> > flash   :
> > None
> > last_time       :
> > 1289038272.010576
> > pam_user        :
> > None
> > response
> > response
> > body    :
> > <cStringIO.StringO object>
> > cookies :
> > <SimpleCookie: session_id_admin='83-89-69-186-8f06e290-c2a4-42ed-
>
> ...
>
> læs mere »

Reply via email to