What you return from your function does not get passed to the view. Rather,
if your function returns a dict, then the items in the dict are added to
the global environment available to the view. If you want to create a
storage object and pass it to the view, then the storage object should be
an item within a dict:
def myfunc():
mystorage = Storage(...)
return dict(mystorage=mystorage)
Then in the view, you can refer to the mystorage object. From your code,
it's not clear what you're trying to make into a Storage object or why, so
I'm not sure how this translates onto what you are doing.
Anthony
On Sunday, August 12, 2012 9:57:48 PM UTC-4, Jaymin Oh wrote:
>
> def show_event():
> event_id = request.vars['event_id']
> event_record = db.event(event_id)
>
> # Check if event exists
> if not event_record:
> raise HTTP(400, 'No event found')
>
> # Check if it's member
> return Storage(event=event_record.as_dict())
>
> -----------
>
> http://localhost:8000/test/show_event.json?event_id=4
>
> When I call the above address, it says
>
> <type 'exceptions.TypeError'>('NoneType' object is not callable)
>
> If I change the last line to "return dict(event=event_record.as_dict())",
> then it works.
>
> I want to use event_record as Storage in my view.
>
> Please help me with this issue.
>
--