{{obj = BEAUTIFY(.....)}}  without the '=' at the front

'=' sign is a shortcut to {{response.write(....)}}

If the modal window is inside the same view, you will be able to do

{{=obj}} or {{response.write(obj)}}

But if that modal is being opened as a popup, that will have its own
context, I mean, it will not be able to access the 'obj' object.

I think its better to define your commom objects at the /model or /modules
layer, then you can access wherever you want.

file /models/mystuff.py
<code>
def myfunction(myargs):
     ....
     ....
     obj = BEAUTIFY(myargs)
     ....
     ....
     return obj
</code>

**depening on the size of your application, it is better to put that in a
external module in /modules, then import to use.

In any place (controller or view) you do:
<code>
{{=myfunction(args)}}
</code>

More on BEAUTIFY is found here:
http://web2py.com/book/default/docstring/BEAUTIFY


Bruno.


2010/10/4 mart <[email protected]>

> Hi :)
>
> so I tried {{=BEAUTIFY(a_string)}}, no change. Then, I thought, I'll
> that the dict obj, pickled somewhere in those DB fileds... unpickled
> it, and passed it as it to {{=BEAUTIFY(obj)}} and got a TABLE!!!! a
> gorgeous table!!  Seems everyday there's something unbelievable to be
> seen! and learned! (i really thought {{=BEAUTIFY}} wanted a string :))
>
> MERCI!!!!!!   :)
>
> One question though: if I have to declare the object (within a
> plugin_wiki page) like {{=obj}} before I can use it, is there a way to
> not have it displayed on the page, since I want to use it in one of
> those modal windows?
>
> Mart :)
>
>
> On Oct 4, 2:36 pm, mdipierro <[email protected]> wrote:
> > did you try
> >
> > {{=BEAUTIFY(yourobject)}}
> >
> > On Oct 4, 1:04 pm, Gary Herron <[email protected]> wrote:
> >
> > > On 10/04/2010 10:50 AM, mart wrote:
> >
> > > > Sorry, bad typing day....
> >
> > > > I need to display some dictionaries, these are generated according to
> > > > DATA provided by the user. I would like to display them on a page,
> but
> > > > need to display them pretty (like with pprint). I am wrapping this
> > > > part of the app in plugin_wiki: I have 4 types of data that that get
> > > > inserted in to a DB once generated that I can use for for this (i
> > > > couldn't decide, so gave myself options):
> >
> > > Do you kow fo the module called pprint (pretty-print).  It comes with
> > > Python, and does a decent job with dictionaries (even nested ones)
> right
> > > out of the box:
> > >      from pprint import pprint
> > >      pprint(...)
> > > If you want further control, you can investigate the module beyond the
> > > simple shortcut pprint function.
> >
> > > > 1) a dictionary (containing other dictionaries embedded within)
> > > > 2) the same dict, but inserted as_string
> > > > 3) the same dict, but wrapped up like an object
> > > > 4) an xml representation of the same dict
> >
> > > > I can write any of these 4 very nicely to the terminal output, or a
> > > > file, but it seems not on a web2py app page... Once displayed, the
> > > > user will understand the 'semantics. does anybody have a trick  for
> > > > displaying like this on a webApp page?
> >
> > > > here is an example of what I am looking for (not sure how this will
> > > > look here, but, apologies in advance if it does look garbled):
> >
> > > > {'resources': {'fileSets': {'fileSet': [{'files': {'file':
> > > > [{'installPath': '${installRoot}',
> > > >
> 'source':
> > > > '../file001.txt'},
> >
> > > > {'installPath': '${installRoot}',
> > > >
> 'source':
> > > > '../file002.txt'}]},
> > > >                                           'rules': {'and':
> {'include':
> > > > {'attribute': 'os',
> >
> > > > 'match': 'symbian'},
> > > >                                                             'or':
> > > > {'include': [{'attribute': 'osver',
> >
> > > > 'match': 's60'},
> >
> > > > {'attribute': 'os',
> >
> > > > 'match': 's60fp3'}]}},
> > > >                                                     'exclude':
> > > > {'attribute': 'osver',
> >
> > > > 'macth': 'DontIncludeMe'}}},
> > > >                                          {'files': {'file':
> > > > [{'installPath': '${installRoot}',
> > > >
> 'source':
> > > > '../file003.txt'},
> >
> > > > {'installPath': '${installRoot}',
> > > >
> 'source':
> > > > '../file004.txt'}]},
> > > >                                           'rules': {'and':
> {'include':
> > > > {'attribute': 'os',
> >
> > > > 'match': 'symbian'},
> > > >                                                             'or':
> > > > {'include': {'attribute': 'os',
> >
> > > > 'match': 's60fp3'}}}}}]},
> > > >                 'includeFiles': {'_text': '/',
> > > >                                  'includeFile': {'path': '../aFolder/
> > > > file_man.xml'}},
> > > >                 'packages': {'package': [{'deviceModel': 'Nokia6630',
> > > >                                           'installRoot':
> '/mart/private/
> > > > 20008421/mo',
> > > >                                           'name': 'package001',
> > > >                                           'os': 'symbian',
> > > >                                           'osver': 's60'},
> > > >                                          {'deviceModel': 'Nokia6630',
> > > >                                           'installRoot':
> '/mart/private/
> > > > 20008421/mo',
> > > >                                           'name': 'package002',
> > > >                                           'os': 'symbian',
> > > >                                           'osver': 's60
> >
> > > > On Oct 4, 9:29 am, mart<[email protected]>  wrote:
> >
> > > >> Hi,
> >
> > > --
> > > Gary Herron, PhD.
> > > Department of Computer Science
> > > DigiPen Institute of Technology
> > > (425) 895-4418
> >
> >
>



-- 

http://rochacbruno.com.br

Reply via email to