I agree with you.

On Feb 19, 5:52 pm, luckyboy <[email protected]> wrote:
> Thanks, your answer was good enough.
> About the statement "I do not expect and I would not want objects that
> are not stored in
> database to expose the same API as if they were.", well, sometimes you
> might want to do that. For example, what if some of your models are
> just proxies for their mirror remote persistent classes that are
> exposed via a set of web services. Or your data store may be a remote
> store (like Amazon's S3) and needn't to be a relational database at
> all. Of course you then need to override ORM implementation of these
> APIs but still you should be able to this in a way that is seamless to
> your controller.
>
> On Feb 19, 4:57 pm, mdipierro <[email protected]> wrote:
>
> > Yes and no.
>
> > Not sure how EJB3 works so I cannot answer yes and no. I can tell you
> > what you can do.
>
> > 1) you can define classes
>
> >     class MyObj:
> >        def say_three(self): return 3
>
> > 2) you can make instances of the class persistent in various ways by
> > storing in cache
>
> >     myobj=cache.ram('myobj',lambda: MyObj(),timeout)
>
> > 3) you can make instanced persistant for each session
>
> >     if not session.myobj: session.myobj=MyObj()
>
> > 4) You can make in memory databases
>
> >     db=SQBD('sqlite:memory:')
> >     db.define_table('table_in_ram',SQLField('fieldname'))
>
> > and you can import/export the data.
>
> >     import cStringIO
> >     file=cStringIO.String()
> >     db.table_in_ram.export_to_csv_file(file)
> >     file.seek(0)
> >     db.table_in_ram.truncate()
> >     db.table_in_ram.import_form_csv_file(file)
>
> > Not sure how this compares with what you have in mind.
>
> > I do not expect and I would not want objects that are not stored in
> > database to expose the same API as if they were.
>
> > If you can give me a  more explicit example perhaps I can give a
> > better answer.
>
> > Massimo
>
> > On Feb 19, 2:50 pm, luckyboy <[email protected]> wrote:
>
> > > Does web2py support non-persistent model classes ? ie, a core model
> > > class where some business logic can be performed while that class
> > > doesn't necessarily (directly) map to a database table ?
> > > For example the model data can be retrieved from a remote web service,
> > > or a set of remote queries ?
> > > In all other MVC frameworks this is possible: In EJB3.0, unless you
> > > declare model as @entity it is not persistent. In RAILS, you can
> > > simply not inherit from ActiveRecord, and you may need to implement
> > > some methods like find, etc.. , or you can use a plugin like
> > > ActiveModel. Is this doable in web2py? My first guess is no.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to