[web2py] web2py online

2011-08-28 Thread Web2Py Freak
dear ALL ,

when i want to make my website online what files do i take , from
applications in web2py folder or  the file.w2p when i pack it all


[web2py] 3 functions and a decorator?

2011-08-28 Thread Martin Weissenboeck
Hi,

lets say I have 3 functions

def a():
# some code
if form.accepts(request.vars, session):
redirect(URL('b'))
return dict(form=form)

def b():
# some code
if form.accepts(request.vars, session):
redirect(URL('c'))
return dict(form=form)

def c():
return  c *

a, b and c have their own views. I do not want to allow any user to start at
function b or c. Everybody has to start at a.
I think, this problem could be solved using a decorator, but I could not
find how.

Regards, Martin


Re: [web2py] R: Re: web2py hosting

2011-08-28 Thread Sebastian E. Ovide
more hosting here :
https://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

it is a Django page... but if a hosting supports Django it supports also
web2py... (right?)

On Wed, Aug 24, 2011 at 10:04 PM, Valter Foresto
valter.fore...@gmail.comwrote:

 Video How to deploy / use web2py on free FluxFlex 
 hostinghttp://vimeo.com/28112026
 on Vimeo by Massimo Di Pierro. http://vimeo.com/28112026




-- 
Sebastian E. Ovide


Re: [web2py] 3 functions and a decorator?

2011-08-28 Thread Bruno Rocha
You will need to keep state in some place to know if the user already passed
in the previous action.

@auth.requires_login() #if you need the user to be logged in
 def a():

   session.lastsee = 'a'

 # some code
 if form.accepts(request.vars, session):
 redirect(URL('b'))
 return dict(form=form)

 def b():

   if session.lastsee and session.lastsee == 'a':
   session.lastsee = 'b'
   else:
   redirect(URL('a'))


 # some code
 if form.accepts(request.vars, session):
 redirect(URL('c'))
 return dict(form=form)

 def c():
 return  c *

 a, b and c have their own views. I do not want to allow any user to start
 at function b or c. Everybody has to start at a.
 I think, this problem could be solved using a decorator, but I could not
 find how.

 Regards, Martin




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: web2py online

2011-08-28 Thread Anthony
You can do either. I think the .w2p file will exclude error tickets and 
session files, but otherwise should be the same.

Anthony

On Sunday, August 28, 2011 4:32:16 AM UTC-4, Web2Py Freak wrote:

 dear ALL , 

 when i want to make my website online what files do i take , from 
 applications in web2py folder or  the file.w2p when i pack it all



[web2py] Re: web2py online

2011-08-28 Thread Anthony
Note, not only will the .w2p file exclude session and error files (and cache 
files), but the act of creating the .w2p file will remove the session, 
error, and cache files from the application folder itself.

On Sunday, August 28, 2011 7:48:27 AM UTC-4, Anthony wrote:

 You can do either. I think the .w2p file will exclude error tickets and 
 session files, but otherwise should be the same.

 Anthony

 On Sunday, August 28, 2011 4:32:16 AM UTC-4, Web2Py Freak wrote:

 dear ALL , 

 when i want to make my website online what files do i take , from 
 applications in web2py folder or  the file.w2p when i pack it all



[web2py] 'file not accessible' error in gae under mac

2011-08-28 Thread Joseph Jude
Hi,
When I deploy the freshly downloaded web2py src under GAE I get the
below error:

IOError: [Errno 13] file not accessible: '//VERSION'

I do have python 2.7  3 installed. But under the GAE Launcher, python
path is set to /usr/bin/python where python2.5 is installed. Also I'm
able to browse the GAE admin console, so I'm assuming python version
is not a problem.

GAE SDK: 1.5.2 (am using google launcher)
web2py version: 1.98.2
Mac 10.5.8

I deleted the w2ps in the main folders too. Otherwise just changed
just the 'application' entry in app.yaml.

Your help to resolve is appreciated. Thank you,
Joseph



[web2py] Re: web2py online

2011-08-28 Thread Web2Py Freak
so now if i use .w2p file , if i am using Session it will not work ??


[web2py] Lost with simple replace + db.select() result

2011-08-28 Thread Yuushi
This has kept me up quite a few hours last night, this morning I woke
up and I still have no clue how to approach this. I am still pretty
new to Python  web2py but I can't believe a simple string function
gives me so much grief.

My goal:
I am making a simple shoutbox for practice purposes, it uses a
database with the colloms: Shout,created_on,created_by
I have a database result set in the controller of the shoutbox
(   shouts = db(db.shouts).select(orderby=~db.shouts.created_on)   ).
Now the problem I run into is when I want to implement a simple emote
system. Basicly I want to perform a simple string replace on
shouts.Shout.

Because I have no idea how to manipulate the database result set
(which I also would like to know) I figured I would deal with it in
the view, not really ideal I would guess.

So I have a function in a module:

def ParseEmote(text):
text = text.replace(test,bla)
return text

in the view I have:
{{for shout in shouts:}}
{{result = functions.timesince(shout.created_on)}}
div style=font-size:12px;
span
style=color:#0F0{{=db.auth_user[shout.created_by].first_name}}/
span
span style=color:#999;says ({{=result}} ago): /
span
/div
{{=functions.ParseEmote(shout.Shout)}}
{{pass}}

The error I get is:
Traceback (most recent call last):
  File gluon/restricted.py, line 192, in restricted
  File G:\web2py\applications\the_old_republic\views\default/
shoutbox.html, line 15, in module
  File applications/The_Old_Republic/controllers/functions.py, line
7, in ParseEmote
AttributeError: 'NoneType' object has no attribute 'replace'

Now my question is:
1. How can I modify my ParseEmote function to deal with the
shout.Shout variable which seems to be a NoneType which I dont really
get. Its not really the best solution but I might come in handy later.
2. Is there a way I can get a similar result by just using just the
controller? something like (but then working):

shouts = db(db.shouts).select(orderby=~db.shouts.created_on)
for s in shouts:
   s.Shout.replace(:emote1:,somehtml)
pass

Regards,
Yuushi


[web2py] Re: Lost with simple replace + db.select() result

2011-08-28 Thread Alan Etkin
I would make the db query in the controller file and pass the Rows
object to the view to present the data. ¿Is'n that more MVC-ish? Even
the function could be defined in the controller and passed in the
response. For the Shouts field of the record i would check the model
for conflicts/errors.

A way of changing the Shout str should be:
row.update_record(Shout = [transformed shout])

On 28 ago, 09:17, Yuushi yuushiceleri...@gmail.com wrote:
 This has kept me up quite a few hours last night, this morning I woke
 up and I still have no clue how to approach this. I am still pretty
 new to Python  web2py but I can't believe a simple string function
 gives me so much grief.

 My goal:
 I am making a simple shoutbox for practice purposes, it uses a
 database with the colloms: Shout,created_on,created_by
 I have a database result set in the controller of the shoutbox
 (   shouts = db(db.shouts).select(orderby=~db.shouts.created_on)   ).
 Now the problem I run into is when I want to implement a simple emote
 system. Basicly I want to perform a simple string replace on
 shouts.Shout.

 Because I have no idea how to manipulate the database result set
 (which I also would like to know) I figured I would deal with it in
 the view, not really ideal I would guess.

 So I have a function in a module:

 def ParseEmote(text):
     text = text.replace(test,bla)
     return text

 in the view I have:
     {{for shout in shouts:}}
         {{result = functions.timesince(shout.created_on)}}
         div style=font-size:12px;
             span
 style=color:#0F0{{=db.auth_user[shout.created_by].first_name}}/
 span
             span style=color:#999;says ({{=result}} ago): /
 span
         /div
         {{=functions.ParseEmote(shout.Shout)}}
     {{pass}}

 The error I get is:
 Traceback (most recent call last):
   File gluon/restricted.py, line 192, in restricted
   File G:\web2py\applications\the_old_republic\views\default/
 shoutbox.html, line 15, in module
   File applications/The_Old_Republic/controllers/functions.py, line
 7, in ParseEmote
 AttributeError: 'NoneType' object has no attribute 'replace'

 Now my question is:
 1. How can I modify my ParseEmote function to deal with the
 shout.Shout variable which seems to be a NoneType which I dont really
 get. Its not really the best solution but I might come in handy later.
 2. Is there a way I can get a similar result by just using just the
 controller? something like (but then working):

 shouts = db(db.shouts).select(orderby=~db.shouts.created_on)
 for s in shouts:
    s.Shout.replace(:emote1:,somehtml)
 pass

 Regards,
 Yuushi


[web2py] Re: 3 functions and a decorator?

2011-08-28 Thread Massimo Di Pierro
How about using digitally signed URLS?

from gluon.utils import web2py_uuid

def a():
# some code
if form.accepts(request.vars, session):
session.tmpkey = web2py_uuid()
redirect(URL('b',hmac_key=session.tmpkey))
return dict(form=form)

def b():
if not URL.verify(hmac_key=session.tmpkey): redirect(URL('a'))
# some code
if form.accepts(request.vars, session):
session.tmpkey = web2py_uuid()
redirect(URL('c',hmac_key=session.tmpkey))
return dict(form=form)

def c():
if not URL.verify(hmac_key=session.tmpkey): redirect(URL('a'))
return  c *


Would be easier if users were logged in.

On Aug 28, 4:20 am, Martin Weissenboeck mweis...@gmail.com wrote:
 Hi,

 lets say I have 3 functions

 def a():
     # some code
     if form.accepts(request.vars, session):
         redirect(URL('b'))
     return dict(form=form)

 def b():
     # some code
     if form.accepts(request.vars, session):
         redirect(URL('c'))
     return dict(form=form)

 def c():
     return  c *

 a, b and c have their own views. I do not want to allow any user to start at
 function b or c. Everybody has to start at a.
 I think, this problem could be solved using a decorator, but I could not
 find how.

 Regards, Martin


Re: [web2py] Re: table, grid, smartgrid, getting better

2011-08-28 Thread Juan Tiger
I using sqlite, alter table does not support drop columns, so you must try a
fresh install

2011/8/24 Johann Spies johann.sp...@gmail.com


 TypeError: lambda() takes exactly 1 argument (2 given)



 I still get this error with the following model (all 'represent'  lines
 commented out):

  db.define_table('akb_articles',
 Field('title'),
 Field('primaryauthor'),
 Field('authors', 'text'),
 Field('rp_author', length=64,
requires =
 IS_EMPTY_OR(IS_IN_DB(db,'akb_reprint.uuid', '%(rp_author)s'))),
 Field('journal',
   requires = IS_IN_DB(db,'akb_journal.uuid',
 '%(title)s')),
 Field('bib_id'),
 Field('bib_pages'),
 Field('doctype'),
 Field('language'),
 Field('abstract', 'text'),
 Field('bib_vol'),
 Field('bib_date'),
 Field('url'),
 Field('pubyear', compute= lambda x: x['bib_date'][-4:]),
 Field('ut', # isi-unieke rekordnommer

 requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.ut'))),
 Field('scopus_id',
 requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.scopus_id'))),
 Field('sabinet_id',
 requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.sabinet_id'))),
 Field('isap_id',
 requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.isap_id'))),
 Field('category', 'list:string', IS_EMPTY_OR(
 IS_IN_DB(db,'akb_categories.uuid',
  '%(category)s',
  multiple=True))),
 Field('heading', 'list:string',  IS_EMPTY_OR(
 IS_IN_DB(db,'akb_headings.uuid', '%(headings)s',
  multiple=True))),
 Field('art_eq',compute= lambda x: art_ekw(x)),
 akb_signature,
 #format = '%(title)s'
)

 There is no 'lambda' in akb_signature.

 Regards
 Johann


 --
  May grace and peace be yours in abundance through the full knowledge of
 God and of Jesus our Lord!  His divine power has given us everything we need
 for life and godliness through the full knowledge of the one who called us
 by his own glory and excellence.
 2 Pet. 1:2b,3a




[web2py] Re: 3 functions and a decorator?

2011-08-28 Thread Massimo Di Pierro
On a second thought, this is overwill... you can do:

def a():
# some code
if form.accepts(request.vars, session):
session.step = 'b'
redirect(URL('b'))
return dict(form=form)
def b():
if not session.step=='b': redirect(URL('a'))
# some code
if form.accepts(request.vars, session):
session.step = 'c'
redirect(URL('c'))
return dict(form=form)
def c():
if not session.step=='c': redirect(URL('a'))
return  c *



On Aug 28, 8:51 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 How about using digitally signed URLS?

 from gluon.utils import web2py_uuid

 def a():
     # some code
     if form.accepts(request.vars, session):
         session.tmpkey = web2py_uuid()
         redirect(URL('b',hmac_key=session.tmpkey))
     return dict(form=form)

 def b():
     if not URL.verify(hmac_key=session.tmpkey): redirect(URL('a'))
     # some code
     if form.accepts(request.vars, session):
         session.tmpkey = web2py_uuid()
         redirect(URL('c',hmac_key=session.tmpkey))
     return dict(form=form)

 def c():
     if not URL.verify(hmac_key=session.tmpkey): redirect(URL('a'))
     return  c *

 Would be easier if users were logged in.

 On Aug 28, 4:20 am, Martin Weissenboeck mweis...@gmail.com wrote:







  Hi,

  lets say I have 3 functions

  def a():
      # some code
      if form.accepts(request.vars, session):
          redirect(URL('b'))
      return dict(form=form)

  def b():
      # some code
      if form.accepts(request.vars, session):
          redirect(URL('c'))
      return dict(form=form)

  def c():
      return  c *

  a, b and c have their own views. I do not want to allow any user to start at
  function b or c. Everybody has to start at a.
  I think, this problem could be solved using a decorator, but I could not
  find how.

  Regards, Martin


[web2py] Re: 'file not accessible' error in gae under mac

2011-08-28 Thread Massimo Di Pierro
GAE requires 2.5. GAE has experimental support for 2.7 but we have not
tested that yet.

On Aug 28, 7:39 am, Joseph Jude ceph...@gmail.com wrote:
 Hi,
 When I deploy the freshly downloaded web2py src under GAE I get the
 below error:

 IOError: [Errno 13] file not accessible: '//VERSION'

 I do have python 2.7  3 installed. But under the GAE Launcher, python
 path is set to /usr/bin/python where python2.5 is installed. Also I'm
 able to browse the GAE admin console, so I'm assuming python version
 is not a problem.

 GAE SDK: 1.5.2 (am using google launcher)
 web2py version: 1.98.2
 Mac 10.5.8

 I deleted the w2ps in the main folders too. Otherwise just changed
 just the 'application' entry in app.yaml.

 Your help to resolve is appreciated. Thank you,
 Joseph


[web2py] Re: 3 functions and a decorator?

2011-08-28 Thread Alan Etkin
If the user must start his session based on some condition,  then
access can be recorded in the session object.
If the user must not start to use the application with a condition,
then i would store access in the database so
your access control code can check the access data in case the user
logs out having entered a required action
and starts another session.

On 28 ago, 06:20, Martin Weissenboeck mweis...@gmail.com wrote:
 Hi,

 lets say I have 3 functions

 def a():
     # some code
     if form.accepts(request.vars, session):
         redirect(URL('b'))
     return dict(form=form)

 def b():
     # some code
     if form.accepts(request.vars, session):
         redirect(URL('c'))
     return dict(form=form)

 def c():
     return  c *

 a, b and c have their own views. I do not want to allow any user to start at
 function b or c. Everybody has to start at a.
 I think, this problem could be solved using a decorator, but I could not
 find how.

 Regards, Martin


Re: [web2py] new in trunk

2011-08-28 Thread Bruno Rocha
Cool! I just tested it and I will use.

I just recommend replace .html() with .append() to prevent the deletion of
existing itens in target.

On Mon, Aug 8, 2011 at 8:49 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Example:

 div id=mytarget.../div

 div id=test
  {{A('click
 me',callback=URL('mycallback'),target=mytarget,delete=div#test)}}
 /div

 when you click on mycallback the div#test disappears and the str
 returned by the ajax mycallback is displayed in div#mytarget.

 Useful for adding buttons to tables, for example:

 db.table.id.represent = lambda id: {A('delete
 me',callback=URL('delete_record',args=id),delete=tr)




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: web2py online

2011-08-28 Thread Alan Etkin
The session data lost is wich is stored during the application usage,
(such as form input or data sent by the app in runtime to memmory
storage) but the app installed with .w2p installer should work without
problems. There are other ways of installing an application in
production, like cloning a repository or copying the app folder, but i
think the standard way is from the web2py admin app form upload.

On 28 ago, 10:07, Web2Py Freak halna...@gardeniatelco.com wrote:
 so now if i use .w2p file , if i am using Session it will not work ??


[web2py] crud.update change field value in controller

2011-08-28 Thread JaapP
Hi,

i am trying to use a crud.update function and want to change the value
of a field before passing to the view.
i've spent a couple of hours trying and searchin.

I found this post http://permalink.gmane.org/gmane.comp.python.web2py/37314
but the suggested use of 'db.table.field.update=' doesn't change the
field value as seen in the controller.

Anybody an idea how this should be implemented?

thanks!

Jaap


Re: [web2py] Re: 3 functions and a decorator?

2011-08-28 Thread Martin Weissenboeck
Thanks to all!

2011/8/28 Alan Etkin spame...@gmail.com

 If the user must start his session based on some condition,  then
 access can be recorded in the session object.
 If the user must not start to use the application with a condition,
 then i would store access in the database so
 your access control code can check the access data in case the user
 logs out having entered a required action
 and starts another session.

 On 28 ago, 06:20, Martin Weissenboeck mweis...@gmail.com wrote:
  Hi,
 
  lets say I have 3 functions
 
  def a():
  # some code
  if form.accepts(request.vars, session):
  redirect(URL('b'))
  return dict(form=form)
 
  def b():
  # some code
  if form.accepts(request.vars, session):
  redirect(URL('c'))
  return dict(form=form)
 
  def c():
  return  c *
 
  a, b and c have their own views. I do not want to allow any user to start
 at
  function b or c. Everybody has to start at a.
  I think, this problem could be solved using a decorator, but I could not
  find how.
 
  Regards, Martin



[web2py] Re: web2py online

2011-08-28 Thread Web2Py Freak
so the best way is to use the .w2p file


[web2py] Re: crud.update change field value in controller

2011-08-28 Thread Massimo Di Pierro
I do not understand. Can you make a concrete example?

On Aug 28, 9:37 am, JaapP j...@tetra.nl wrote:
 Hi,

 i am trying to use a crud.update function and want to change the value
 of a field before passing to the view.
 i've spent a couple of hours trying and searchin.

 I found this posthttp://permalink.gmane.org/gmane.comp.python.web2py/37314
 but the suggested use of 'db.table.field.update=' doesn't change the
 field value as seen in the controller.

 Anybody an idea how this should be implemented?

 thanks!

 Jaap


[web2py] Re: crud.update change field value in controller

2011-08-28 Thread JaapP
My code looks like this:

#CONTROLLER
def bevestig():
db.bestelling.bedrag.update = '10'
bestelling =
crud.update(db.bestelling,request.args(0),deletable=False,onaccept=
muntgeld_bijboeken)
return dict(bestelling=bestelling)

#VIEW
{{=bestelling}}

The value shown by the controller for 'bedrag' is the value as stated
in the DB for this record;
i would expect the value to be '10'

I also tried moving the update part below the crud.update line, but
same result :)



On Aug 28, 4:44 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I do not understand. Can you make a concrete example?

 On Aug 28, 9:37 am, JaapP j...@tetra.nl wrote:







  Hi,

  i am trying to use a crud.update function and want to change the value
  of a field before passing to the view.
  i've spent a couple of hours trying and searchin.

  I found this posthttp://permalink.gmane.org/gmane.comp.python.web2py/37314
  but the suggested use of 'db.table.field.update=' doesn't change the
  field value as seen in the controller.

  Anybody an idea how this should be implemented?

  thanks!

  Jaap


[web2py] parametric router enhancements

2011-08-28 Thread Jonathan Lundell
(in the trunk, not the stable release, as of today)

Due to popular demand, there are a couple of enhancements to the parametric 
(new) router.

One is the ability to specify a default function per controller. In the 
configuration, default_function has been (and can still be) a string, which 
specifies a default function for all controllers in an app. default_function 
can now be a dictionary, where the keys are controller names. 

In support of this functionality, the variable 'functions', which has been a 
list of strings (function names in the default controller) can now be a 
dictionary of such lists, keyed by controller name.

If you use these formats, be sure to provide an entry for each controller; 
results for a controller not included are not defined by the current 
implementation.



The other change is also function-related. It's been possible to map a domain 
name (with optional port) to an app, or to an app/controller. You can now also 
map a domain to an app/controller/function. The use case that inspired this 
capability was the use of a subdomain dedicated to a particular administrative 
function; a bit unusual, but since the a/c/f syntax was a natural extension of 
the current logic, I extended it.


The features have been tested with unit tests, but have had little or no 
real-world exposure, so feedback will be appreciated.

[web2py] Re: 'file not accessible' error in gae under mac

2011-08-28 Thread Joseph Jude
Thanks Massimo.

But when I execute

python /usr/local/bin/dev_appserver.py appname

I get the homepage.

This error is only with appengine launcher. Also as I said, I am able
to browse the SDK console  dashboard. So I don't think it is with the
python version.

Anyway, for now I will proceed with the commandline. If someone can
help, it will be good.

Thank you,
Joseph


On Aug 28, 6:55 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 GAE requires 2.5. GAE has experimental support for 2.7 but we have not
 tested that yet.

 On Aug 28, 7:39 am, Joseph Jude ceph...@gmail.com wrote:







  Hi,
  When I deploy the freshly downloaded web2py src under GAE I get the
  below error:

  IOError: [Errno 13] file not accessible: '//VERSION'

  I do have python 2.7  3 installed. But under the GAE Launcher, python
  path is set to /usr/bin/python where python2.5 is installed. Also I'm
  able to browse the GAE admin console, so I'm assuming python version
  is not a problem.

  GAE SDK: 1.5.2 (am using google launcher)
  web2py version: 1.98.2
  Mac 10.5.8

  I deleted the w2ps in the main folders too. Otherwise just changed
  just the 'application' entry in app.yaml.

  Your help to resolve is appreciated. Thank you,
  Joseph


Re: [web2py] Re: crud.update change field value in controller

2011-08-28 Thread Bruno Rocha
On Sun, Aug 28, 2011 at 12:06 PM, JaapP j...@tetra.nl wrote:

  db.bestelling.bedrag.update = '10'


It is wrong. shoud be simething like:

  db(db.bestelling.id==request.args(0)).update(bedrag = '10')


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: crud.update change field value in controller

2011-08-28 Thread JaapP
Thanks a lot!

So now i first do an update of the record in the db and afterwards
create the crud.update form.
this works perfect.

But just for my curiosity;

when using an 'crud.create' setting default values with
'db.table.field.default=...' works fine,
as far as i understand from the post i refered to in the beginning
Massimo suggests using 'db.table.field.update=...' for changing the
existing value?


Jaap


On Aug 28, 5:16 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 On Sun, Aug 28, 2011 at 12:06 PM, JaapP j...@tetra.nl wrote:
   db.bestelling.bedrag.update = '10'

 It is wrong. shoud be simething like:

   db(db.bestelling.id==request.args(0)).update(bedrag = '10')

 --
 Bruno Rocha
 [ About me:http://zerp.ly/rochacbruno]
 [ Aprenda a programar:http://CursoDePython.com.br]
 [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
 [ Consultoria em desenvolvimento web:http://www.blouweb.com]


Re: [web2py] Re: Mobile detector

2011-08-28 Thread Angelo Compagnucci
HI Ross, Massimo,

I wrote a small decorator to use the newly added is_mobile flag:

class mobilize(object):
def __init__(self, func):
self.func = func
def __call__(self):
from gluon import current
if current.session._user_agent:
if current.session._user_agent.is_mobile:
current.response.view = \
current.response.view.split(.)[0] + .mobi
return self.func()

It should be included at the bottom of user_agent_parser.py.

With this you can have automatically selected the view.html or the
view.mobi depending on your browser is mobile or not, an example could
be:

@mobilize
def index():

example action using the mobilizer decorator it is
rendered by views/default/index.html or
views/default/index.mobi depending if your browser
is mobile or not

return dict(message=response.view)

Could this be added in trunk?

2011/8/27 Massimo Di Pierro massimo.dipie...@gmail.com:
 This is in trunk as of last night.

 On Aug 26, 12:13 pm, Ross Peoples ross.peop...@gmail.com wrote:
 I submitted this to Massimo for inclusion. Now we wait :)


[web2py] [tip] for those who likes jQUery UI

2011-08-28 Thread Bruno Rocha
For those who likes jQueryUI I recommend WijmoUI

Wijmo is jQUeryUI extended and has a free and a comercial version.

I am using this in many projects with web2py and works great.

http://www.wijmo.com/demo/explore/


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]


[web2py] Re: [tip] for those who likes jQUery UI

2011-08-28 Thread pbreit
It's nice but still too thick for my tastes. I wish these types of 
libraries would be designed to fit in better with a broader array of site 
designs. They all need so many modifications to avoid clashing with an 
existing site.

[web2py] Useful validators IS_LETTERS, IS_DIGITS

2011-08-28 Thread Saurabh Sawant
Hi,

I think these validators would be a nice addition to the great set of
validators we already have. They can be useful for fields for names
and phone numbers.


class IS_LETTERS(Validator):

Checks if field's value consists of all letters

example::

INPUT(_type='text', _name='name', requires=IS_LETTERS())

 IS_LETTERS()(A)
('A', None)
 IS_LETTERS()()
('', None)
 IS_LETTERS()(A_)
('A_', 'enter only letters')
 IS_LETTERS()(!)
('!', 'enter only letters')


def __init__(self, error_message='enter only letters'):
IS_MATCH.__init__(self, '^[A-Za-z]*$', error_message)

class IS_DIGITS(Validator):

Checks if field's value consists of all numeric digits

example::

INPUT(_type='text', _name='name', requires=IS_DIGITS())

 IS_NUMBERS()(1)
('1', None)
 IS_NUMBERS()()
('', None)
 IS_NUMBERS()(A)
('A', 'enter only numbers')
 IS_NUMBERS()(!)
('!', 'enter only numbers')


def __init__(self, error_message='enter only digits'):
IS_MATCH.__init__(self, '^[0-9]*$', error_message)


Regards,
Saurabh Sawant


Re: [web2py] Re: [tip] for those who likes jQUery UI

2011-08-28 Thread Bruno Rocha
On Sun, Aug 28, 2011 at 1:51 PM, pbreit pbreitenb...@gmail.com wrote:

 It's nice but still too thick for my tastes. I wish these types of
 libraries would be designed to fit in better with a broader array of site
 designs. They all need so many modifications to avoid clashing with an
 existing site.


I have no problem with existing sites, just 4 files added (Jquery, JqueryUI,
Wijmo.js, Wijmo.css)

The css are explicity and does not override any other declaration, only
affects objects with ui- classes, the initialization of objects are
explicity too and almost all done in one line of JS.

Example

$('#mytable').wijgrid(); // grid rendered

$('.myinputclass').wijmocombobox(); // combobox rendered

The templates are fully customizable using ThemeRoller to create a new theme
or editing CSS by hand, to the things you dont like you can always override
somewhere with !important in css.

What problems are you having with this kind of approach?


[web2py] Re: Lost with simple replace + db.select() result

2011-08-28 Thread pbreit
Put ParseEmote in the same controller and just call it like this:

  {{=ParseEmote(shout.Shout)}}

If you want the function available to all views, put it in a model file.

If you want to get fancy, you could implement a virtual field:
http://web2py.com/book/default/chapter/06#Virtual-Fields

At some point you will probably want to change how you do this since this 
creates a database query for each and every row: 
{{=db.auth_user[shout.created_by].first_name}}

Instead, you could do just one join query in the controller.


Re: [web2py] Useful validators IS_LETTERS, IS_DIGITS

2011-08-28 Thread Bruno Rocha
Or maybe the IS_ALPHANUMERIC can be extended and receive aditional argument
'filter' to allow only letters or only numbers

IS_ALPHANUMERIC(error_message='', filter='numbers') # to allow only
digits
IS_ALPHANUMERIC(error_message='', filter='letters')  # to allow letters

can have some filter to allow special, underscores etc...

http://web2py.com/book/default/docstring/IS_ALPHANUMERIC

On Sun, Aug 28, 2011 at 1:54 PM, Saurabh Sawant ris...@gmail.com wrote:

 Hi,

 I think these validators would be a nice addition to the great set of
 validators we already have. They can be useful for fields for names
 and phone numbers.


 class IS_LETTERS(Validator):

Checks if field's value consists of all letters

example::

INPUT(_type='text', _name='name', requires=IS_LETTERS())

 IS_LETTERS()(A)
('A', None)
 IS_LETTERS()()
('', None)
 IS_LETTERS()(A_)
('A_', 'enter only letters')
 IS_LETTERS()(!)
('!', 'enter only letters')


def __init__(self, error_message='enter only letters'):
IS_MATCH.__init__(self, '^[A-Za-z]*$', error_message)

 class IS_DIGITS(Validator):

Checks if field's value consists of all numeric digits

example::

INPUT(_type='text', _name='name', requires=IS_DIGITS())

 IS_NUMBERS()(1)
('1', None)
 IS_NUMBERS()()
('', None)
 IS_NUMBERS()(A)
('A', 'enter only numbers')
 IS_NUMBERS()(!)
('!', 'enter only numbers')


def __init__(self, error_message='enter only digits'):
IS_MATCH.__init__(self, '^[0-9]*$', error_message)


 Regards,
 Saurabh Sawant




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] parametric router enhancements

2011-08-28 Thread Bruno Rocha
Jonathan,

Lets say I have a dict of all my controlers/actions

dict(default=['index','page'], account=['user','login','profile','logout'])

when requests any that are in the dict should be executed, normal.. but

if request anything that are not in the dict I want to pass it to a default
function, example:

myapp/default/index # default/index is in dict should run normally

myapp/jonathan # jonathan is not in dict, so should execute account/user and
pass 'jonathan' as request.args(0)

I can do it using routes on error, but it is not elegant.

is there a better way?

thanks


[web2py] Re: Mobile detector

2011-08-28 Thread Massimo Di Pierro
I have no objection.What do others think?

On Aug 28, 10:53 am, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 HI Ross, Massimo,

 I wrote a small decorator to use the newly added is_mobile flag:

 class mobilize(object):
     def __init__(self, func):
         self.func = func
     def __call__(self):
         from gluon import current
         if current.session._user_agent:
             if current.session._user_agent.is_mobile:
                 current.response.view = \
                     current.response.view.split(.)[0] + .mobi
         return self.func()

 It should be included at the bottom of user_agent_parser.py.

 With this you can have automatically selected the view.html or the
 view.mobi depending on your browser is mobile or not, an example could
 be:

 @mobilize
 def index():
     
     example action using the mobilizer decorator it is
     rendered by views/default/index.html or
     views/default/index.mobi depending if your browser
     is mobile or not
     
     return dict(message=response.view)

 Could this be added in trunk?

 2011/8/27 Massimo Di Pierro massimo.dipie...@gmail.com:







  This is in trunk as of last night.

  On Aug 26, 12:13 pm, Ross Peoples ross.peop...@gmail.com wrote:
  I submitted this to Massimo for inclusion. Now we wait :)


[web2py] Re: Useful validators IS_LETTERS, IS_DIGITS

2011-08-28 Thread Saurabh Sawant
But IS_ALPHANUMERIC by virtue of its name suggests both letters and
numbers. Having separate validators for each of the cases would make
the code more readable.

db.auth_user.first_name.requires=IS_LETTERS()
db.auth_user.age.requires=IS_DIGITS()

is more readable and less ambiguous than

db.auth_user.first_name.requires=IS_ALPHANUMERIC(filter='letters')
db.auth_user.mobile.requires=IS_ALPHANUMERIC(filter='numbers')


On Aug 28, 10:13 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Or maybe the IS_ALPHANUMERIC can be extended and receive aditional argument
 'filter' to allow only letters or only numbers

 IS_ALPHANUMERIC(error_message='', filter='numbers') # to allow only
 digits
 IS_ALPHANUMERIC(error_message='', filter='letters')  # to allow letters

 can have some filter to allow special, underscores etc...

 http://web2py.com/book/default/docstring/IS_ALPHANUMERIC









 On Sun, Aug 28, 2011 at 1:54 PM, Saurabh Sawant ris...@gmail.com wrote:
  Hi,

  I think these validators would be a nice addition to the great set of
  validators we already have. They can be useful for fields for names
  and phone numbers.

  class IS_LETTERS(Validator):
     
     Checks if field's value consists of all letters

     example::

         INPUT(_type='text', _name='name', requires=IS_LETTERS())

          IS_LETTERS()(A)
         ('A', None)
          IS_LETTERS()()
         ('', None)
          IS_LETTERS()(A_)
         ('A_', 'enter only letters')
          IS_LETTERS()(!)
         ('!', 'enter only letters')
     

     def __init__(self, error_message='enter only letters'):
         IS_MATCH.__init__(self, '^[A-Za-z]*$', error_message)

  class IS_DIGITS(Validator):
     
     Checks if field's value consists of all numeric digits

     example::

         INPUT(_type='text', _name='name', requires=IS_DIGITS())

          IS_NUMBERS()(1)
         ('1', None)
          IS_NUMBERS()()
         ('', None)
          IS_NUMBERS()(A)
         ('A', 'enter only numbers')
          IS_NUMBERS()(!)
         ('!', 'enter only numbers')
     

     def __init__(self, error_message='enter only digits'):
         IS_MATCH.__init__(self, '^[0-9]*$', error_message)

  Regards,
  Saurabh Sawant

 --

 --
 Bruno Rocha
 [ About me:http://zerp.ly/rochacbruno]
 [ Aprenda a programar:http://CursoDePython.com.br]
 [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
 [ Consultoria em desenvolvimento web:http://www.blouweb.com]


[web2py] Re: Useful validators IS_LETTERS, IS_DIGITS

2011-08-28 Thread Massimo Di Pierro
what's wrong with?

IS_MATCH('[0-9]+')
IS_MATCH('[a-zA-Z]+')

On Aug 28, 12:59 pm, Saurabh  Sawant ris...@gmail.com wrote:
 But IS_ALPHANUMERIC by virtue of its name suggests both letters and
 numbers. Having separate validators for each of the cases would make
 the code more readable.

 db.auth_user.first_name.requires=IS_LETTERS()
 db.auth_user.age.requires=IS_DIGITS()

 is more readable and less ambiguous than

 db.auth_user.first_name.requires=IS_ALPHANUMERIC(filter='letters')
 db.auth_user.mobile.requires=IS_ALPHANUMERIC(filter='numbers')

 On Aug 28, 10:13 pm, Bruno Rocha rochacbr...@gmail.com wrote:







  Or maybe the IS_ALPHANUMERIC can be extended and receive aditional argument
  'filter' to allow only letters or only numbers

  IS_ALPHANUMERIC(error_message='', filter='numbers') # to allow only
  digits
  IS_ALPHANUMERIC(error_message='', filter='letters')  # to allow letters

  can have some filter to allow special, underscores etc...

 http://web2py.com/book/default/docstring/IS_ALPHANUMERIC

  On Sun, Aug 28, 2011 at 1:54 PM, Saurabh Sawant ris...@gmail.com wrote:
   Hi,

   I think these validators would be a nice addition to the great set of
   validators we already have. They can be useful for fields for names
   and phone numbers.

   class IS_LETTERS(Validator):
      
      Checks if field's value consists of all letters

      example::

          INPUT(_type='text', _name='name', requires=IS_LETTERS())

           IS_LETTERS()(A)
          ('A', None)
           IS_LETTERS()()
          ('', None)
           IS_LETTERS()(A_)
          ('A_', 'enter only letters')
           IS_LETTERS()(!)
          ('!', 'enter only letters')
      

      def __init__(self, error_message='enter only letters'):
          IS_MATCH.__init__(self, '^[A-Za-z]*$', error_message)

   class IS_DIGITS(Validator):
      
      Checks if field's value consists of all numeric digits

      example::

          INPUT(_type='text', _name='name', requires=IS_DIGITS())

           IS_NUMBERS()(1)
          ('1', None)
           IS_NUMBERS()()
          ('', None)
           IS_NUMBERS()(A)
          ('A', 'enter only numbers')
           IS_NUMBERS()(!)
          ('!', 'enter only numbers')
      

      def __init__(self, error_message='enter only digits'):
          IS_MATCH.__init__(self, '^[0-9]*$', error_message)

   Regards,
   Saurabh Sawant

  --

  --
  Bruno Rocha
  [ About me:http://zerp.ly/rochacbruno]
  [ Aprenda a programar:http://CursoDePython.com.br]
  [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
  [ Consultoria em desenvolvimento web:http://www.blouweb.com]


Re: [web2py] parametric router enhancements

2011-08-28 Thread Jonathan Lundell
On Aug 28, 2011, at 10:44 AM, Bruno Rocha wrote:

 Lets say I have a dict of all my controlers/actions
 
 dict(default=['index','page'], account=['user','login','profile','logout'])
 
 when requests any that are in the dict should be executed, normal.. but
 
 if request anything that are not in the dict I want to pass it to a default 
 function, example:
 
 myapp/default/index # default/index is in dict should run normally
 
 myapp/jonathan # jonathan is not in dict, so should execute account/user and 
 pass 'jonathan' as request.args(0)
 
 I can do it using routes on error, but it is not elegant.
 
 is there a better way?
 

Maybe... So per the above, you have

functions = dict(default=['index','page'], 
account=['user','login','profile','logout'])

If you also have:

default_controller = 'account'
default_function = dict(default='index', account='user')

...then it should work as you describe. The downside is that you have to make 
'account' the default controller, since you want myapp/jonathan to default to 
that controller. If you don't want that, then you might want to make a proxy 
'user' function in the 'default' controller that redirects or something to the 
real account/user.



[web2py] Re: pip install web2py

2011-08-28 Thread Christopher Steel
You found a glitch, good call nekrox.

The updated version does not include env.tar for some reason, I will check 
it out.

In the mean tine here a link to the old version which does include env.tar 
(it is also included in Web2py)

http://pypi.python.org/packages/source/w/web2py/web2py-1.96.4.tar.gz

Chris


[web2py] Re: Useful validators IS_LETTERS, IS_DIGITS

2011-08-28 Thread Saurabh Sawant
Hi Massimo,

They seem fine. Although, having ready to use validators would save
some time for those learning the framework. I personally expected
those validators to be already there while I was learning.

On Aug 28, 11:05 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 what's wrong with?

 IS_MATCH('[0-9]+')
 IS_MATCH('[a-zA-Z]+')

 On Aug 28, 12:59 pm, Saurabh  Sawant ris...@gmail.com wrote:







  But IS_ALPHANUMERIC by virtue of its name suggests both letters and
  numbers. Having separate validators for each of the cases would make
  the code more readable.

  db.auth_user.first_name.requires=IS_LETTERS()
  db.auth_user.age.requires=IS_DIGITS()

  is more readable and less ambiguous than

  db.auth_user.first_name.requires=IS_ALPHANUMERIC(filter='letters')
  db.auth_user.mobile.requires=IS_ALPHANUMERIC(filter='numbers')

  On Aug 28, 10:13 pm, Bruno Rocha rochacbr...@gmail.com wrote:

   Or maybe the IS_ALPHANUMERIC can be extended and receive aditional 
   argument
   'filter' to allow only letters or only numbers

   IS_ALPHANUMERIC(error_message='', filter='numbers') # to allow only
   digits
   IS_ALPHANUMERIC(error_message='', filter='letters')  # to allow 
   letters

   can have some filter to allow special, underscores etc...

  http://web2py.com/book/default/docstring/IS_ALPHANUMERIC

   On Sun, Aug 28, 2011 at 1:54 PM, Saurabh Sawant ris...@gmail.com wrote:
Hi,

I think these validators would be a nice addition to the great set of
validators we already have. They can be useful for fields for names
and phone numbers.

class IS_LETTERS(Validator):
   
   Checks if field's value consists of all letters

   example::

       INPUT(_type='text', _name='name', requires=IS_LETTERS())

        IS_LETTERS()(A)
       ('A', None)
        IS_LETTERS()()
       ('', None)
        IS_LETTERS()(A_)
       ('A_', 'enter only letters')
        IS_LETTERS()(!)
       ('!', 'enter only letters')
   

   def __init__(self, error_message='enter only letters'):
       IS_MATCH.__init__(self, '^[A-Za-z]*$', error_message)

class IS_DIGITS(Validator):
   
   Checks if field's value consists of all numeric digits

   example::

       INPUT(_type='text', _name='name', requires=IS_DIGITS())

        IS_NUMBERS()(1)
       ('1', None)
        IS_NUMBERS()()
       ('', None)
        IS_NUMBERS()(A)
       ('A', 'enter only numbers')
        IS_NUMBERS()(!)
       ('!', 'enter only numbers')
   

   def __init__(self, error_message='enter only digits'):
       IS_MATCH.__init__(self, '^[0-9]*$', error_message)

Regards,
Saurabh Sawant

   --

   --
   Bruno Rocha
   [ About me:http://zerp.ly/rochacbruno]
   [ Aprenda a programar:http://CursoDePython.com.br]
   [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
   [ Consultoria em desenvolvimento web:http://www.blouweb.com]


[web2py] Re: pip install web2py

2011-08-28 Thread Christopher Steel
Note: We ( I? ) could get a mercurial repo going for this in order to make 
it easier to maintain. Now it is a scattered collection of files. In the 
mean time here is a rough how to for anyone that needs it...

Creating your own pip installable pypi dstribution of Web2py

If you have the latest version of Web2py it is easy to create your own 
custom pip installable Web2py package.

Option 1

For testing you can create the pypi package (pypi refers to them as 
distributions) by running the following command in the targeted version of 
Web2py::

cd web2py
rm ./dist/web2py-1.98.2.tar.gz
python setup.py sdist

Running the command in web2py directory of Web2py version 1.98.2 will result 
in the creation of a new pip installable distribution in ./web2py/dist::

./web2py/dist/web2py-1.98.2.tar.gz

Installing via pip

You can then install the new package via pip by running something like the 
following::

pip install ./dist/web2py-1.98.2.tar.gz

and you will

Option 2 -  Automation

You can create the pypi package from any up to date installation of web2py 
manually doing something like this::

cd web2py
make pip

If run from Web2py version 1.98.2 will result in::

./web2py/dist/web2py-1.98.2.tar.gz


BUG as of 2011-08-28

env.tar

env.tar is suppose to be automatically created and copied to the resulting 
tar.gz's gluon directory. This is not working at the moment so you will need 
to do this manually.




[web2py] Re: GAE select all does not iterate

2011-08-28 Thread howesc
ok, i noted one difference is that i don't use the db.table.ALL in my 
selects.  i'll do some testing and see if i can figure it out.

cfh


Re: [web2py] Re: [tip] for those who likes jQUery UI

2011-08-28 Thread Martín Mulone
beautifull what is the difference free and commercial?

2011/8/28 Bruno Rocha rochacbr...@gmail.com



 On Sun, Aug 28, 2011 at 1:51 PM, pbreit pbreitenb...@gmail.com wrote:

 It's nice but still too thick for my tastes. I wish these types of
 libraries would be designed to fit in better with a broader array of site
 designs. They all need so many modifications to avoid clashing with an
 existing site.


 I have no problem with existing sites, just 4 files added (Jquery,
 JqueryUI, Wijmo.js, Wijmo.css)

 The css are explicity and does not override any other declaration, only
 affects objects with ui- classes, the initialization of objects are
 explicity too and almost all done in one line of JS.

 Example

 $('#mytable').wijgrid(); // grid rendered

 $('.myinputclass').wijmocombobox(); // combobox rendered

 The templates are fully customizable using ThemeRoller to create a new
 theme or editing CSS by hand, to the things you dont like you can always
 override somewhere with !important in css.

 What problems are you having with this kind of approach?




-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: Lost with simple replace + db.select() result

2011-08-28 Thread Yuushi
row.update_record was indeed what I was looking for, thank you I got
it working now, probably best if I deal with the manipulation in the
controller anyway.

On 28 aug, 15:37, Alan Etkin spame...@gmail.com wrote:
 I would make the db query in the controller file and pass the Rows
 object to the view to present the data. ¿Is'n that more MVC-ish? Even
 the function could be defined in the controller and passed in the
 response. For the Shouts field of the record i would check the model
 for conflicts/errors.

 A way of changing the Shout str should be:
 row.update_record(Shout = [transformed shout])

 On 28 ago, 09:17, Yuushi yuushiceleri...@gmail.com wrote:







  This has kept me up quite a few hours last night, this morning I woke
  up and I still have no clue how to approach this. I am still pretty
  new to Python  web2py but I can't believe a simple string function
  gives me so much grief.

  My goal:
  I am making a simple shoutbox for practice purposes, it uses a
  database with the colloms: Shout,created_on,created_by
  I have a database result set in the controller of the shoutbox
  (   shouts = db(db.shouts).select(orderby=~db.shouts.created_on)   ).
  Now the problem I run into is when I want to implement a simple emote
  system. Basicly I want to perform a simple string replace on
  shouts.Shout.

  Because I have no idea how to manipulate the database result set
  (which I also would like to know) I figured I would deal with it in
  the view, not really ideal I would guess.

  So I have a function in a module:

  def ParseEmote(text):
      text = text.replace(test,bla)
      return text

  in the view I have:
      {{for shout in shouts:}}
          {{result = functions.timesince(shout.created_on)}}
          div style=font-size:12px;
              span
  style=color:#0F0{{=db.auth_user[shout.created_by].first_name}}/
  span
              span style=color:#999;says ({{=result}} ago): /
  span
          /div
          {{=functions.ParseEmote(shout.Shout)}}
      {{pass}}

  The error I get is:
  Traceback (most recent call last):
    File gluon/restricted.py, line 192, in restricted
    File G:\web2py\applications\the_old_republic\views\default/
  shoutbox.html, line 15, in module
    File applications/The_Old_Republic/controllers/functions.py, line
  7, in ParseEmote
  AttributeError: 'NoneType' object has no attribute 'replace'

  Now my question is:
  1. How can I modify my ParseEmote function to deal with the
  shout.Shout variable which seems to be a NoneType which I dont really
  get. Its not really the best solution but I might come in handy later.
  2. Is there a way I can get a similar result by just using just the
  controller? something like (but then working):

  shouts = db(db.shouts).select(orderby=~db.shouts.created_on)
  for s in shouts:
     s.Shout.replace(:emote1:,somehtml)
  pass

  Regards,
  Yuushi


Re: [web2py] Re: Useful validators IS_LETTERS, IS_DIGITS

2011-08-28 Thread Jonathan Lundell
On Aug 28, 2011, at 11:23 AM, Saurabh Sawant wrote:

 They seem fine. Although, having ready to use validators would save
 some time for those learning the framework. I personally expected
 those validators to be already there while I was learning.

Trouble is, there's an endless list of pattern expressions that can be useful. 
IS_MATCH is pretty powerful, and should be in your bag of tricks (in fact, 
IS_ALPHANUMERIC just calls IS_MATCH).

At the very least, consider that you might want a language-dependent 
IS_LETTERS, or at least one that accepts the common alphabetic variants.

However, if you do that, do it this way:

IS_MATCH('[0-9]+', strict=True)
IS_MATCH('[a-zA-Z]+', strict=True)

strict=True forces a $ at the end of the regex. Or you can just include the $. 
(IS_MATCH is already anchored at the beginning of the string.)

 
 On Aug 28, 11:05 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
 what's wrong with?
 
 IS_MATCH('[0-9]+')
 IS_MATCH('[a-zA-Z]+')
 
 On Aug 28, 12:59 pm, Saurabh  Sawant ris...@gmail.com wrote:
 
 
 
 
 
 
 
 But IS_ALPHANUMERIC by virtue of its name suggests both letters and
 numbers. Having separate validators for each of the cases would make
 the code more readable.
 
 db.auth_user.first_name.requires=IS_LETTERS()
 db.auth_user.age.requires=IS_DIGITS()
 




[web2py] crud not updating

2011-08-28 Thread apple
If the database fails to update within CRUD is there a way I can view
the error?

I have a controller with this code that works fine:
   form=SQLFORM(table,a.id)
   if form.accepts(request.vars, session):
   response.flash=record updated

I replace it with:
  form=crud.update(table, a.id)

Now it works fine the first time the form is changed. Then the second
time it correctly calls the controller but the database is not updated
and the form reverts to the pre-change values. This continues so on
odd submits it works and even submits it does not.

It also seems to work on all submits when I excluded certain fields. I
am thinking maybe there is a database error thrown inside CRUD but no
error message is logged.


[web2py] Re: GAE select all does not iterate

2011-08-28 Thread howesc
here is what i just tried:

db.define_table('menu_item',
  Field('created_on','datetime', default=request.now,writable=False),
  Field('name', length=500, notnull=True, unique=True,
requires=IS_NOT_IN_DB(db, 'menu_item.name')),
  migrate=migrate)

then in controller:

def index():

data=db(db.menu_item.created_on).select(orderby=~db.menu_item.created_on, 
limitby=(0,20))

data2=db().select(db.menu_item.ALL,orderby=~db.menu_item.created_on, 
limitby=(0,20))

return dict(data=data, data2=data2)


then in view:

{{=BEAUTIFY(response._vars)}}

h1data/h1
{{for d in data:}}
  {{=d.name}}br /
{{pass}}

hr /
h1data2/h1
{{for d in data2:}}
  {{=d.name}}br /
{{pass}}

and got exactly what i was expecting.  some things i noticed:
 - i don't think db(db.menu_item.created_on) is a valid query.  it needs to 
be compared to something right?  (i know it works, but it seems wrong to me)
 - print doesn't work on GAE (there is no console to output to in that 
environment) so i assumed you were either using logging or outputting in a 
view

can you tell me more, or send me a minimal application that produces the 
problem and i'll try it out too?  it sounds like something is up, so let's 
get to the bottom of it and get it fixed!

christian



[web2py] Re: crud not updating

2011-08-28 Thread apple
On further investigation this is not a database problem. The reason
for the failed update is that the formkey is the same on the first/
second submission and third/fourth submission etc..

The first time the form is generated is using LOAD with ajax=false.
The subsequent submits are via ajax.

What would cause the formkey to be the same? There is a long pause and
some typing between the two submits so it is not an accidental double
click.

On Aug 28, 8:18 pm, apple simo...@gmail.com wrote:
 If the database fails to update within CRUD is there a way I can view
 the error?

 I have a controller with this code that works fine:
        form=SQLFORM(table,a.id)
        if form.accepts(request.vars, session):
            response.flash=record updated

 I replace it with:
       form=crud.update(table, a.id)

 Now it works fine the first time the form is changed. Then the second
 time it correctly calls the controller but the database is not updated
 and the form reverts to the pre-change values. This continues so on
 odd submits it works and even submits it does not.

 It also seems to work on all submits when I excluded certain fields. I
 am thinking maybe there is a database error thrown inside CRUD but no
 error message is logged.


[web2py] uncaught exception -- problem with web2py_ajax_init?

2011-08-28 Thread weheh
I'm getting the following error in Firebug on Firefox. It points to
web2py_ajax_init(). Sorry about the bad spacing here, it's what comes
from cut and paste. The scenario is I have multiple LOADed forms on
one page. When I click on a submit button, I get this message printed
a gazillion times.


uncaught exception: [Exception... Could not convert JavaScript
argument arg 0 [nsISupports.QueryInterface] nsresult: 0x80570009
(NS_ERROR_XPC_BAD_CONVERT_JS) location: JS frame ::
file:///C:/Program%20Files%20(x86)/Norton%20Internet%20Security/Engine/18.6.0.29/rfhelper32.js
:: TOP_LEVEL :: line 348 data: no]
web2py_ajax_init()index (line 64)
complete(xhr=XMLHttpRequest { responseText=spanform
action= .../div/form/span\r\n, response=spanform
action= .../div/form/span\r\n, status=200, more...},
text=success)index (line 99)
complete()jquery-latest.js (line 5281)
onreadystatechange(isTimeout=readystatechange )jquery-latest.js (line
5216)
[Break On This Error] try { jQuery(input.time).timeEntry(); }
catch(e) {};


[web2py] Re: uncaught exception -- problem with web2py_ajax_init?

2011-08-28 Thread weheh
1 more tidbit -- I don't see this problem on Chrome.


[web2py] Re: uncaught exception -- problem with web2py_ajax_init?

2011-08-28 Thread weheh
oh, and 1 more tidbit: I don't see this problem if there is only one
LOADed form.


Re: [web2py] parametric router enhancements

2011-08-28 Thread Bruno Rocha
Proxy is a great idea, but I would like to keep the url as it is.

I will make account the default controller, and in account I will create a
proxy to redirect to the index page if passed /index, or something like
this.

Thanks.


Re: [web2py] Re: [tip] for those who likes jQUery UI

2011-08-28 Thread Bruno Rocha
free - http://wijmo.com/Wijmo-Open/samples/

comercial - http://wijmo.com/Wijmo-Complete/samples/



On Sun, Aug 28, 2011 at 3:44 PM, Martín Mulone mulone.mar...@gmail.comwrote:

 beautifull what is the difference free and commercial?


 2011/8/28 Bruno Rocha rochacbr...@gmail.com



 On Sun, Aug 28, 2011 at 1:51 PM, pbreit pbreitenb...@gmail.com wrote:

 It's nice but still too thick for my tastes. I wish these types of
 libraries would be designed to fit in better with a broader array of site
 designs. They all need so many modifications to avoid clashing with an
 existing site.


 I have no problem with existing sites, just 4 files added (Jquery,
 JqueryUI, Wijmo.js, Wijmo.css)

 The css are explicity and does not override any other declaration, only
 affects objects with ui- classes, the initialization of objects are
 explicity too and almost all done in one line of JS.

 Example

 $('#mytable').wijgrid(); // grid rendered

 $('.myinputclass').wijmocombobox(); // combobox rendered

 The templates are fully customizable using ThemeRoller to create a new
 theme or editing CSS by hand, to the things you dont like you can always
 override somewhere with !important in css.

 What problems are you having with this kind of approach?




 --
  http://martin.tecnodoc.com.ar




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] parametric router enhancements

2011-08-28 Thread Jonathan Lundell
On Aug 28, 2011, at 2:26 PM, Bruno Rocha wrote:

 Proxy is a great idea, but I would like to keep the url as it is.
 
 I will make account the default controller, and in account I will create a 
 proxy to redirect to the index page if passed /index, or something like this.
 

It'd be nice to have a local redirect. I wonder if that's practical. Something 
to tell the web2py dispatcher to redirect to a different controller/function 
without going back to the client.



[web2py] Re: crud not updating

2011-08-28 Thread Anthony
What version of web2py? Can you show more of your controller and view code?


On Sunday, August 28, 2011 3:28:10 PM UTC-4, apple wrote:

 On further investigation this is not a database problem. The reason 
 for the failed update is that the formkey is the same on the first/ 
 second submission and third/fourth submission etc.. 

 The first time the form is generated is using LOAD with ajax=false. 
 The subsequent submits are via ajax. 

 What would cause the formkey to be the same? There is a long pause and 
 some typing between the two submits so it is not an accidental double 
 click. 

 On Aug 28, 8:18 pm, apple sim...@gmail.com wrote: 
  If the database fails to update within CRUD is there a way I can view 
  the error? 
  
  I have a controller with this code that works fine: 
 form=SQLFORM(table,a.id) 
 if form.accepts(request.vars, session): 
 response.flash=record updated 
  
  I replace it with: 
form=crud.update(table, a.id) 
  
  Now it works fine the first time the form is changed. Then the second 
  time it correctly calls the controller but the database is not updated 
  and the form reverts to the pre-change values. This continues so on 
  odd submits it works and even submits it does not. 
  
  It also seems to work on all submits when I excluded certain fields. I 
  am thinking maybe there is a database error thrown inside CRUD but no 
  error message is logged.



[web2py] Re: Lost with simple replace + db.select() result

2011-08-28 Thread Anthony
On Sunday, August 28, 2011 1:08:45 PM UTC-4, pbreit wrote:

 Put ParseEmote in the same controller and just call it like this:

   {{=ParseEmote(shout.Shout)}}


Note, functions/objects defined in the controller are generally not 
available in the view unless explicitly passed in the dict returned by the 
called action. The view is executed in a copy of the same environment the 
controller is executed in (i.e., with all the models), updated to include 
the variables returned in the dict by the action.

Anthony


[web2py] Re: parametric router enhancements

2011-08-28 Thread Massimo Di Pierro
Technically you can do:

def a():
if request.vars.test:
 response.view = 'default/b.html'
 return b()
return dict()

def b():
return dict()

Anyway, take a look at these lines in main.py:

http_response, new_environ = rewrite.try_rewrite_on_error(
http_response, request, environ, ticket)
if not http_response:
return wsgibase(new_environ,responder)

perhaps we can use them to implement a redirect(URL(), local=True)


On Aug 28, 4:40 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Aug 28, 2011, at 2:26 PM, Bruno Rocha wrote:

  Proxy is a great idea, but I would like to keep the url as it is.

  I will make account the default controller, and in account I will create a 
  proxy to redirect to the index page if passed /index, or something like 
  this.

 It'd be nice to have a local redirect. I wonder if that's practical. 
 Something to tell the web2py dispatcher to redirect to a different 
 controller/function without going back to the client.


Re: [web2py] Re: parametric router enhancements

2011-08-28 Thread Jonathan Lundell
On Aug 28, 2011, at 3:05 PM, Massimo Di Pierro wrote:

 Technically you can do:

But only in the same controller.

 
 def a():
if request.vars.test:
 response.view = 'default/b.html'
 return b()
return dict()
 
 def b():
return dict()
 
 Anyway, take a look at these lines in main.py:
 
http_response, new_environ = rewrite.try_rewrite_on_error(
http_response, request, environ, ticket)
if not http_response:
return wsgibase(new_environ,responder)
 
 perhaps we can use them to implement a redirect(URL(), local=True)

Yeah, I was thinking along those lines. Not sure if it's worth it, and it'd be 
easy to misuse, but a full redirect is pretty expensive (time, not cycles).

 
 
 On Aug 28, 4:40 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Aug 28, 2011, at 2:26 PM, Bruno Rocha wrote:
 
 Proxy is a great idea, but I would like to keep the url as it is.
 
 I will make account the default controller, and in account I will create a 
 proxy to redirect to the index page if passed /index, or something like 
 this.
 
 It'd be nice to have a local redirect. I wonder if that's practical. 
 Something to tell the web2py dispatcher to redirect to a different 
 controller/function without going back to the client.




[web2py] Re: pip install web2py

2011-08-28 Thread Christopher Steel

Fix is posted here

http://code.google.com/p/web2pypi/

basically copy everything into web2py's main directory and then from the 
terminal run:

python setup sdist

This will create an updated package in web2py/dist that you can install 
using similar to:

pip install web2py-1.98.2.tar.gz

I will get these out to Massimo and update pypi as well...

Cheers

Chris


[web2py] Insert Selects with web2py

2011-08-28 Thread Andrew
Hi all,
Another question that may straddle the User / Developer groups.

I am building an application where I want to do some set based data
integration, in particular I want to be able to run an Insert Select
statement.   This is different to the bulk_insert, which loops through
a set of rows, inserting one at a time.   I need to insert them as a
set as the data volume will be very large.  I can't find this topic
raised in the book or the groups.

I'm trying to figure out which is the best way of tackling this in a
web2py environment.
I have played around with creating some table / transform metadata
tables, and using the response.render function with a script template
enough to know that I can build a Insert Select script that I can run
using executesql statement, or using a proprietary buld load / SQL
tool from the os.

I am quite impressd with how such an application comes together in
web2py, but is this the right approach ?
I believe the current Insert function does not support the Insert
Select scenario.  Is this something that the Insert function should
support, in which case I don't mind contributing to make it happen ?
Any other ideas or comments.

Thanks
Andrew

P.S.  I am trying to achieve a Metadata driven Template Based SQL
Generator, something similar to what I recently stumbled across at
http://www.xdtl.org/.   That is a Java / XML / MOF based approach so I
believe it is not something I can easily import into web2py. I also
think I can develop a solution simpler and faster in web2py.


[web2py] Re: validators.py IS_IN_DB.__call__ elif self.theset must compare with str instead?

2011-08-28 Thread Carlos
Hi,

You can reproduce the error in shell:

x = IS_IN_DB(db, db.auth_user.id)
x(1)ok, found
x.options()ok, options
x(1)WRONG, not found anymore ('value not in database')

If we apply the fix I propose in my original post, this will be solved.

Thanks,

   Carlos



[web2py] Re: crud not updating

2011-08-28 Thread apple
1.98.2

I have narrowed the problem down to the crud.update call. I do three
submits with the same data to this controller:

print(RR,request.vars)
print(SS,session['_formkey[customer/1]'])
form=crud.update(table, a.id, onaccept=onaccept)
print(TT,session['_formkey[customer/1]'])

The first submit shows formkey 708 in request and session; onaccept is
called; and session formkey is still 708.

The second submit with identical data shows formkey 708 in request and
session; onaccept is NOT called; and session formkey comes out as 154.

The third submit with identical data shows formkey 154 in request and
session; onaccept is called; and session formkey is still 154.

On Aug 28, 10:51 pm, Anthony abasta...@gmail.com wrote:
 What version of web2py? Can you show more of your controller and view code?







 On Sunday, August 28, 2011 3:28:10 PM UTC-4, apple wrote:

  On further investigation this is not a database problem. The reason
  for the failed update is that the formkey is the same on the first/
  second submission and third/fourth submission etc..

  The first time the form is generated is using LOAD with ajax=false.
  The subsequent submits are via ajax.

  What would cause the formkey to be the same? There is a long pause and
  some typing between the two submits so it is not an accidental double
  click.

  On Aug 28, 8:18 pm, apple sim...@gmail.com wrote:
   If the database fails to update within CRUD is there a way I can view
   the error?

   I have a controller with this code that works fine:
          form=SQLFORM(table,a.id)
          if form.accepts(request.vars, session):
              response.flash=record updated

   I replace it with:
         form=crud.update(table, a.id)

   Now it works fine the first time the form is changed. Then the second
   time it correctly calls the controller but the database is not updated
   and the form reverts to the pre-change values. This continues so on
   odd submits it works and even submits it does not.

   It also seems to work on all submits when I excluded certain fields. I
   am thinking maybe there is a database error thrown inside CRUD but no
   error message is logged.


Re: [web2py] Insert Selects with web2py

2011-08-28 Thread Bruno Rocha
I am not sure if DAL can handle SQL mult-insertions but you can build a
string and do:

db.execute_sql(INSERT IN)


[web2py] Re: Insert Selects with web2py

2011-08-28 Thread Andrew
Thanks Bruno,
That's exactly the approach I was planning to take, but I wanted to
confirm if there is other alternatives that make more use of DAL.  And
if the DAL doesn't support it, should it ?

On Aug 29, 11:54 am, Bruno Rocha rochacbr...@gmail.com wrote:
 I am not sure if DAL can handle SQL mult-insertions but you can build a
 string and do:

 db.execute_sql(INSERT IN)


[web2py] [tip] Python Cloud IDE

2011-08-28 Thread Bruno Rocha
http://pythonfiddle.com/

Maybe they can include gluon in packages


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]


[web2py] Re: pip install web2py

2011-08-28 Thread Christopher Steel
Done, now in trunk and in Pypi.

See http://code.google.com/p/web2pypi/ for details 

Running:

pip install web2py

now gives you 

w2p_clone - replaces web2py_clone

w2p_apps - replaces mkweb2pyenv

w2p_run - replaces runweb2py

Cheers,

Chris

[web2py] Compile from command line

2011-08-28 Thread Mike Veltman

Its pretty annoying because I did know it before.

Does anybody know what the command is to compile from the command line ? 

Also is there are website or part of the book that will collect this so I can 
add it ?

Thanks in advance.



With regards,
Mike Veltman




Re: [web2py] Compile from command line

2011-08-28 Thread Anthony
All the functions available in the 'admin' app are available in 
/gluon/admin.py for command line use. The function for compiling the app is 
app_compile(app, request), which in turn calls 
gluon.compileapp.compile_application. I don't think this is documented in 
the book.

Anthony

On Sunday, August 28, 2011 9:05:11 PM UTC-4, Gwayne aka Mike Veltman wrote:


 Its pretty annoying because I did know it before.

 Does anybody know what the command is to compile from the command line ? 

 Also is there are website or part of the book that will collect this so I 
 can 
 add it ?

 Thanks in advance.

 With regards,
 Mike Veltman




Re: [web2py] Compile from command line

2011-08-28 Thread Bruno Rocha
here: http://thadeusb.com/weblog/2010/4/21/compile_web2py_apps_externally

python -c import gluon.compileapp;
gluon.compileapp.compile_application('applications/appname')



On Sun, Aug 28, 2011 at 10:05 PM, Mike Veltman mike.velt...@gmail.comwrote:


 Its pretty annoying because I did know it before.

 Does anybody know what the command is to compile from the command line ?

 Also is there are website or part of the book that will collect this so I
 can
 add it ?

 Thanks in advance.



 With regards,
 Mike Veltman





-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] Compile from command line

2011-08-28 Thread Bruno Rocha
On Sun, Aug 28, 2011 at 10:42 PM, Anthony abasta...@gmail.com wrote:

 All the functions available in the 'admin' app are available in
 /gluon/admin.py for command line use. The function for compiling the app is
 app_compile(app, request), which in turn calls
 gluon.compileapp.compile_application. I don't think this is documented in
 the book.


All Thadeus articles from here:
http://thadeusb.com/weblog/category/Web2py Should
go somewhere in the book!


[web2py] Re: crud not updating

2011-08-28 Thread Anthony
Please send the full controller and view code (or minimal code that 
replicates the problem).

On Sunday, August 28, 2011 7:06:40 PM UTC-4, apple wrote:

 1.98.2 

 I have narrowed the problem down to the crud.update call. I do three 
 submits with the same data to this controller: 

 print(RR,request.vars) 
 print(SS,session['_formkey[customer/1]']) 
 form=crud.update(table, a.id, onaccept=onaccept) 
 print(TT,session['_formkey[customer/1]']) 

 The first submit shows formkey 708 in request and session; onaccept is 
 called; and session formkey is still 708. 

 The second submit with identical data shows formkey 708 in request and 
 session; onaccept is NOT called; and session formkey comes out as 154. 

 The third submit with identical data shows formkey 154 in request and 
 session; onaccept is called; and session formkey is still 154. 

 On Aug 28, 10:51 pm, Anthony abas...@gmail.com wrote: 
  What version of web2py? Can you show more of your controller and view 
 code? 
  
  
  
  
  
  
  
  On Sunday, August 28, 2011 3:28:10 PM UTC-4, apple wrote: 
  
   On further investigation this is not a database problem. The reason 
   for the failed update is that the formkey is the same on the first/ 
   second submission and third/fourth submission etc.. 
  
   The first time the form is generated is using LOAD with ajax=false. 
   The subsequent submits are via ajax. 
  
   What would cause the formkey to be the same? There is a long pause and 
   some typing between the two submits so it is not an accidental double 
   click. 
  
   On Aug 28, 8:18 pm, apple sim...@gmail.com wrote: 
If the database fails to update within CRUD is there a way I can view 

the error? 
  
I have a controller with this code that works fine: 
   form=SQLFORM(table,a.id) 
   if form.accepts(request.vars, session): 
   response.flash=record updated 
  
I replace it with: 
  form=crud.update(table, a.id) 
  
Now it works fine the first time the form is changed. Then the second 

time it correctly calls the controller but the database is not 
 updated 
and the form reverts to the pre-change values. This continues so on 
odd submits it works and even submits it does not. 
  
It also seems to work on all submits when I excluded certain fields. 
 I 
am thinking maybe there is a database error thrown inside CRUD but no 

error message is logged.



Re: [web2py] Re: crud not updating

2011-08-28 Thread Bruno Rocha
if onaccept raises an exception, there will be a rollback?


Re: [web2py] Compile from command line

2011-08-28 Thread Mike Veltman
 here: http://thadeusb.com/weblog/2010/4/21/compile_web2py_apps_externally
 
 python -c import gluon.compileapp;
 gluon.compileapp.compile_application('applications/appname')
 
 On Sun, Aug 28, 2011 at 10:05 PM, Mike Veltman 
mike.velt...@gmail.comwrote:
  Its pretty annoying because I did know it before.
  
  Does anybody know what the command is to compile from the command line ?
  
  Also is there are website or part of the book that will collect this so I
  can
  add it ?
  
  Thanks in advance.
  
  
  
  With regards,
  Mike Veltman


That was it ! thanks :)

With regards,
Mike Veltman




[web2py] Re: Lost with simple replace + db.select() result

2011-08-28 Thread pbreit
Ah, ok, for some reason I thought controller functions were available to the 
view.

row.update_record is going to actually modify the text in the database (if 
that's what you want). What you originally had and what I proposed only 
affected it displayed while leaving the record in its original form in the 
database.

Re: [web2py] Re: [tip] for those who likes jQUery UI

2011-08-28 Thread pbreit
I meant the look and feel. The designs of many of these types of libraries 
are so stylized that they always seem to clash with existing sites.

Re: [web2py] Re: [tip] for those who likes jQUery UI

2011-08-28 Thread Bruno Rocha
On Mon, Aug 29, 2011 at 12:32 AM, pbreit pbreitenb...@gmail.com wrote:

 I meant the look and feel. The designs of many of these types of libraries
 are so stylized that they always seem to clash with existing sites.


You do not have do use default themes, you can start with a clean theme and
customize by your own. http://bit.ly/uiclean


[web2py] Re: GAE select all does not iterate

2011-08-28 Thread Jarrod Cugley
Here is my actual controller, it iterates perfectly on a web2py
server, but as soon as upload the exact same files to GAE it doesn't
iterate.

***
def livesearch():
'''Auto completes the search query'''
partialstr = request.vars.partialstr
query = db.listing.title.like('%'+partialstr+'%')
titles = db(query).select(db.listing.ALL)
items = []

for title in titles:
items.append(DIV(A(title.title, _id=livesearch_item,
_href=URL('search', args=title.title.replace(' ','-')

return TAG[''](*items)
***

I just realised I'm getting this error on GAE:

def LIKE(self,first,second): raise SyntaxError, Not supported
SyntaxError: Not supported

Does like() not work on GAE? How do I fix this? It works fine on the
web2py server.


On Aug 29, 5:24 am, howesc how...@umich.edu wrote:
 here is what i just tried:

 db.define_table('menu_item',
   Field('created_on','datetime', default=request.now,writable=False),
   Field('name', length=500, notnull=True, unique=True,
         requires=IS_NOT_IN_DB(db, 'menu_item.name')),
   migrate=migrate)

 then in controller:

 def index():

 data=db(db.menu_item.created_on).select(orderby=~db.menu_item.created_on,
 limitby=(0,20))

     data2=db().select(db.menu_item.ALL,orderby=~db.menu_item.created_on,
 limitby=(0,20))

     return dict(data=data, data2=data2)

 then in view:

 {{=BEAUTIFY(response._vars)}}

 h1data/h1
 {{for d in data:}}
   {{=d.name}}br /
 {{pass}}

 hr /
 h1data2/h1
 {{for d in data2:}}
   {{=d.name}}br /
 {{pass}}

 and got exactly what i was expecting.  some things i noticed:
  - i don't think db(db.menu_item.created_on) is a valid query.  it needs to
 be compared to something right?  (i know it works, but it seems wrong to me)
  - print doesn't work on GAE (there is no console to output to in that
 environment) so i assumed you were either using logging or outputting in a
 view

 can you tell me more, or send me a minimal application that produces the
 problem and i'll try it out too?  it sounds like something is up, so let's
 get to the bottom of it and get it fixed!

 christian


[web2py] Re: validators.py IS_IN_DB.__call__ elif self.theset must compare with str instead?

2011-08-28 Thread Massimo Di Pierro
you are right. in trunk.

On Aug 28, 5:39 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 You can reproduce the error in shell:

     x = IS_IN_DB(db, db.auth_user.id)
     x(1)    ok, found
     x.options()    ok, options
     x(1)    WRONG, not found anymore ('value not in database')

 If we apply the fix I propose in my original post, this will be solved.

 Thanks,

    Carlos


[web2py] Re: crud not updating

2011-08-28 Thread Massimo Di Pierro
Not automatically.

On Aug 28, 9:26 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 if onaccept raises an exception, there will be a rollback?


[web2py] Re: Published my collection of plugins

2011-08-28 Thread kenji4569
I got some bug reports for the Solid Table, and fixed the bugs:

OrderbySelector fails when current_orderby is null
https://github.com/kenji4569/sqlabs/issues/34

solidtable fails when headers='labels'
https://github.com/kenji4569/sqlabs/issues/32

SOLID TABLE fails when columns=[[a,b],None,[c,d]]
https://github.com/kenji4569/sqlabs/issues/37

Thanks for reporting them.

On 8月28日, 午前2:27, kenji4569 hos...@s-cubism.jp wrote:
 Thank you all for your wonderful comments.

  Do you want to host and manage all plugins?

 Currently I doubt if I could commit this,
 though I want to contribute more as much as I could.

  I see you take time to make order in sqltable :O.
  Please subscribe to web2py-developers.

 I will subscribe to it.
 But first I need time to see how the development goes on.

 On 8月27日, 午後9:30, Bruno Rocha rochacbr...@gmail.com wrote:







  On Sat, Aug 27, 2011 at 8:01 AM, Martín Mulone 
  mulone.mar...@gmail.comwrote:

   Bruno extracolumns are in SQLTABLE.

  really?

  LOL.. never knew about it.


Re: [web2py] Re: crud not updating

2011-08-28 Thread Bruno Rocha
On Mon, Aug 29, 2011 at 12:59 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Not automatically.


OK, I was just thinking if it could be the origin of the problem.


[web2py] Re: Published my collection of plugins

2011-08-28 Thread Massimo Di Pierro
I would definitively want to see multiline records in SQLFORM.grid. Is
anybody interested in doing this?

Massimo

On Aug 28, 11:06 pm, kenji4569 hos...@s-cubism.jp wrote:
 I got some bug reports for the Solid Table, and fixed the bugs:

 OrderbySelector fails when current_orderby is 
 nullhttps://github.com/kenji4569/sqlabs/issues/34

 solidtable fails when 
 headers='labels'https://github.com/kenji4569/sqlabs/issues/32

 SOLID TABLE fails when 
 columns=[[a,b],None,[c,d]]https://github.com/kenji4569/sqlabs/issues/37

 Thanks for reporting them.

 On 8月28日, 午前2:27, kenji4569 hos...@s-cubism.jp wrote:







  Thank you all for your wonderful comments.

   Do you want to host and manage all plugins?

  Currently I doubt if I could commit this,
  though I want to contribute more as much as I could.

   I see you take time to make order in sqltable :O.
   Please subscribe to web2py-developers.

  I will subscribe to it.
  But first I need time to see how the development goes on.

  On 8月27日, 午後9:30, Bruno Rocha rochacbr...@gmail.com wrote:

   On Sat, Aug 27, 2011 at 8:01 AM, Martín Mulone 
   mulone.mar...@gmail.comwrote:

Bruno extracolumns are in SQLTABLE.

   really?

   LOL.. never knew about it.


[web2py] is anybody using the new scheduler....

2011-08-28 Thread Massimo Di Pierro
... does it work for you? Pros? Cons? Errors? Did you stress test it?


[web2py] Is it safe to run to web2py instances on the same database?

2011-08-28 Thread Jason (spot) Brower
First, is it possible to use the same model for two applications.
Second, would there, be a way to run these two applications safely amongst
each other?
I am thinking about sociability among very large applications. For example
an internal editor application and the external viewers application.
---
Best Regards,
Jason Brower


[web2py] Re: Is it safe to run to web2py instances on the same database?

2011-08-28 Thread Massimo Di Pierro
There is no problem.

On Aug 29, 12:44 am, Jason (spot) Brower encomp...@gmail.com
wrote:
 First, is it possible to use the same model for two applications.
 Second, would there, be a way to run these two applications safely amongst
 each other?
 I am thinking about sociability among very large applications. For example
 an internal editor application and the external viewers application.
 ---
 Best Regards,
 Jason Brower