whoops replace: plugin_py_template_path = os.path.join(current_app,'static','plugin_plugin','template_plugin_plugin_py')
with: controller_py_template_path = os.path.join(current_app,'static','plugin_plugin','template_plugin_controller_py') sorry... On May 6, 7:31 am, Christopher Steel <[email protected]> wrote: > The effect is similar (but the method is not the same) to creating a > new Web2py application from the Welcome application only we are doing > it with plugins using templates so the new plugin comes with as > standard skeleton which includes menus, plugin_config and plugin admin > users and whatever else you want in the plugins you generate... > > pip install mako > launch web2py > create a new applicationhttp://code.google.com/p/uc-plugin-dev/downloads/ > install the plugin plugin_plugin > reload webpage > go to new menu item called "plugin menu" > choose plugin menu -> plugin options -> create plugin > refresh the web page and now you will have a new menu item called: > plugin_uc_test001 that corresponds to the new plugin in the plugin > section of the Web2py web interface. > > I would love to replace the mako and use the Web2py templating system > instead. It works like this now: > > def ensure_file(path,content=None): > '''If file does not exist create it''' > > def ensure_dir(path): > '''if directory does not exist create it''' > > plugin_py_template_path = > os.path.join(current_app,'static','plugin_plugin','template_plugin_plugin_py') > other templates as desired... > > def create_plugin(): > plugin_name = '' > spacer = '_' > prefix = 'plugin' > cat = 'uc' > flav = 'test001' > plugin_name = prefix + spacer + cat + spacer + flav > controller = os.path.join(current_app,'controllers',plugin_name > + '.py') > controller_py_template = > Template(filename=controller_py_template_path) > controller_py_content = > controller_py_template.render(plugin_name=plugin_name) > ensure_file(controller,content=controller_py_content) > message = ''' > You ran the create_plugin plugin and it probably worked. > If it did you should see a new menu item after refreshing your > browser > ''' > return dict(message=message) > > On May 5, 11:30 pm, Massimo Di Pierro <[email protected]> > wrote: > > > good. > > > I am lost about the second part. What is plugin generator? > > > On May 5, 10:17 pm, Christopher Steel <[email protected]> wrote: > > > > Thanks Massimo, That was a really good call! I think I messed things > > > up while I was creating a prototype for an automated plugin creator > > > made some, um, adjustments so that my generated plugins where really > > > organized, but apparently not functioning as expected because I forgot > > > about that little exception with the model file and not files. LOL, I > > > go t confused trying to make things clearer... > > > > and perhaps I noticed a similar effect when checking out the > > > powerpack, hummm, how very interesting but unexpected. > > > > This is what my plugin generator and the resulting plugins looked like > > > before: > > > > plugin_uc_plugin.py > > > plugin_uc_plugin/initialization.py > > > plugin_uc_plugin/menu.py > > > > in the above case a response.menu += [ bla bla] in plugin_uc_plugin/ > > > menu.py does NOT show up when visiting > > > http://127.0.0.1:8000/app/default/index.html > > > but does show up when > > > visitinghttp://127.0.0.1:8000/app/plugin_uc_plugin/index > > > > If you consolidating the contents of plugin_uc_plugin/menu.py into > > > plugin_uc_plugin.py a response.menu += [ bla bla] will show up > > > inhttp://127.0.0.1:8000/app/default/index.html > > > > I have not experimented with the contents of plugin_uc_plugin/ > > > initialization.py yet but that could be interesting as well... > > > > the test plugin generator, plugin_plugin will generate a plugin called > > > plugin_font_gothic with the following three files in the models if you > > > want to check uut the effect. the menu.py has assignes the menus to > > > response.menu += [ my menus ] as well: > > > > plugin_font_gothic.py > > > plugin_font_gothic/initialization.py > > > plugin_font_gothic/menu.py > > > ... > > > > If you want to check it out the beginnings of a plugin to create > > > plugins you can check it out here for now. if anyone has an idea of > > > how to implement Web2py templates rather than using mako templates I > > > can remove that dependence which could be nice since mako seems to > > > have trouble dealling with two or more hash signs -> ##, for now > > > something like: > > > > pip install mako > > > hg clonehttps://uc-theme-dev.googlecode.com/hg/uc_theme_dev > > > > will get you going. > > > > I will move the plugin here after a little more cleanup. > > > > hg clonehttps://uc-plugin-dev.googlecode.com/hg/uc_plugin_dev > > > > Christopher Steel > > > > On May 5, 9:27 pm, Massimo Di Pierro <[email protected]> > > > wrote: > > > > > I doubt this is an issue with the new import or the new gluon.current > > > > tread local object. > > > > This is probably to the new use of subfolder in models. > > > > Do you have subfolders under models/ ? > > > > > On May 5, 7:52 pm, Christopher Steel <[email protected]> wrote: > > > > > > my menu.py in my plugin no longer show up at the apps index and only > > > > > display "in" the plugin directory. Is this due to the new current > > > > > scope? Is their a way to get this working again or a "current scope" > > > > > toggle ? I have a lot of plugins that use this for menu's so any help > > > > > on this is very appreciated. > > > > > > Thanks, > > > > > > Chris > > > > > > example, before using something like > > > > > > response.menu+= [bla bla] > > > > > > in a plugin added the plugin menu to the main menu and it showed up > > > > > at: > > > > > > http://127.0.0.1:8000/blank/default/index > > > > > > Now it only shows up "in" the plugin, for example here: > > > > > > http://127.0.0.1:8000/blank/plugin_uc_language/index > > > > > > but no longer shows up here: > > > > > > http://127.0.0.1:8000/blank/default/index > > > > > > SO it does not work with 1.95.1 (2011-05-05 15:15:00) > > > > > but does work with 1.95.1 (2011-04-27 ..:..:..) > > > > > > On May 4, 5:29 pm, Bruno Rocha <[email protected]> wrote: > > > > > > > I am testing right now, at this point I have 2 apps running with no > > > > > > problems! > > > > > > > models subfolder, custom importer and current scope are great > > > > > > improvements > > > > > > to web2py, I am waiting to rely on this for the app I am working > > > > > > now. > > > > > > > Thank you Massimo and Jonathan (of course all the other > > > > > > collaborators), > > > > > > @web2py "the framework that evolves every two weeks" > > > > > > > -- > > > > > > Bruno Rocha > > > > > > [ About me:http://zerp.ly/rochacbruno] > > > > > > > On Wed, May 4, 2011 at 6:09 PM, Massimo Di Pierro > > > > > > <[email protected]>wrote: > > > > > > > > Hello everybody.... > > > > > > > > Jonathan and I have been working on an internal web2py rewrite > > > > > > > that while > > > > > > > keeping everything backward compatible will allow you to do this > > > > > > > > ==== modules/mymodule.py > > > > > > > from gluon import * > > > > > > > def f(): return DIV(A(current.request.function,_href=URL())) > > > > > > > ==== end > > > > > > > > ==== default/controller.py > > > > > > > def index(): > > > > > > > from mymodule import f > > > > > > > return dict(div=f()) > > > > > > > ==== end > > > > > > > > Thanks to Pierre we can now import modules from the app local > > > > > > > folder > > > > > > > without local_import and thanks to Jonathan those modules only > > > > > > > need to do > > > > > > > "from gluon import *" to see everything web2py has to offer. This > > > > > > > should > > > > > > > make life easier for Eclipse users too. > > > > > > > > In models/db.py you no longer need to pass globals() to Auth > > > > > > > > auth=Auth(globals(),db) > > > > > > > or > > > > > > > auth=Auth(db) > > > > > > > > both work. > > > > > > > > Also error messages in validators (including default error > > > > > > > messages) should > > > > > > > not be by T(...) by default. > > > > > > > > This is now in trunk but we are still working on it. This means > > > > > > > trunk may > > > > > > > not very stable for the next day or two. > > > > > > > Meanwhile help us test it. In particular help us test if we are > > > > > > > breaking > > > > > > > your apps. > > > > > > > > Massimo > >

