[web2py:37920] cache.increment

2009-12-27 Thread Thadeus Burgess
def increment(self, key, value=1):
self.locker.acquire()
try:
if key in self.storage:
value = self.storage[key][1] + value
self.storage[key] = (time.time(), value)
except BaseException, e:
self.locker.release()
raise e
self.locker.release()
return value

Isn't that supposed to be self.storage[key][0] ??

If you look at

if f is None:
return None
if item and (dt == None or item[0] > time.time() - dt):
return item[1]
value = f()

self.locker.acquire()
self.storage[key] = (time.time(), value)
self.locker.release()
return value

value is of course what is returned by f(). and that is in index 1 of
the list. So the increment member is actually taking the value
(results) and adding value to them. I don't think this is what is
intended?

Where is increment used?

-Thadeus

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37919] Re: Multiple DB keys in from pull down menu

2009-12-27 Thread mdipierro
First of all let me congratulate for the clear format of your
question.
This line:

db.report.from_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
%(version)s')# Again, I want a set, not a list.

does not display the cartesian product of name and version but only a
list of name, version for every record in db.version. Some entries are
repeated because name+version is not a unique key of db.version.

As I see it this is a logical problem.

The table version contains a link between an application version and a
component version. It basically implements a many-2-many relation but
without a source table. The missing source table is the one you want
to reference in from_id. The source table is a table that contains
lists of application name,version and all entries are unique.

My suggestion is change the model:

db.define_table('application',
Field('name'),
Field('version'),
format='%(name)s %(version)s')
#make sure name+version is unique for applications
db.application.version.requires=IS_NOT_IN_DB(db
(db.application.name==request.vars.name),db.application.version)

db.define_table('component',
Field('name'),
Field('version'(,
Field('label'),
format='%(name)s %(version)s')
)
#make sure name+version is unique + components
db.component.version.requires=IS_NOT_IN_DB(db
(db.component.name==request.vars.name),db.component.version)

db.define_table('usage',
Field('application_id', db.application),
Field('component_id', db.component))

db.define_table('report',
Field('from_id', db.application),
Field('to_id', db.application))

If you use 1.74.4 and the format attribute you do not need to set any
of the IS_IN_DB validators. I think this will be what you want. The
tables "applicaiton" and "usage" replace your table "version".

On Dec 27, 9:18 pm, Christopher Helck 
wrote:
> I apologize if this is more of a DB question than a web2py question, but I'm
> having trouble with populating a drop down menu in the admin interface. I
> have a table (called 'version')  with two keys ('name'  and 'version') and a
> third column 'component_id'. This table records which versions of an
> application use which software component: Example data:
>
>    Name, Version, Component
>    credit, 1.0.0      commons_all_1.2
>    credit, 1.0.1,     commons_all_1.3
>    credit, 1.0.0      commons_pools_6.3
>    credit, 1.0.1,     commons_pools_6.5
>
> Interpretaion: The credit application 1.0.0 uses commons_all_1.2 and
> commons_pools_6.3
>                     The credit application 1.0.1 uses commons_all_1.3 and
> commons_pools_6.5
>
> The problem occurs when I reference the version table from another table.
> The drop down list contains:
>       credit 1.0.0
>       credit 1.0.0
>       credit 1.0.1
>       credit 1.0.1
>
> I want the drop down menu to display the set {name, version}, instead of the
> cartisian product of the two keys. Here's my db.py:
>
> db.define_table('component',
>     Field('component_name'),
>     Field('component_version'),
>     Field('label'))
>
> db.define_table('version',
>     Field('name'),
>     Field('version'),
>     Field('component_id', db.component))
>
> db.define_table('report',
>     Field('from_id', db.version),            # Drop down menu has cartisian
> product of version.name X version.version
>     Field('to_id', db.version))
>
> db.version.component_id.requires = IS_IN_DB(db, db.component.id,
> '%(component_name)s %(component_version)s')
> db.report.from_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
> %(version)s')    # Again, I want a set, not a list.
> db.report.to_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
> %(version)s')
>
> Thanks,
> C. helck

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37918] Multiple DB keys in from pull down menu

2009-12-27 Thread Christopher Helck
I apologize if this is more of a DB question than a web2py question, but I'm
having trouble with populating a drop down menu in the admin interface. I
have a table (called 'version')  with two keys ('name'  and 'version') and a
third column 'component_id'. This table records which versions of an
application use which software component: Example data:

   Name, Version, Component
   credit, 1.0.0  commons_all_1.2
   credit, 1.0.1, commons_all_1.3
   credit, 1.0.0  commons_pools_6.3
   credit, 1.0.1, commons_pools_6.5

Interpretaion: The credit application 1.0.0 uses commons_all_1.2 and
commons_pools_6.3
The credit application 1.0.1 uses commons_all_1.3 and
commons_pools_6.5

The problem occurs when I reference the version table from another table.
The drop down list contains:
  credit 1.0.0
  credit 1.0.0
  credit 1.0.1
  credit 1.0.1

I want the drop down menu to display the set {name, version}, instead of the
cartisian product of the two keys. Here's my db.py:

db.define_table('component',
Field('component_name'),
Field('component_version'),
Field('label'))

db.define_table('version',
Field('name'),
Field('version'),
Field('component_id', db.component))

db.define_table('report',
Field('from_id', db.version),# Drop down menu has cartisian
product of version.name X version.version
Field('to_id', db.version))

db.version.component_id.requires = IS_IN_DB(db, db.component.id,
'%(component_name)s %(component_version)s')
db.report.from_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
%(version)s')# Again, I want a set, not a list.
db.report.to_id.requires = IS_IN_DB(db, db.version.id, '%(name)s
%(version)s')

Thanks,
C. helck

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37917] Re: a problem with gluon.shell.env

2009-12-27 Thread mdipierro
How do you insert the row?
The commit goes after you insert the row.

Massimo

On Dec 27, 8:15 pm, 王怀玉  wrote:
> i had done as your advice.
>
> no change at all .
> you can try it by yourself.
>
> thank you very very much !
>
> 在2009-12-27,mdipierro  写道:
>
> >If I understand the problem, you need to do
>
> >db.commit()
>
> >On Dec 27, 3:45 am, 王怀玉  wrote:
> >> to reuse model definition in a module, so i use gluon.shell.env .
> >> code in module is like this:
> >>   module code start ###
> >> os.chdir(/path/to/web2py/)
> >> from gluon.shell import env
> >> globals().update(env('my_application_name', import_models=True))
> >> while True:
> >> print "count", db(db.mytable.id>0).count()
> >> ### no change at all when i insert a row into db.mytable
> >> time.sleep(5)
> >>   module code end ###
> >> then, execute the module. the problem is that when a row is inserted into 
> >> db.mytable, the result printed by module doesn't change at all.
>
> >> how can i solve this ? thank you very much !
>
> >--
>
> >You received this message because you are subscribed to the Google Groups 
> >"web2py-users" group.
> >To post to this group, send email to web...@googlegroups.com.
> >To unsubscribe from this group, send email to 
> >web2py+unsubscr...@googlegroups.com.
> >For more options, visit this group 
> >athttp://groups.google.com/group/web2py?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re:[web2py:37916] Re: a problem with gluon.shell.env

2009-12-27 Thread 王怀玉
i had done as your advice. 

no change at all .
you can try it by yourself.

thank you very very much !

在2009-12-27,mdipierro  写道:
>If I understand the problem, you need to do
>
>db.commit()
>
>On Dec 27, 3:45 am, 王怀玉  wrote:
>> to reuse model definition in a module, so i use gluon.shell.env .
>> code in module is like this:
>>   module code start ###
>> os.chdir(/path/to/web2py/)
>> from gluon.shell import env
>> globals().update(env('my_application_name', import_models=True))
>> while True:
>> print "count", db(db.mytable.id>0).count()
>> ### no change at all when i insert a row into db.mytable
>> time.sleep(5)
>>   module code end ###
>> then, execute the module. the problem is that when a row is inserted into 
>> db.mytable, the result printed by module doesn't change at all.
>>
>> how can i solve this ? thank you very much !
>
>--
>
>You received this message because you are subscribed to the Google Groups 
>"web2py-users" group.
>To post to this group, send email to web...@googlegroups.com.
>To unsubscribe from this group, send email to 
>web2py+unsubscr...@googlegroups.com.
>For more options, visit this group at 
>http://groups.google.com/group/web2py?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37915] Re: interesting issue and a proposal

2009-12-27 Thread mdipierro
Yes. The values of virtualfields are not stored in the database. They
are computed every time a record is extracted.

In the above case the values are computed when a record is inserted
and they are stored in the database. In RDBS this is not really a good
idea but you may need it in non relational DBs like GAE.

Massimo



On Dec 27, 5:30 pm, Mengu  wrote:
> is there any difference with this and our virtualfields?
>
> On 28 Aralık, 00:39, mdipierro  wrote:
>
> > It was easy to add it to the current DAL (will work on GAE too)
>
> > massimo-di-pierros-macbook:web2py mdipierro$ python web2py.py -S
> > welcome>>> db=DAL('sqlite://storage.sqlite')
> > >>> db.define_table('a',Field('b'),Field('c',compute=lambda r: 
> > >>> r['b'].lower()))
> > >>> db.a.insert(b='HELLO')
> > >>> for row in db(db.a.id>0).select(): print row.b, row.c
> > HELLO hello
> > >>> db(db.a.id>0).update(b='WORLD')
> > >>> for row in db(db.a.id>0).select(): print row.b, row.c
>
> > WORLD world
>
> > On Dec 27, 4:16 pm, mdipierro  wrote:
>
> > > This thread
>
> > >http://groups.google.com/group/google-appengine-python/browse_thread/...
>
> > > raises an interesting issue and proposes an interesting solution that
> > > works on GAE.
>
> > > Executive summary: In GAE you can define computed fields that are
> > > computed now when data is extracted but when data is stored and the
> > > computed fields are stored too. Why? Because you can use them to
> > > perform operation that would otherwise not be supported on GAE.
>
> > > It would be trivial to support this in web2py and make it cross-db.
> > > Basically all we need is a new field attribute that points to a
> > > function that computes the value of a field based on the values of the
> > > other fields. We already have this db.table.field.update and it can be
> > > a function.
>
> > > I think the new DAL should support this.
>
> > > Massimo
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37914] Re: interesting issue and a proposal

2009-12-27 Thread Mengu
is there any difference with this and our virtualfields?

On 28 Aralık, 00:39, mdipierro  wrote:
> It was easy to add it to the current DAL (will work on GAE too)
>
> massimo-di-pierros-macbook:web2py mdipierro$ python web2py.py -S
> welcome>>> db=DAL('sqlite://storage.sqlite')
> >>> db.define_table('a',Field('b'),Field('c',compute=lambda r: 
> >>> r['b'].lower()))
> >>> db.a.insert(b='HELLO')
> >>> for row in db(db.a.id>0).select(): print row.b, row.c
> HELLO hello
> >>> db(db.a.id>0).update(b='WORLD')
> >>> for row in db(db.a.id>0).select(): print row.b, row.c
>
> WORLD world
>
> On Dec 27, 4:16 pm, mdipierro  wrote:
>
>
>
> > This thread
>
> >http://groups.google.com/group/google-appengine-python/browse_thread/...
>
> > raises an interesting issue and proposes an interesting solution that
> > works on GAE.
>
> > Executive summary: In GAE you can define computed fields that are
> > computed now when data is extracted but when data is stored and the
> > computed fields are stored too. Why? Because you can use them to
> > perform operation that would otherwise not be supported on GAE.
>
> > It would be trivial to support this in web2py and make it cross-db.
> > Basically all we need is a new field attribute that points to a
> > function that computes the value of a field based on the values of the
> > other fields. We already have this db.table.field.update and it can be
> > a function.
>
> > I think the new DAL should support this.
>
> > Massimo

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37913] Re: sad without buttons

2009-12-27 Thread Thadeus Burgess
Its the principle of the thing!

I do like my buttons. They are special!

-Thadeus





On Sun, Dec 27, 2009 at 3:51 PM, mdipierro  wrote:
> TAG.BUTTON
>
> you can can make any helper you need with TAG.anything
>
> On Dec 27, 2:48 pm, Thadeus Burgess  wrote:
>> Hrm... no BUTTON helper :*(
>>
>> -Thadeus
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37912] Re: internatinalization for auth fields

2009-12-27 Thread Frank
mdipierro  writes:

> 
> db.auth_user.password.label=T('The Password')
> >
> --
> 
it works, thanks,
Frank





--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37911] Re: interesting issue and a proposal

2009-12-27 Thread mdipierro
It was easy to add it to the current DAL (will work on GAE too)

massimo-di-pierros-macbook:web2py mdipierro$ python web2py.py -S
welcome
>>> db=DAL('sqlite://storage.sqlite')
>>> db.define_table('a',Field('b'),Field('c',compute=lambda r: r['b'].lower()))
>>> db.a.insert(b='HELLO')
>>> for row in db(db.a.id>0).select(): print row.b, row.c
HELLO hello
>>> db(db.a.id>0).update(b='WORLD')
>>> for row in db(db.a.id>0).select(): print row.b, row.c
WORLD world


On Dec 27, 4:16 pm, mdipierro  wrote:
> This thread
>
> http://groups.google.com/group/google-appengine-python/browse_thread/...
>
> raises an interesting issue and proposes an interesting solution that
> works on GAE.
>
> Executive summary: In GAE you can define computed fields that are
> computed now when data is extracted but when data is stored and the
> computed fields are stored too. Why? Because you can use them to
> perform operation that would otherwise not be supported on GAE.
>
> It would be trivial to support this in web2py and make it cross-db.
> Basically all we need is a new field attribute that points to a
> function that computes the value of a field based on the values of the
> other fields. We already have this db.table.field.update and it can be
> a function.
>
> I think the new DAL should support this.
>
> Massimo

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37910] interesting issue and a proposal

2009-12-27 Thread mdipierro
This thread

http://groups.google.com/group/google-appengine-python/browse_thread/thread/ceebac3397625019#

raises an interesting issue and proposes an interesting solution that
works on GAE.

Executive summary: In GAE you can define computed fields that are
computed now when data is extracted but when data is stored and the
computed fields are stored too. Why? Because you can use them to
perform operation that would otherwise not be supported on GAE.

It would be trivial to support this in web2py and make it cross-db.
Basically all we need is a new field attribute that points to a
function that computes the value of a field based on the values of the
other fields. We already have this db.table.field.update and it can be
a function.

I think the new DAL should support this.

Massimo

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37909] Re: sad without buttons

2009-12-27 Thread mdipierro
TAG.BUTTON

you can can make any helper you need with TAG.anything

On Dec 27, 2:48 pm, Thadeus Burgess  wrote:
> Hrm... no BUTTON helper :*(
>
> -Thadeus

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37908] Re: DAL, transactions

2009-12-27 Thread mdipierro
Web2py does have the equivalent of SQLAlchemy sessions.

When a request arrives web2py creates a new database connection object
or pools an existing connection from a connection pool, then it
creates a cursor object. All db IO in the request is done via the
cursor object. This is thread-safe in the sense that the cursor is
only used in one thread. As soon as the request completes, the
transaction is committed or rolled back and the connection is closed
or recycled.

You can pass the db object to a thread and use it in another thread
BUT you must make sure that the other thread is joined before the
request is returned and autocommit is done.

Massimo

On Dec 27, 2:50 pm, Thadeus Burgess  wrote:
> Just curious in how it works in web2py. In SQLAlchemy sessions are
> thread safe.. so uncommitted transactions are accessible from other
> threads.
>
> -Thadeus
>
> On Sun, Dec 27, 2009 at 1:44 PM, mdipierro  wrote:
> > You can commit db.commit() and db.rollback() explicitly. Just do it
> > when you need.
>
> > The concept of cross-thread transaction is not well defined and would
> > be very unsafe. Perhaps if you tell us what you are tring to achieve
> > we can suggest a better way.
>
> > On Dec 27, 10:29 am, Thadeus Burgess  wrote:
> >> Is it possible to disable auto_commit() so that it must be explicitly 
> >> called?
>
> >> And are the Transactions shared between threads? Or must they be
> >> committed to be seen in other threads?
>
> >> -Thadeus
>
> >> On Sun, Dec 27, 2009 at 9:38 AM, Vasile Ermicioi  wrote:
> >> > any changes in DAL about GAE transactions?
>
> >> > On Sun, Dec 27, 2009 at 5:35 PM, mdipierro  
> >> > wrote:
>
> >> >> yes
>
> >> >> On Dec 27, 5:55 am, Thadeus Burgess  wrote:
> >> >> > Does the DAL perform all queries on a transaction basis... that
> >> >> > happens to commit() at the end of a successful request? and on an
> >> >> > error the transaction is rolled back?
>
> >> >> > -Thadeus
>
> >> >> --
>
> >> >> You received this message because you are subscribed to the Google 
> >> >> Groups
> >> >> "web2py-users" group.
> >> >> To post to this group, send email to web...@googlegroups.com.
> >> >> To unsubscribe from this group, send email to
> >> >> web2py+unsubscr...@googlegroups.com.
> >> >> For more options, visit this group at
> >> >>http://groups.google.com/group/web2py?hl=en.
>
> >> > --
>
> >> > You received this message because you are subscribed to the Google Groups
> >> > "web2py-users" group.
> >> > To post to this group, send email to web...@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > web2py+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/web2py?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37907] Re: Editor from browser

2009-12-27 Thread Timbo
A more featureful admin app would be nIce but I support Massimo in
keeping the current one. A point of clarification, Bespin is merely an
editor.  Their goal is to eventually create an IDE but it is far from
that at present.  Other problems include no IE support and it suffers
from the same highlighting inconsistancies that plague Editarea since
it uses regexp-based parser.  It also has no highlighting support for
Python.  Bespin is interesting but it has a lot of wow-factor without
much practicality.

I'm watching bespin closely and will let the list know when it is
reasonable to consider as a replacement or complement to editarea.

- tim

On Dec 27, 1:50 pm, mdipierro  wrote:
> I would like to see people build alternatives to default admin app. I
> do not think it is a good idea to replace admin because I like the
> fact that it has no dependencies, but more experienced users should be
> able to use more powerful alternatives like the one you suggest.
> Ideally I would like to have a better web based IDE fully coded in JS.
>
> Massimo
>
> On Dec 27, 7:57 am, Joan Miller  wrote:
>
>
>
> > Since that web2py comes with an editor in HTML/Js to develop from
> > browser, this could make you smile.
>
> > Bespin is a Mozilla's project to have a full IDE from browser; it's
> > free/open source and there is a server built on python so it could be
> > integrated in web2py.
>
> > *http://ajaxian.com/archives/bespin-a-new-mozilla-labs-experimental-ex...
> > *https://mozillalabs.com/bespin/

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37906] sad without buttons

2009-12-27 Thread Thadeus Burgess
Hrm... no BUTTON helper :*(

-Thadeus

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37905] Re: DAL, transactions

2009-12-27 Thread Thadeus Burgess
Just curious in how it works in web2py. In SQLAlchemy sessions are
thread safe.. so uncommitted transactions are accessible from other
threads.

-Thadeus





On Sun, Dec 27, 2009 at 1:44 PM, mdipierro  wrote:
> You can commit db.commit() and db.rollback() explicitly. Just do it
> when you need.
>
> The concept of cross-thread transaction is not well defined and would
> be very unsafe. Perhaps if you tell us what you are tring to achieve
> we can suggest a better way.
>
>
>
> On Dec 27, 10:29 am, Thadeus Burgess  wrote:
>> Is it possible to disable auto_commit() so that it must be explicitly called?
>>
>> And are the Transactions shared between threads? Or must they be
>> committed to be seen in other threads?
>>
>> -Thadeus
>>
>> On Sun, Dec 27, 2009 at 9:38 AM, Vasile Ermicioi  wrote:
>> > any changes in DAL about GAE transactions?
>>
>> > On Sun, Dec 27, 2009 at 5:35 PM, mdipierro  wrote:
>>
>> >> yes
>>
>> >> On Dec 27, 5:55 am, Thadeus Burgess  wrote:
>> >> > Does the DAL perform all queries on a transaction basis... that
>> >> > happens to commit() at the end of a successful request? and on an
>> >> > error the transaction is rolled back?
>>
>> >> > -Thadeus
>>
>> >> --
>>
>> >> You received this message because you are subscribed to the Google Groups
>> >> "web2py-users" group.
>> >> To post to this group, send email to web...@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> web2py+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >>http://groups.google.com/group/web2py?hl=en.
>>
>> > --
>>
>> > You received this message because you are subscribed to the Google Groups
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37904] Re: Editor from browser

2009-12-27 Thread mdipierro
I would like to see people build alternatives to default admin app. I
do not think it is a good idea to replace admin because I like the
fact that it has no dependencies, but more experienced users should be
able to use more powerful alternatives like the one you suggest.
Ideally I would like to have a better web based IDE fully coded in JS.

Massimo

On Dec 27, 7:57 am, Joan Miller  wrote:
> Since that web2py comes with an editor in HTML/Js to develop from
> browser, this could make you smile.
>
> Bespin is a Mozilla's project to have a full IDE from browser; it's
> free/open source and there is a server built on python so it could be
> integrated in web2py.
>
> *http://ajaxian.com/archives/bespin-a-new-mozilla-labs-experimental-ex...
> *https://mozillalabs.com/bespin/

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37903] Re: xmlrpc usage

2009-12-27 Thread mdipierro
You should get some kid of error if the URL were wrong.

Anyway try:

import xmlrpclib
server=xmlrpclib.ServerProxy('http://127.0.0.1:8000/app/xmlrpctest/
call/xmlrpc')
print str(server.add(3,4)+server.sub(3,4))

(assuming the port is 8000).



On Dec 27, 8:59 am, Oguz Yarimtepe  wrote:
> Hi,
>
> I was checking xmlrpc usage[1] at web2py. I have an application names "test". 
> I created xmlrpctest.py under it and added the below lines:
>
> from gluon.tools import Service
> service = Service(globals())
>
> @service.xmlrpc
> def add(a,b): return a+b
>
> @service.xmlrpc
> def sub(a,b): return a-b
>
> def call(): return service()
>
> Then while apache with mod_wsgi is running i decided to test the service.
>
> From ipython
>
> [1] import xmlrpclib
> [2] 
> server=xmlrpclib.ServerProxy('http://localhost/app/xmlrpctest/call/xmlrpc')
> [3]    print str(server.add(3,4)+server.sub(3,4))
>
> But i didn't see any result. No error messages also. What am i doing wrong? 
> Maybe the url i am calling is wrong.
>
> --
> Oguz Yarimtepe 

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37902] Re: DAL, transactions

2009-12-27 Thread mdipierro
You can commit db.commit() and db.rollback() explicitly. Just do it
when you need.

The concept of cross-thread transaction is not well defined and would
be very unsafe. Perhaps if you tell us what you are tring to achieve
we can suggest a better way.



On Dec 27, 10:29 am, Thadeus Burgess  wrote:
> Is it possible to disable auto_commit() so that it must be explicitly called?
>
> And are the Transactions shared between threads? Or must they be
> committed to be seen in other threads?
>
> -Thadeus
>
> On Sun, Dec 27, 2009 at 9:38 AM, Vasile Ermicioi  wrote:
> > any changes in DAL about GAE transactions?
>
> > On Sun, Dec 27, 2009 at 5:35 PM, mdipierro  wrote:
>
> >> yes
>
> >> On Dec 27, 5:55 am, Thadeus Burgess  wrote:
> >> > Does the DAL perform all queries on a transaction basis... that
> >> > happens to commit() at the end of a successful request? and on an
> >> > error the transaction is rolled back?
>
> >> > -Thadeus
>
> >> --
>
> >> You received this message because you are subscribed to the Google Groups
> >> "web2py-users" group.
> >> To post to this group, send email to web...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> web2py+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/web2py?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37901] Re: WSGI and wsgihandler.py

2009-12-27 Thread mdipierro
> On my Mac Server I used Screen Sharing to start web2py, and run web2py
> as a long running process, that is, I didn't 'kill' it. How does that
> work at WebFaction
> is web2py started everytime there is a request an then stopped?

This happens ONLY if you use cgihandler.py. It does not happen with
any of the other handlers.
For example if you use mod_wsgi, Apache starts Python and it is loaded
in the memory with all web2py modules.
At every request gluon.main.wsgibase is called. Threads are recycled
and database connections are recycled for speed.
Because web2py is not reloaded cache.ram is persistent and shared
across requests as long as you do not restart apache.

Massimo

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37900] Re: Confirmation at delete

2009-12-27 Thread Thadeus Burgess
That delete alert box is all on the javascript side

-Thadeus





On Sun, Dec 27, 2009 at 9:53 AM, Vasile Ermicioi  wrote:
> I guess you can do that with javascript (client side)
>
> On Sun, Dec 27, 2009 at 5:42 PM, annet  wrote:
>>
>> Massimo,
>>
>> I am a complete novice when it comes to programming in Python.
>> Maybe one of the group members could provide a patch?
>>
>> Kind regards,
>>
>> Annet
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37899] Re: DAL, transactions

2009-12-27 Thread Thadeus Burgess
Is it possible to disable auto_commit() so that it must be explicitly called?

And are the Transactions shared between threads? Or must they be
committed to be seen in other threads?

-Thadeus





On Sun, Dec 27, 2009 at 9:38 AM, Vasile Ermicioi  wrote:
> any changes in DAL about GAE transactions?
>
> On Sun, Dec 27, 2009 at 5:35 PM, mdipierro  wrote:
>>
>> yes
>>
>> On Dec 27, 5:55 am, Thadeus Burgess  wrote:
>> > Does the DAL perform all queries on a transaction basis... that
>> > happens to commit() at the end of a successful request? and on an
>> > error the transaction is rolled back?
>> >
>> > -Thadeus
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37898] Re: WSGI and wsgihandler.py

2009-12-27 Thread annet
Massimo,

Thanks for the link.

I have another question, in the forum post mentioned above I also
read:


> from another terminal, kill web2py process according to web2py's
> output instructions

> Start your app:
>~/webapps/apachewsgi/apach2/bin/start


To which Mengu added:

> when you start web2py with the command python web2py.py, it outputs
> something like this:
> "please visit:
>http://127.0.0.1:8000
> use "kill -SIGTERM 9813" to shutdown the web2py server"

> so basically, you need to fire up another terminal window to ssh into
> your webfaction account and use kill -SIGTERM 9813. that's what it
> means.


I thought web2py is a long running process but from these
instructions I learn that I kill web2py and start apache? Is that
right.

On my Mac Server I used Screen Sharing to start web2py, and run web2py
as a long running process, that is, I didn't 'kill' it. How does that
work at WebFaction
is web2py started everytime there is a request an then stopped?

Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37897] Re: Confirmation at delete

2009-12-27 Thread Vasile Ermicioi
I guess you can do that with javascript (client side)

On Sun, Dec 27, 2009 at 5:42 PM, annet  wrote:

> Massimo,
>
> I am a complete novice when it comes to programming in Python.
> Maybe one of the group members could provide a patch?
>
> Kind regards,
>
> Annet
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37896] Re: Confirmation at delete

2009-12-27 Thread annet
Massimo,

I am a complete novice when it comes to programming in Python.
Maybe one of the group members could provide a patch?

Kind regards,

Annet

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37895] Re: internatinalization for auth fields

2009-12-27 Thread mdipierro
db.auth_user.password.label=T('The Password')

On Dec 27, 7:14 am, Frank  wrote:
> regarding default auth fields, we can use
> {{if not auth.is_logged_in():response.write(auth.login())}} as login form, you
> will see field names like username, password etc in login form in English, we
> want translate field names of login form into other languages, T method is not
> the solution obviously. if we do not want to customize login form, is there
> better way to do that translation?
>
> thanks,
>
> Frank

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37894] Re: WSGI and wsgihandler.py

2009-12-27 Thread mdipierro
Look into the script described here:
http://www.web2pyslices.com/main/slices/take_slice/29

On Dec 27, 6:28 am, annet  wrote:
> I am working my way through setting up my account at Webfaction using
> the WebFaction and web2py User Guides and this 
> post:http://forum.webfaction.com/viewtopic.php?pid=8844#p8844
>
> Since this post is almost a year old, and web2py has evolved rapidly,
> I wonder whether the procedure is still accurate. e.g. I created a
> mod_wsgi 2.5/Python 2.5 application and got the following
> confirmation:
>
> Created by me on 2009-12-24 09:49:41, modified by me on 2009-12-24
> 09:49:41
> Name:           apachewsgi
> Port:                   x
> App type:               mod_wsgi 2.5/Python 2.5
> App doc:
>
> This sets up the mod_wsgi 2.5/Python 2.5 stack.
> Apache will be installed in your application's apache2 directory.
> A cronjob that runs every 20 minutes and restarts Apache if it's down
> will be created.
>
> Plus the installer for 'mod_wsgi 2.5/Python 2.5' -  automatically
> creates a cronjob that would start the server, if it is not running.
>
> So I have Apache installed and a mod_wsgi 2.5/Python 2.5. application,
> which I guess is WSGI as referenced in the following line:
>
> In the web2py user guide I read: web2py provides a file wsgihandler.py
> to interface to WSGI.
>
> What exactly does this mean, and does it have any consequences for the
> httpd.conf file?
>
> Kind regards,
>
> Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




Re: [web2py:37893] Re: DAL, transactions

2009-12-27 Thread Vasile Ermicioi
any changes in DAL about GAE transactions?

On Sun, Dec 27, 2009 at 5:35 PM, mdipierro  wrote:

> yes
>
> On Dec 27, 5:55 am, Thadeus Burgess  wrote:
> > Does the DAL perform all queries on a transaction basis... that
> > happens to commit() at the end of a successful request? and on an
> > error the transaction is rolled back?
> >
> > -Thadeus
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37892] Re: DAL, transactions

2009-12-27 Thread mdipierro
yes

On Dec 27, 5:55 am, Thadeus Burgess  wrote:
> Does the DAL perform all queries on a transaction basis... that
> happens to commit() at the end of a successful request? and on an
> error the transaction is rolled back?
>
> -Thadeus

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37891] Re: Confirmation at delete

2009-12-27 Thread mdipierro
I do not object and I would take a patch to do it if it does not
conflict with the ajax capture of form submission.

On Dec 27, 4:53 am, annet  wrote:
> The jQuery code for confirmation on delete connects the onclick event
> of the checkbox with a confirmation dialog, I have never seen this
> convention before, in the applications I have seen sofar the
> confirmation dialog is triggered by a submit. Is it possible to re-
> write the code in web2py_ajax.html:
>
> jQuery("input[type='checkbox'].delete").click(function() { if
> (this.checked) if(!confirm("{{=T('Sure you want to delete this
> object?')}}")) this.checked=false; });
>
> ... so that the code connects the submit with the confirmation dialog
> and not the onclick event of the checkbox?
>
> Kind regards,
>
> Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37890] Re: a problem with gluon.shell.env

2009-12-27 Thread mdipierro
If I understand the problem, you need to do

db.commit()

On Dec 27, 3:45 am, 王怀玉  wrote:
> to reuse model definition in a module, so i use gluon.shell.env .
> code in module is like this:
>   module code start ###
> os.chdir(/path/to/web2py/)
> from gluon.shell import env
> globals().update(env('my_application_name', import_models=True))
> while True:
> print "count", db(db.mytable.id>0).count()
> ### no change at all when i insert a row into db.mytable
> time.sleep(5)
>   module code end ###
> then, execute the module. the problem is that when a row is inserted into 
> db.mytable, the result printed by module doesn't change at all.
>
> how can i solve this ? thank you very much !

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37889] Editor from browser

2009-12-27 Thread Joan Miller
Since that web2py comes with an editor in HTML/Js to develop from
browser, this could make you smile.

Bespin is a Mozilla's project to have a full IDE from browser; it's
free/open source and there is a server built on python so it could be
integrated in web2py.


* 
http://ajaxian.com/archives/bespin-a-new-mozilla-labs-experimental-extensible-code-editor-using-canvas
* https://mozillalabs.com/bespin/

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37888] Re: starting web2py in the foreground for debugging

2009-12-27 Thread jep
For the record, i changed the import line in the index() function to:

{{{
 from gluon.restricted import RestrictedError
}}}

Else the browser gives me an errorpage, that it gets a redirect that
will never complete.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37887] Re: starting web2py in the foreground for debugging

2009-12-27 Thread jep
Tnx, it works :)

Best wishes,



On Dec 22, 3:57 pm, mdipierro  wrote:
> Hi Jep,
>
> create a file routes.py and in it
>
> routes_onerror=[('*/*','/logging/default/index')]
>
> and the create an app "logging" with a "controllers/default.py" that
> does the following:
>
> from gluon.admin import *
>
> def index():
>     from restricted import RestrictedError
>     app, ticket_id = request.vars.ticket.split('/')
>     e = RestrictedError()
>     e.load(request, app, ticket_id)
>     print e.traceback
>     return 'ticket: %s' % request.vars.ticket
>
> all tickets will be logged by the logging app.
>
> On Dec 22, 8:21 am, jep  wrote:
>
> > Massimo,
>
> > Tnx for replying.
>
> > > You can find requests logged in httpserver.log
> > > What kind of logs would you like to see?
>
> > > Massimo
>
> > Basically, having a plain text version of the logs that are now send
> > to the tickets in one big long file would be a nice start.
>
> > The tickets are great, but during debugging, i tend to make so much of
> > those tickets, and keep clicking around untill i get pain from using
> > my mouse. (says more about me than web2py).
> > I can imagine it would be great to have an option to have a "tail -f
> > web2pydebug.log" running in a terminal to see the debugging
> > information running over my screen while i reload a page with
> > problems.
>
> > It imagine it could also be an idea for the people who use web2py in
> > production to configure web2py to log to their syslog server, so they
> > can use their normal toolings for processing warnings and errorlogs.
>
> > Not logging by default, i like the default behaviour to be clean.
> > Just an option to switch on logging in a syslog standard way, or to a
> > local logfile would be nice.
>
> > Kind regards,
>
> > Jean-Paul

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37886] xmlrpc usage

2009-12-27 Thread Oguz Yarimtepe
Hi,

I was checking xmlrpc usage[1] at web2py. I have an application names "test". I 
created xmlrpctest.py under it and added the below lines:

from gluon.tools import Service
service = Service(globals())

@service.xmlrpc
def add(a,b): return a+b

@service.xmlrpc
def sub(a,b): return a-b

def call(): return service()

Then while apache with mod_wsgi is running i decided to test the service.

>From ipython

[1] import xmlrpclib
[2] server=xmlrpclib.ServerProxy('http://localhost/app/xmlrpctest/call/xmlrpc')
[3]print str(server.add(3,4)+server.sub(3,4))

But i didn't see any result. No error messages also. What am i doing wrong? 
Maybe the url i am calling is wrong.

-- 
Oguz Yarimtepe 

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37885] Re: Hosting at Webfaction

2009-12-27 Thread annet
Hi Mengu,

> so basically, you need to fire up another terminal window to ssh into
> your webfaction account and use kill -SIGTERM 9813. that's what it
> means.

I thought web2py is a long running process but from these
instructions:

from another terminal, kill web2py process according to web2py's
output instructions

Start your app:
~/webapps/apachewsgi/apach2/bin/start


... I learn that I kill web2py and start apache? Is that right.

On my Mac Server I used Screen Sharing to start web2py, and run web2py
as a long running process, that is, I didn't 'kill' it. How does that
work at WebFaction
is web2py started everytime there is a request an then stopped?

Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37884] internatinalization for auth fields

2009-12-27 Thread Frank
regarding default auth fields, we can use
{{if not auth.is_logged_in():response.write(auth.login())}} as login form, you
will see field names like username, password etc in login form in English, we
want translate field names of login form into other languages, T method is not
the solution obviously. if we do not want to customize login form, is there
better way to do that translation?

thanks,

Frank




 

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37883] WSGI and wsgihandler.py

2009-12-27 Thread annet
I am working my way through setting up my account at Webfaction using
the WebFaction and web2py User Guides and this post:
http://forum.webfaction.com/viewtopic.php?pid=8844#p8844

Since this post is almost a year old, and web2py has evolved rapidly,
I wonder whether the procedure is still accurate. e.g. I created a
mod_wsgi 2.5/Python 2.5 application and got the following
confirmation:

Created by me on 2009-12-24 09:49:41, modified by me on 2009-12-24
09:49:41
Name:   apachewsgi
Port:   x
App type:   mod_wsgi 2.5/Python 2.5
App doc:

This sets up the mod_wsgi 2.5/Python 2.5 stack.
Apache will be installed in your application's apache2 directory.
A cronjob that runs every 20 minutes and restarts Apache if it's down
will be created.

Plus the installer for 'mod_wsgi 2.5/Python 2.5' -  automatically
creates a cronjob that would start the server, if it is not running.

So I have Apache installed and a mod_wsgi 2.5/Python 2.5. application,
which I guess is WSGI as referenced in the following line:

In the web2py user guide I read: web2py provides a file wsgihandler.py
to interface to WSGI.

What exactly does this mean, and does it have any consequences for the
httpd.conf file?


Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37882] DAL, transactions

2009-12-27 Thread Thadeus Burgess
Does the DAL perform all queries on a transaction basis... that
happens to commit() at the end of a successful request? and on an
error the transaction is rolled back?

-Thadeus

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37881] Re: files under a subdomain.

2009-12-27 Thread annet
Massimo,

> yes but you will need to hardcode the URLs instead of using URL(...).

So the URLs in web2py_ajax and the custom controller would read like:

> > response.files.insert(0,URL(r=request,c='static',f='jquery.js'))

response.files.insert(0,'http://files.example.com/js/jquery.js')


> > response.image=URL(r=request,c='static',f='cms/media/default_1.jpg')

response.image='http://files.example.com/cms/media/default_1.jpg'


I guess to stay away from hard coding the URLs I could also create a
files application and
serve the files from there?

Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37880] Confirmation at delete

2009-12-27 Thread annet
The jQuery code for confirmation on delete connects the onclick event
of the checkbox with a confirmation dialog, I have never seen this
convention before, in the applications I have seen sofar the
confirmation dialog is triggered by a submit. Is it possible to re-
write the code in web2py_ajax.html:


jQuery("input[type='checkbox'].delete").click(function() { if
(this.checked) if(!confirm("{{=T('Sure you want to delete this
object?')}}")) this.checked=false; });


... so that the code connects the submit with the confirmation dialog
and not the onclick event of the checkbox?


Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37879] Re: Add buttons to form=auth() form

2009-12-27 Thread annet
Massimo,

> What do you mean by "doesn't work"? You do not see the buttons?

Yes.

> Try this:
>
> def user():
>     form=auth()
>     form[0][-1][1].append(INPUT(_type="reset",_value="Reset"))
>     form[0][-1][1].append(INPUT
> (_type="button",_value="Cancel",_onclick="window.location='%s';"%URL
> (r=request,f='index')))
>     return dict(form=form)

Thanks return dict (form=form) solved the problem.


Kind regards,

Annet.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:37878] a problem with gluon.shell.env

2009-12-27 Thread 王怀玉
to reuse model definition in a module, so i use gluon.shell.env .
code in module is like this:
  module code start ###
os.chdir(/path/to/web2py/)
from gluon.shell import env
globals().update(env('my_application_name', import_models=True))
while True:
print "count", db(db.mytable.id>0).count()
### no change at all when i insert a row into db.mytable
time.sleep(5)
  module code end ###
then, execute the module. the problem is that when a row is inserted into 
db.mytable, the result printed by module doesn't change at all. 

how can i solve this ? thank you very much !

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.