On Thu, Jan 8, 2009 at 12:03 AM, Robin B <[email protected]> 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/35c15761dc3801e7/b0ee7945e272922e?lnk=gst&q=arguments+space+#b0ee7945e272922e > > This is good that you can hide functions somehow, but using only a
Well - explicit is better, so this is also BAD! ... too obtuse, clever, tricky, hidden... > > 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' Explicit is better, but I wonder if this is the right (most useful) idiom??? I would think that normally, one would assume what they write will NOT be hidden, so perhaps a more useful pattern is @T2.decorators.hidden def stats(): return 'stats' Are there other explicit ways to accomplish this? Let's have some more thought, ideas around this. FWIW - I would not worry about backward compatiblity on this until all the most useful alternatives are considered; then we can balance the improvement, vs. compatibility. Yarko. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

