Dude...wait, what? what proposal?
mdipierro wrote: > Me too but I need more time to look into details... today is not the > optimal day. Tim, could you email me your proposals so that it does > not get list in the list? > > Massimo > > On Jan 8, 2:54 pm, "Yarko Tymciurak" <yark...@gmail.com> wrote: > >> Yep, Robin - saw your other post on this.... I'm liking the direction this >> is going... thanks! >> Yarko >> >> On Thu, Jan 8, 2009 at 1:36 PM, Robin B <robi...@gmail.com> wrote: >> >> >>> Very true. This is more general than t2, I just dislike adding so >>> many symbols to the global namespace, so this could be added to a >>> helpers.* object if it existed. >>> >>> The reason for this proposal is that currently you cannot import >>> actions easily: >>> >>> # in controllers/default.py >>> from modules.crud import create >>> >>> The create action will not be found because actions are currently >>> found with a regex. >>> >>> Robin >>> >>> On Jan 8, 1:19 pm, "Yarko Tymciurak" <yark...@gmail.com> wrote: >>> >>>> Let me double check to make sure: >>>> >>>> this behavior - non-argumented controllers being exposed / accessible >>>> >>> from >>> >>>> a client - is not (only) t2; this is general web2py behavior, >>>> >>>> correct? >>>> >>>> On Thu, Jan 8, 2009 at 1:15 PM, Yarko Tymciurak <yark...@gmail.com> >>>> >>> wrote: >>> >>>>> yep - after reading that thread Robin pointed to at the head of this >>>>> thread, the space behavior definitely looks like an expedient hack... >>>>> >>>>> and reading the response from Massimo there: >>>>> "If you have >>>>> function that does not take *arguments* and you still don't want to >>>>> expose it you can also use a trick..." >>>>> >>>>> I'm with Robin - forget the "tricks" and be explicit... but, as I >>>>> suspected, the usual intent is expose no-argument controllers, so the >>>>> exceptional case calls for a decorator, a better name than I originally >>>>> posted: >>>>> >>>>> @not_exposed >>>>> def myfunc(): >>>>> #blah, blah, ... >>>>> >>>>> On Thu, Jan 8, 2009 at 10:55 AM, Robin B <robi...@gmail.com> wrote: >>>>> >>>>>> Massimo, >>>>>> >>>>>>> Not sure I undestand. This goes in a module? not a model? >>>>>>> >>>>>> The example shows that it can go in either or both. >>>>>> >>>>>> You could put it in a module and then import it into a controller to >>>>>> import actions into one specific controller. You could put it in a >>>>>> model to add an action to all controllers. >>>>>> >>>>>> The first time a controller is requested, the controller is exec'ed, >>>>>> the resulting environment is searched for functions of no args that >>>>>> have the specific attr that was set by the decorator, these actions >>>>>> are merged with the actions found with the regex. All the possible >>>>>> controller_action.pyc is compiled and stored like usual, now you can >>>>>> call actions that were created in the models or imported from a module >>>>>> (crud, resources, admin, stats etc). >>>>>> >>>>>> Robin >>>>>> >>>>>> On Jan 8, 7:20 am, mdipierro <mdipie...@cs.depaul.edu> wrote: >>>>>> >>>>>>> Not sure I undestand. This goes in a module? not a model? >>>>>>> >>>>>>> On Jan 8, 12:03 am, Robin B <robi...@gmail.com> wrote: >>>>>>> >>>>>>>> Controller functions taking arguments, or functions with an extra >>>>>>>> space like def index (): are hidden: >>>>>>>> >>> http://groups.google.com/group/web2py/browse_thread/thread/35c15761dc. >>> >>>>>> .. >>>>>> >>>>>>>> This is good that you can hide functions somehow, but using only a >>>>>>>> regex to detect controller functions requires people to copy-paste >>>>>>>> common actions into every controller (bad). >>>>>>>> >>>>>>>> Could a controller be loaded, and its symbols that are functions >>>>>>>> checked for a tag (attribute) indicating that they are also >>>>>>>> >>> exposed. >>> >>>>>>>> This way you can import actions/functions in the models and in the >>>>>>>> individual controllers. >>>>>>>> >>>>>>>> Proposal: continue to use the regex for backwards compatibility, >>>>>>>> >>> but >>> >>>>>>>> also expose functions that are explicitly tagged as exposed by >>>>>>>> >>> some >>> >>>>>>>> decorator. >>>>>>>> >>>>>>>> Examples: >>>>>>>> >>>>>>>> # in models/0.py >>>>>>>> @T2.decorators.expose >>>>>>>> def stats(): >>>>>>>> return 'stats' >>>>>>>> >>>>>>>> # in modules/crud.py >>>>>>>> @T2.decorators.expose >>>>>>>> def update(): >>>>>>>> return 'update' >>>>>>>> >>>>>>>> # in controllers/posts.py >>>>>>>> from modules.crud import * >>>>>>>> >>>>>>>> It would be fully backwards compatible! >>>>>>>> >>>>>>>> Feedback? >>>>>>>> >>>>>>>> Robin >>>>>>>> > > > -- Timothy Farrell <tfarr...@swgen.com> Computer Guy Statewide General Insurance Agency (www.swgen.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---