hi Massimo,

currently the T2 functions depend on data directly from the model, and
this is really convenient in most cases and makes for short controller
functions.
It might be handy if these functions could handle more customization
from the controller.

For example login/registration requires the use of the t2_person table
and the email field. Perhaps the controller interface to login/
register could let the login table and relevant fields be specified,
with t2_person and email as default if none is specified.

I believe you are familiar with Rails, so you know about their
scaffolding. This attracts users to Rails because they can get an
interface working fast. But scaffolding is only suitable for simple
websites, so eventually they will replace this with their own hand
crafted code.
Is that what T2 is intended to do? Get some web2py working fast, and
then when you want more control replace the T2 views with your own
logic?
Or is it more ambitious?

Baron



On Nov 26, 4:24 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> What are you suggesting?
>
> On Nov 25, 11:17 pm, Baron <[EMAIL PROTECTED]> wrote:
>
> > thanks guys for your advice.
>
> > > I would just take the code out of t2itemizeand adapt to your purposes. It 
> > > is relatively small.
> > > I did suggest at the outset (18/11) that creating a new version 
> > > ofitemizewas probably the easiest solution :-).
>
> > As I said I already have my ownitemizefunction. But I'm trying to
> > reuse T2 where practical/possible.
> > Is T2 intended to stay as a link between model and view, or will it be
> > abstracted for the controller?
>
> > Baron
>
> > On Nov 22, 10:15 am, billf <[EMAIL PROTECTED]> wrote:
>
> > > I did suggest at the outset (18/11) that creating a new version of
> > >itemizewas probably the easiest solution :-).
>
> > > The in-memory database was just a response to "how can I pass data to
> > >itemize?" - not a recommendation.
>
> > > On Nov 21, 10:18 pm, "Yarko Tymciurak" <[EMAIL PROTECTED]> wrote:
>
> > > > On Fri, Nov 21, 2008 at 4:15 PM, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > The fact we can store a database in memory does not mean this is the
> > > > > right solution to your problem.
>
> > > > > I would just take the code out of t2itemizeand adapt to your
> > > > > purposes. It is relatively small.
>
> > > > +1
>
> > > > >itemizedoes very very little for you so I doubt you need it.
>
> > > > > Massimo
>
> > > > > On Nov 21, 4:07 pm, Baron <[EMAIL PROTECTED]> wrote:
> > > > > > sorry, I may have my object types wrong.
>
> > > > > > To summarize:
> > > > > > I'm trying to pass data directly to t2.itemize() without having to
> > > > > > write to a database.
>
> > > > > > If I understood right, Bill was hinting that writing to an in-memory
> > > > > > database was the easiest way, so I was wondering what was the harder
> > > > > > alternative way.
> > > > > > I was hoping there was a way to directly instantiate the required
> > > > > > input for t2.itemize() directly without going through a database.
> > > > > > Writing to a temporary in-memory database 'smells' bad for me.
>
> > > > > > For now I've created my ownitemize.
>
> > > > > > Baron
>
> > > > > > On Nov 21, 8:11 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > > > > > What for? SQLTable or SQLTABLE? I am confused.
>
> > > > > > > Massimo
>
> > > > > > > On Nov 20, 3:06 pm, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > The easiest way to construct an SQLTable is to use 
> > > > > > > > > define_table (as
> > > > > in a model like db.py).
>
> > > > > > > > You say 'easiest' - is there an alternative way to instantiate 
> > > > > > > > an
> > > > > > > > SQLTable object?
>
> > > > > > > > On Nov 19, 9:20 pm, billf <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > OK, I see.  The objects passed toitemizeare an SQLTable and,
> > > > > > > > > optionally, an SQLQuery, that basically filters the rows 
> > > > > > > > > returned.
> > > > > > > > > The easiest way to construct an SQLTable is to use 
> > > > > > > > > define_table (as
> > > > > in
> > > > > > > > > a model like db.py).  That's why I was suggesting an in-memory
> > > > > > > > > database which Massimo has now implemented in trunk.
>
> > > > > > > > > So you should be able to say (I haven't tested this and the 
> > > > > > > > > while
> > > > > is
> > > > > > > > > pseudo-code):
>
> > > > > > > > > dbm=SQLDB('sqlite:memory:')
>
> > > > > > > > > dbm.define_table('temp_data',SQLField('temp_field1),SQLField
> > > > > > > > > ('temp_field2'), etc)
>
> > > > > > > > > while creating_temp_data:
> > > > > > > > >   dbm.temp_data.insert(temp_field1='X',temp_field2='Y')
>
> > > > > > > > > t2.itemize(dbm.temp_data)
>
> > > > > > > > > And all the temp data is just held in memory.  Does that help?
>
> > > > > > > > > On Nov 19, 8:49 am, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > > > When you say "these tables are Python objects", I assume 
> > > > > > > > > > > you
> > > > > are
>
> > > > > > > > > > refererring to your temporary data(?)
>
> > > > > > > > > > No, to the table input toitemize. This input is a python 
> > > > > > > > > > object.
> > > > > So
> > > > > > > > > > can this object be instantiated directly without going 
> > > > > > > > > > through a
> > > > > > > > > > database?
>
> > > > > > > > > > On Nov 19, 5:36 pm, billf <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > > > When you say "these tables are Python objects", I assume 
> > > > > > > > > > > you
> > > > > are
> > > > > > > > > > > refererring to your temporary data(?)
>
> > > > > > > > > > > The "detour" above about in-memory tables was just to 
> > > > > > > > > > > provide
> > > > > an
> > > > > > > > > > > alternative to making your ownitemize, i.e.:
> > > > > > > > > > > - define your temp tables as in-memory tables
> > > > > > > > > > > - insert your "rows" instead of appending to your Python
> > > > > objects
> > > > > > > > > > > - pass the in-memory tables to the existingitemize
>
> > > > > > > > > > > (Apologies if that was stating the obvious)
>
> > > > > > > > > > > On Nov 18, 10:48 pm, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > > > > These tables are Python objects, so is there a way to
> > > > > instantiate them
> > > > > > > > > > > > without a database?
>
> > > > > > > > > > > > Otherwise I'll do as you suggest, Bill, and make my own
> > > > >itemize.
> > > > > > > > > > > > Baron
>
> > > > > > > > > > > > On Nov 19, 12:33 am, billf <[EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > > > > > > > > > > I don't think you can - as you sayitemizetakes tables 
> > > > > > > > > > > > > and
> > > > > an
> > > > > > > > > > > > > optional query.  I think you will have to create your 
> > > > > > > > > > > > > own
> > > > > "itemize"
> > > > > > > > > > > > > that works off your results. Looking at T2.itemize, it
> > > > > should not be
> > > > > > > > > > > > > difficult.
>
> > > > > > > > > > > > > Would it be nice if one could create a database and 
> > > > > > > > > > > > > table
> > > > > in ram cache
> > > > > > > > > > > > > (disk cache wouldn't be much better than a 
> > > > > > > > > > > > > conventional
> > > > > temp table?)
> > > > > > > > > > > > > and access it like a normal database.  Maybe that is
> > > > > possible already
> > > > > > > > > > > > > but I don't think so.
>
> > > > > > > > > > > > > On Nov 18, 11:47 am, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > > > > > > hello,
>
> > > > > > > > > > > > > > My app calculates temporary data that I want to 
> > > > > > > > > > > > > > display
> > > > > to the user.
> > > > > > > > > > > > > > There is a lot of it so paginating it with 
> > > > > > > > > > > > > > t2.itemize
> > > > > sounds like a
> > > > > > > > > > > > > > good idea. Butitemizetakes a database table as 
> > > > > > > > > > > > > > input.
>
> > > > > > > > > > > > > > So, I could write the data to a table and then 
> > > > > > > > > > > > > > query it
> > > > > to get the
> > > > > > > > > > > > > > right form, but that would be wasteful. How can I 
> > > > > > > > > > > > > > instead
> > > > > wrap the
> > > > > > > > > > > > > > data directly foritemize?
>
> > > > > > > > > > > > > > thanks,
> > > > > > > > > > > > > > Baron- Hide quoted text -
>
> > > > > > > > > > > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to