[web2py:16061] Re: LICENSE

2009-02-09 Thread Fran

On Feb 9, 6:14 am, Carlos Man  wrote:
> I also thing "Fran Boone" should be spelled "Frank Boone", but I
> haven't got time now to verify that one.

Fran Boon actually ;)
So old translations not picked-up the typo corrections, eh? Easily
missed...

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



[web2py:16062] Re: tagging

2009-02-09 Thread mickgardner

Thanks for that. The multiselect form for tags now works!!

On Feb 9, 5:12 pm, mdipierro  wrote:
> Your example works but with two corrections discussed below:
>
> > mynewdb=SQLDB("sqlite://mynewdb.db")
> > import datetime
>
> > now = datetime.datetime.now()
>
> > mynewdb.define_table('tag',
> >     mynewdb.Field('name'),
> >     mynewdb.Field('description', 'text'))
>
> # remove
> #     mynewdb.Field('post_id', 'integer'))
> # because posts have tags but a tag does not belong to a post
>
> > mynewdb.define_table('posts',
> >     mynewdb.Field('title'),
> >     mynewdb.Field('body', 'text'),
> >     mynewdb.Field('author'),
> >     mynewdb.Field('tags'),
> >     mynewdb.Field('date_created', 'datetime', default=now),
> >     mynewdb.Field('draft', 'boolean', default='T'))
>
> # removed
> #    mynewdb.tag.post_id.requires=IS_IN_DB(mynewdb, mynewdb.posts.id)
> # becuase tag.post_id should not be there
>
> > mynewdb.posts.title.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB
> > (mynewdb,mynewdb.posts.title)]
> > mynewdb.posts.body.requires=IS_NOT_EMPTY()
> > mynewdb.posts.tags.requires=IS_IN_DB(mynewdb, mynewdb.tag.name, '% 
> > (name)s',  multiple=True)
>
> # This is it. If you have some records in the tag table
> # the above line will render with a multiple select dropbox.
> # You can select one or more of use jquery multiselect plugin
> # to change the appearence
>
> > mynewdb.posts.draft.requires=IS_NOT_EMPTY()
> > mynewdb.posts.date_created.requires=IS_DATE('%d/%m/%y')
>
> > mynewdb.define_table('comments',
> >     mynewdb.Field('post_id', 'integer', mynewdb.posts),
> >     mynewdb.Field('url', default=''),
> >     mynewdb.Field('email', default='@something.com'),
> >     mynewdb.Field('author'),
> >     mynewdb.Field('date_created', 'date',default=now),
> >     mynewdb.Field('body', 'text'))
>
> > mynewdb.comments.post_id.requires = 
> > IS_IN_DB(mynewdb,mynewdb.posts.id,'%(title)s')
> > mynewdb.comments.author.requires = IS_NOT_EMPTY()
> > mynewdb.comments.body.requires = IS_NOT_EMPTY()
> > mynewdb.comments.email.requires = IS_EMAIL(error_message="Please provide a 
> > valid email address")
> > mynewdb.comments.date_created.requires=IS_DATE('%d/%m/%y')
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16063] Re: pyjamas and web2py (it works!)

2009-02-09 Thread lkcl



On Feb 8, 10:25 pm, mdipierro  wrote:

> > > What other popular services are out there and should be supported out
> > > of the box?
>
> >  full REST support might be a good one to add.

> Sorry I am slow today. can you make an example?

http://en.wikipedia.org/wiki/Representational_State_Transfer#Example

he he - i've only just started looking it up.
REST is a standard layout - of the URLs - for doing storage and
retrieval of objects into a database.  in theory, once you have
implemented RESTful correctly, you only need one bit of client code
(per programming language) to access the one bit of server code (per
programming language), and you're done as far as database is
concerned, cross-platform-wise.

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



[web2py:16064] Re: Pyjamas and web2py

2009-02-09 Thread lkcl

chris -

On Feb 9, 12:47 am, mdipierro  wrote:
> Chris,
>
> would you fix my todo example and email it back to me? I will repost
> it.

 chris, hi,

 i'd like to know how that works, because there are now three
JSONRPCservice classes kicking about: one for web2py, one for django
and one for  ohh, what was it... web.py that was it.

also, this:
 http://lkcl.net/jsonrpclib.tgz

i added exception handling to it but it would be nice if you could
check it over and perhaps use it to do some regression tests of
web2py's jsonrpc service.

l.

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



[web2py:16065] 1.56.1 on GAE error 'SQLQuery' object has no attribute 'left'

2009-02-09 Thread ANDROSoft

hello

On GAE i get  'SQLQuery' object has no attribute 'left' after adding a
few rows to table

Traceback (most recent call last):
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/
applications/welcome/modules/t2.py", line 39, in t3_execute
p=xmlescape(environment['_res'])
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 95, in xmlescape
data = str(data)
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 329, in __str__
return self.xml()
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 321, in xml
(fa, co) = self._xml()
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 317, in _xml
self.components])
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 95, in xmlescape
data = str(data)
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 329, in __str__
return self.xml()
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 321, in xml
(fa, co) = self._xml()
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 317, in _xml
self.components])
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 95, in xmlescape
data = str(data)
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 329, in __str__
return self.xml()
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 740, in xml
return DIV.xml(self)
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 321, in xml
(fa, co) = self._xml()
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 315, in _xml
fa += ' %s="%s"' % (name, xmlescape(value, True))
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
html.py", line 95, in xmlescape
data = str(data)
  File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
contrib/gql.py", line 591, in __str__
return str(self.left)
AttributeError: 'SQLQuery' object has no attribute 'left'

code

=self.itemize(db.mebel)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16066] Re: 1.56.1 on GAE error 'SQLQuery' object has no attribute 'left'

2009-02-09 Thread Robin B

It appears like it is trying to call str(query) where the query does
not have a left operator.

what happens if you change this: gql.py:591:
def __str__(self):
return str(self.left)

to this: gql.py:591:
def __str__(self):
return str(getattr(self,'left',''))

Robin


On Feb 9, 4:11 am, ANDROSoft  wrote:
> hello
>
> On GAE i get  'SQLQuery' object has no attribute 'left' after adding a
> few rows to table
>
> Traceback (most recent call last):
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/
> applications/welcome/modules/t2.py", line 39, in t3_execute
>     p=xmlescape(environment['_res'])
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 95, in xmlescape
>     data = str(data)
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 329, in __str__
>     return self.xml()
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 321, in xml
>     (fa, co) = self._xml()
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 317, in _xml
>     self.components])
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 95, in xmlescape
>     data = str(data)
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 329, in __str__
>     return self.xml()
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 321, in xml
>     (fa, co) = self._xml()
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 317, in _xml
>     self.components])
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 95, in xmlescape
>     data = str(data)
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 329, in __str__
>     return self.xml()
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 740, in xml
>     return DIV.xml(self)
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 321, in xml
>     (fa, co) = self._xml()
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 315, in _xml
>     fa += ' %s="%s"' % (name, xmlescape(value, True))
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> html.py", line 95, in xmlescape
>     data = str(data)
>   File "/base/data/home/apps/aspekt-erp/1.331262110087268070/gluon/
> contrib/gql.py", line 591, in __str__
>     return str(self.left)
> AttributeError: 'SQLQuery' object has no attribute 'left'
>
> code
>
> =self.itemize(db.mebel)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16067] Re: new puppy example please?

2009-02-09 Thread murray3

Peter,
thanks for this I will have a go later (I'm in Dublin GMT), just one
thing
what needs to be set up to get the code to send the registration email
other wise when you enable authentication you are locking yourself out
as you can't register or login?
regards
chris

On Feb 8, 11:32 pm, Peter  wrote:
> Chris, this is something I was working on, based on the t2.pdf
> example... See if it is of any use to you. The indentation will be
> screwed up pretty badly, I'm afraid...
>
> These instructions replicate the puppy example in the
> T2.PDF docs, pages 7-11, for the new tools.py
> environment in web2py 1.56
>
> 0. From the admin interface, add new app 'puppy'
>
> 1. Define table 'puppy' and create a crud instance
>
> # db.py:
>
> db.define_table('puppy',
>     SQLField('name'),
>     SQLField('image','upload') )
> db.puppy.name.requires=IS_NOT_EMPTY()
>
> from gluon.tools import Mail, Auth, Crud
> crud=Crud(globals(),db)
>
> 2. Enable a RESTful interface through crud
>
> # controllers/default.py:
>
> def data():
>     return dict(form=crud())
>
> def download():
>     return response.download(request,db)
>
> 3. Go tohttp://localhost:8000/puppy/default/data/create/puppy
> to see a 'create puppy' form and play around with the default CRUD
> interface
>
> 4. Create a template for the CRUD pages
>
> # views/default/data.html
>
> {{extend 'layout.html'}}
> {{=form}}
> You are now using the data.html template.
>
> ...and retry the CRUD URLs; the nice admin/session/etc buttons showed
> earlier should be missing now...
>
> 5. Define a combo page that shows items + a create form
>
> # views/default/customcreate.html
> {{extend 'layout.html'}}
>
> 
> Post the image of a Puppy
> {{=form}}
> 
> 
> Puppies
> {{=items}}
> 
> You are now using the customcreate.html template.
>
> # controllers/default.py
> def customcreate():
>     form = crud.create('puppy')
>     items = crud.select('puppy', linkto=URL(r=request,f='data',args=
> ['read']))
>     return dict(form=form, items=items)
>
> 6. Optionally include the "search" widget from t2.py?
> (see t2.pdf, page 9)
> (the high-level stuff such as search, comments, etc has gracefully
> been split out of tools.py)
>
> 7. Add authentication
>
> # in models/db.py:
> # define your own auth_user table so you can extend it later...
> # you can also set auth.settings.table_user later, but you may lose
> users already registered (?)
> db.define_table('auth_user',
>     SQLField('first_name',length=32,default=''),
>     SQLField('last_name',length=50,default=''),
>     SQLField('email',requires=IS_EMAIL()),
>     SQLField('password','password',requires=CRYPT()),
>     SQLField('registration_key',length=64),
>     SQLField('pic','upload',default=''))    # and add any field you
> want...
>
> auth=Auth(globals(),db)
> auth.settings.table_user=db.auth_user
> auth.define_tables()
>
> # in controllers/default.py:
> def user(): return dict(form=auth())
>
> # and add a menu so we can see state
> if auth.user: response.menu=[
>     ['logout',False,URL(r=request,f='user',args=['logout'])]]
> else: response.menu=[
>     ['login',False,URL(r=request,f='user',args=['login'])],
>     ['register',False,URL(r=request,f='user',args=['register'])]]
>
> Go tohttp://localhost:8000/puppy/default/user/registerto register as
> a user.
> Go tohttp://localhost:8000/puppy/default/user/loginto log in.
>
> 8. Now restrict access to these puppies to logged in users
>
> # in controllers/default.py:
>
> @auth.requires_login()
> def data():
>     return dict(form=crud())
>
> @auth.requires_login()
> def download():
>     return response.download(request,db)
>
> @auth.requires_login()
> def customcreate():
>     form = crud.create('puppy')
>     items = crud.select('puppy', linkto=URL(r=request,f='data',args=
> ['read']))
>     return dict(form=form, items=items)
>
> (Note: the T2 requires_login had the option of specifying a 'next'
> function which
> was passed in the vars._destination... This is missing in tools for
> now, AFAICT)
>
> ---
>
> I don't use the authorization stuff yet, powerful as it is, so I'll
> leave this to someone else.
> For myself, the next stop is subclassing Auth... one reason being to
> adapt email registration.
>
> Cheers,
> -Peter
>
> On Feb 8, 6:04 pm, murray3  wrote:
>
>
>
> > Massimo,
> > having trouble getting email registration to work on localhost with
> > the T2 Puppies app. What needs to be set up?
>
> > Also how do you get the puppies app to run on GAE SDK, I keep getting
> > internal error, is it supposed to work?
>
> > regards
> > chris
>
> > On Feb 8, 1:31 am, mdipierro  wrote:
>
> > > asap. We need to rewrite T2 to use tools first. if anybody can help
> > > please raise your hand.
>
> > > Massimo
>
> > > On Feb 7, 6:58 pm, murray3  wrote:
>
> > > > Could any of you guy's run through the T2 "puppy" example using the
> > > > new gluon.tools syntax.
> > > > I am missing something (porting my T2 based code) and I'm sure this
> > > > would get me restarted.
>
> > > > thanks
> > > 

[web2py:16068] Re: Pyjamas and web2py

2009-02-09 Thread Timothy Farrell

While not relevant to web2py, I would like to see some example sites 
that use Pyjamas.  Luke, I've seen your homepage.  Are there other 
examples that we can see?

-tim

lkcl wrote:
> chris -
>
> On Feb 9, 12:47 am, mdipierro  wrote:
>   
>> Chris,
>>
>> would you fix my todo example and email it back to me? I will repost
>> it.
>> 
>
>  chris, hi,
>
>  i'd like to know how that works, because there are now three
> JSONRPCservice classes kicking about: one for web2py, one for django
> and one for  ohh, what was it... web.py that was it.
>
> also, this:
>  http://lkcl.net/jsonrpclib.tgz
>
> i added exception handling to it but it would be nice if you could
> check it over and perhaps use it to do some regression tests of
> web2py's jsonrpc service.
>
> l.
>
> >
>   

-- 
Timothy Farrell 
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


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



[web2py:16069] typo on front page

2009-02-09 Thread Rolfa

Thanks for this wonderful framework!

There is a typo on the frontpage:
laguage should be: language


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



[web2py:16070] Re: typo on front page

2009-02-09 Thread mdipierro

thanks. fixed.

On Feb 9, 3:11 am, Rolfa  wrote:
> Thanks for this wonderful framework!
>
> There is a typo on the frontpage:
> laguage should be: language
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16071] Re: new puppy example please?

2009-02-09 Thread Peter

Hi Chris,

AFAIK you only need to configure the mailer as documented in the
tools.py source. There is an error in the docstring in the Mail class,
use the example code in the Auth class.
Check if you can reach the mail server that you configure by running
"telnet  25" and check that you get a connection on that port.
Ehmm, I have ZERO experience on GAE, can't help you with mail settings
there...

# in db.py:

from gluon.tools import Mail, Auth, Crud
mail=Mail()
mail.settings.server='smtp.yourprovider.tld:25'
mail.settings.sender='y...@somewhere.com'
# only configure login if you need smtp authentication
# check your regular mail setup
mail.settings.login='username:password'

# plus, after the line... auth=Auth(globals(),db)
auth.settings.mailer=mail

def fullurl(a=None,c=None,f=None,r=None,args=[],vars={}):
return '%s://%s%s' % (r.env.wsgi_url_scheme,r.env.http_host,URL
(a=a,c=c,f=f,r=r,args=args,vars=vars))

auth.messages.verify_email = \
'Click on the link ' + fullurl(r=request,f='user',args=
['verify_email']) + '/%(key)s to verify your email'

These two last lines are necessary because Massimo maybe wasn't really
really /really/ ready with the Auth verify code yet... ;-)

That should do the trick...  If you want to bypass user validation,
ie, grant access without entering the validation string, you can
simply use the web db admin to clear the validation_key field for that
user.

If you run into any problems, please post. I'm in Amsterdam GMT+1 so
timewise that's closer than you may think. ;-)

Cheers,
-Peter

On Feb 9, 2:59 pm, murray3  wrote:
> Peter,
> thanks for this I will have a go later (I'm in Dublin GMT), just one
> thing
> what needs to be set up to get the code to send the registration email
> other wise when you enable authentication you are locking yourself out
> as you can't register or login?
> regards
> chris
>
> On Feb 8, 11:32 pm, Peter  wrote:
>
> > Chris, this is something I was working on, based on the t2.pdf
> > example... See if it is of any use to you. The indentation will be
> > screwed up pretty badly, I'm afraid...
>
> > These instructions replicate the puppy example in the
> > T2.PDF docs, pages 7-11, for the new tools.py
> > environment in web2py 1.56
>
> > 0. From the admin interface, add new app 'puppy'
>
> > 1. Define table 'puppy' and create a crud instance
>
> > # db.py:
>
> > db.define_table('puppy',
> >     SQLField('name'),
> >     SQLField('image','upload') )
> > db.puppy.name.requires=IS_NOT_EMPTY()
>
> > from gluon.tools import Mail, Auth, Crud
> > crud=Crud(globals(),db)
>
> > 2. Enable a RESTful interface through crud
>
> > # controllers/default.py:
>
> > def data():
> >     return dict(form=crud())
>
> > def download():
> >     return response.download(request,db)
>
> > 3. Go tohttp://localhost:8000/puppy/default/data/create/puppy
> > to see a 'create puppy' form and play around with the default CRUD
> > interface
>
> > 4. Create a template for the CRUD pages
>
> > # views/default/data.html
>
> > {{extend 'layout.html'}}
> > {{=form}}
> > You are now using the data.html template.
>
> > ...and retry the CRUD URLs; the nice admin/session/etc buttons showed
> > earlier should be missing now...
>
> > 5. Define a combo page that shows items + a create form
>
> > # views/default/customcreate.html
> > {{extend 'layout.html'}}
>
> > 
> > Post the image of a Puppy
> > {{=form}}
> > 
> > 
> > Puppies
> > {{=items}}
> > 
> > You are now using the customcreate.html template.
>
> > # controllers/default.py
> > def customcreate():
> >     form = crud.create('puppy')
> >     items = crud.select('puppy', linkto=URL(r=request,f='data',args=
> > ['read']))
> >     return dict(form=form, items=items)
>
> > 6. Optionally include the "search" widget from t2.py?
> > (see t2.pdf, page 9)
> > (the high-level stuff such as search, comments, etc has gracefully
> > been split out of tools.py)
>
> > 7. Add authentication
>
> > # in models/db.py:
> > # define your own auth_user table so you can extend it later...
> > # you can also set auth.settings.table_user later, but you may lose
> > users already registered (?)
> > db.define_table('auth_user',
> >     SQLField('first_name',length=32,default=''),
> >     SQLField('last_name',length=50,default=''),
> >     SQLField('email',requires=IS_EMAIL()),
> >     SQLField('password','password',requires=CRYPT()),
> >     SQLField('registration_key',length=64),
> >     SQLField('pic','upload',default=''))    # and add any field you
> > want...
>
> > auth=Auth(globals(),db)
> > auth.settings.table_user=db.auth_user
> > auth.define_tables()
>
> > # in controllers/default.py:
> > def user(): return dict(form=auth())
>
> > # and add a menu so we can see state
> > if auth.user: response.menu=[
> >     ['logout',False,URL(r=request,f='user',args=['logout'])]]
> > else: response.menu=[
> >     ['login',False,URL(r=request,f='user',args=['login'])],
> >     ['register',False,URL(r=request,f='user',args=['register'])]]
>
> > Go tohttp://localhost:800

[web2py:16073] Re: SQL Designer Import

2009-02-09 Thread dhmorgan

just emailed update but it started a new topic, sorry.

see http://groups.google.com/group/web2py/browse_thread/thread/0687f038e53a0e5c#
for update

Danny



On Feb 2, 3:37 pm, dhmorgan  wrote:
> I'm currently trying to implement this. Have followed above
> instructions and it functions nearly completely. I cannot yet get save/
> load to server's database.
>
> Anyone have a handle on this?
>
> Danny
>
> On Dec 16 2008, 10:42 am, "Yarko Tymciurak"  wrote:
>
> > Sorry...
> > I may have spoken too soon  I thought this was working, but still some
> > things to work out (not saving xml to database at the moment)
>
> > 2008/12/16 yarko 
>
> > > I wanted to post an update:
>
> > > I took Boris's adaptation of sqldesigner for web2py, and modified it
> > > (very slightly) to work as a named app in web2py.
>
> > > The good news:
>
> > > - it seems to work just fine (no routes at all used);
> > > - to accommodate"name it to whatever you want" I changed ONE line of
> > > code;
> > > - I dropped in the latest sqldesigner (to check if this would work as
> > > needed, w/o any other changes - and yes, it does);
> > > - I tested saving and restoring work in the "app" database (Boris is
> > > saving the xml from sessions, so the save/restore is fine);
> > > - it (continues to) work with latest web2py;
>
> > > The "bad" news (well, this isn't really bad - but does suggest
> > > something we may need to do w/ web2py):
> > > - from the static directory, sqldesigner (itself) has a link to it's
> > > subdirectory for "docs" code; it fails (you have to manually add
> > > "index.html" to the generated URL);   for STATIC references, web2py
> > > should probably handle doing "what normally happens" (or is this a
> > > server backend function? anyway, cherrypy doesn't...)
> > > - the generated DAL is pretty much one-way (at this point):  copy /
> > > paste, and use it once you're done.  (This is not really bad news I
> > > don't think; it's probably not worth the effort to go further);
>
> > > I can post, or you can do what I did:
>
> > > - take Boris's zip, rename applications/init to (for example)
> > > applications/sqldesigner; zip this up, or copy to your current web2py
> > > (routes.py not needed);
> > > - get the latest sqldesigner fromhttp://code.google.com/p/wwwsqldesigner/
> > > and drop it in your new app as static/designer
>
> > > Unfortunately, sqldesigner still has not included the changes needed,
> > > so you need to also update  static/designer/js/config.js with Boris's
> > > change (http://designer.bojanka.net/js/config.js);
>
> > > Alternatively, simply add "web2py-db" to AVAILABLE_BACKENDS and make
> > > it the DEFAULT_BACKEND string.
>
> > > - in controllers/default.py make the following change:
>
> > > <<< old
> > > def index():
> > >    redirect('designer.html')
>
> > > >>> new
> > > def index():
> > >    redirect(URL(r=request,c='static',f='designer/index.html'))
>
> > > That's it!
>
> > > Let me know if you find a way to let sqldesigner's   "documentation"
> > > link work.
>
> > > Yarko
>
> > > On Dec 1, 3:25 pm, "Boris Manojlovic" 
> > > wrote:
> > > > Hi,
> > > >   as i said it was just a prof of concept :) and i tried to make it
> > > forward
> > > > compatible as much as possible.
> > > > What that means is I did not changed "www sql developer" code (except
> > > > configuration) on purpose so that files from 
> > > > *applications/init/static/**
> > > > designer*
> > > > can be replaced with new version without problems - until Ondřej Žára
> > > change
> > > > API code which I hope will not be done hehe :)
> > > > (Just tried to put newest version of sql developer into my code and it
> > > > worked on first look)
>
> > > > Boris
>
> > > > P.S. on designer.bojanka.net is still old version of sql developer watch
> > > out
> > > > :)
>
> > > > (look here for confighttp://designer.bojanka.net/js/config.js)
>
> > > > On Mon, Dec 1, 2008 at 10:04 PM, mdipierro 
> > > wrote:
>
> > > > > perhaps you and jwm can join forces. You have the same interests.
>
> > > > > I am not planning to host this myself since you are doing it, but it
> > > > > could be used and distributed with T3.
>
> > > > > Massimo
>
> > > > > On Dec 1, 2:57 pm, "Boris Manojlovic" 
> > > > > wrote:
> > > > > > it was created as proof of concept, i planed to add more
> > > functionality
> > > > > (as
> > > > > > you can see from database schema)
>
> > > > > >http://www.bojanka.net/w2p-massimo.tar.gz
>
> > > > > > it is opensource as all package is opensource, why to close back end
> > > :)
>
> > > > > > On Mon, Dec 1, 2008 at 9:53 PM, mdipierro 
> > > > > wrote:
>
> > > > > > > Boris,
>
> > > > > > > is it functional? Can I uninstall the old one and link yours? If 
> > > > > > > it
> > > is
> > > > > > > open source, is the source posted somewhere?
>
> > > > > > > perhaps the two of you should join forces.
>
> > > > > > > Massimo
>
> > > > > > > On Dec 1, 2:43 pm, jwm  wrote:
> > > > > > > > Boris,
> > > > > > > > Looks like you had the t

[web2py:16074] Re: Pyjamas and web2py

2009-02-09 Thread chris p

Massimo, I just emailed a complete web2py app with the working code.

On Feb 8, 7:47 pm, mdipierro  wrote:
> Chris,
>
> would you fix my todo example and email it back to me? I will repost
> it.
>
> I can also give access to the AlterEgo entry if you email me
> personally.
>
> Massimo
>
> On Feb 8, 6:04 pm, chris p  wrote:
>
> > Here's the reference I was using for the error return 
> > protocol:http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html
>
> > On Feb 8, 1:24 pm, mdipierro  wrote:
>
> > > Thank you chris. I also just posted this:
>
> > >http://groups.google.com/group/web2py/browse_thread/thread/96b5a94552...
>
> > > On Feb 8, 11:35 am, chris p  wrote:
>
> > > > I'm reposting as my first didn't seem to go through
>
> > > > I got this working with the pyjamas JSONRPCExample.  Most of the
> > > > changes were in the jsonrpc server examples posted above. Here's the
> > > > code
>
> > > >  controllers/rpc.py --
> > > > # try something like
> > > > def index():
> > > >     return jsonrpc.serve()
>
> > > > @jsonrpc
> > > > def echo(text):
> > > >     return 'echoing: %s' % text
>
> > > > @jsonrpc
> > > > def reverse(text):
> > > >     return text[-1::-1]
>
> > > > @jsonrpc
> > > > def uppercase(text):
> > > >     return text.upper()
>
> > > > @jsonrpc
> > > > def lowercase(text):
> > > >     return text.lower()
>
> > > > - models/jsonrpc.py -
> > > > """
> > > > original code from 
> > > > :http://trac.pyworks.org/pyjamas/wiki/DjangoWithPyJamas
> > > > """
> > > > import gluon.contrib.simplejson as simplejson
> > > > import types
>
> > > > class JSONRPCService:
> > > >     def response(self, id, result):
> > > >         return simplejson.dumps({'version': '1.1', 'id':id,
> > > > 'result':result, 'error':None})
> > > >     def error(self, id, code, message):
> > > >         return simplejson.dumps({'id': id,
> > > >                                  'version': '1.1',
> > > >                                  'error': {'name': 'JSONRPCError',
> > > >                                            'code': code,
> > > >                                            'message': message
> > > >                                            }
> > > >                                      })
>
> > > >     def __init__(self):
> > > >         self.methods={}
>
> > > >     def serve(self):
> > > >         import sys
> > > >         data = simplejson.loads(request.body.read())
> > > >         id, method, params = data["id"], data["method"], data
> > > > ["params"]
> > > >         if method in self.methods:
> > > >             try:
> > > >                 result =self.methods[method](*params)
> > > >                 return self.response(id, result)
> > > >             except BaseException:
> > > >                 etype, eval, etb = sys.exc_info()
> > > >                 return self.error(id, 100, '%s: %s' %(etype.__name__,
> > > > eval))
> > > >             except:
> > > >                 etype, eval, etb = sys.exc_info()
> > > >                 return self.error(id, 100, 'Exception %s: %s' %(etype,
> > > > eval))
> > > >         else:
> > > >             return self.error(id, 100, 'method "%s" does not exist' %
> > > > method)
>
> > > >     def __call__(self,func):
> > > >         self.methods[func.__name__]=func
> > > >         return func
>
> > > >     def listmethods(self):
> > > >         return self.methods.keys()
>
> > > > jsonrpc=JSONRPCService()
>
> > > > ---
> > > >  --
>
> > > > Then you need to change the server location in the pyjamas code  to
> > > > something like this
>
> > > > class EchoServicePython(JSONProxy):
> > > >     def __init__(self):
> > > >         JSONProxy.__init__(self, "/pyjamas_2/rpc", ["echo", "reverse",
> > > > "uppercase", "lowercase"])
>
> > > > where you would change "pyjamas_2" for your app name
>
> > > > I put the "output" folder from the pyjamas build into the web2py
> > > > static directory
>
> > > > Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16075] Re: Pyjamas and web2py

2009-02-09 Thread chris p

Here's what I ended up with on the server side (in web2py, it goes in
models/jsonrpc.py):

-
import gluon.contrib.simplejson as simplejson
import types

class JSONRPCService:
def response(self, id, result):
return simplejson.dumps({'version': '1.1', 'id':id,
'result':result, 'error':None})
def error(self, id, code, message):
return simplejson.dumps({'id': id,
 'version': '1.1',
 'error': {'name': 'JSONRPCError',
   'code': code,
   'message': message
   }
 })

def __init__(self):
self.methods={}

def serve(self):
import sys
data = simplejson.loads(request.body.read())
id, method, params = data["id"], data["method"], data
["params"]
if method in self.methods:
try:
result =self.methods[method](*params)
return self.response(id, result)
except BaseException:
etype, eval, etb = sys.exc_info()
return self.error(id, 100, '%s: %s' %(etype.__name__,
eval))
except:
etype, eval, etb = sys.exc_info()
return self.error(id, 100, 'Exception %s: %s' %(etype,
eval))
else:
return self.error(id, 100, 'method "%s" does not exist' %
method)

def __call__(self,func):
self.methods[func.__name__]=func
return func

def listmethods(self):
return self.methods.keys()

jsonrpc=JSONRPCService()

-

There's going to have to be different server classes because of the
different api's of django, web2py, web.py.  The one I posted above is
not truly complete (it doesn't do service description for example),
but it seems to do the basics correctly when tested with the pyjamas
JSONRPC client. The client from http://lkcl.net/jsonrpclib.tgz also
seems to work fine. I haven't tried any other clients.

Unfortunately I won't have any more time to spend on this for a while,
but I'm hoping this helps get things in the right direction. I sent
massimo a complete version of the working pyjamas-based ToDo app that
he started, so he should be able to post that or incorporate changes
into the next release.

Chris

On Feb 9, 4:59 am, lkcl  wrote:
> chris -
>
> On Feb 9, 12:47 am, mdipierro  wrote:
>
> > Chris,
>
> > would you fix my todo example and email it back to me? I will repost
> > it.
>
>  chris, hi,
>
>  i'd like to know how that works, because there are now three
> JSONRPCservice classes kicking about: one for web2py, one for django
> and one for  ohh, what was it... web.py that was it.
>
> also, this:
>  http://lkcl.net/jsonrpclib.tgz
>
> i added exception handling to it but it would be nice if you could
> check it over and perhaps use it to do some regression tests of
> web2py's jsonrpc service.
>
> l.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16077] Re: RFC: table select/delete, limitby=num

2009-02-09 Thread Robin B

Its alive!

#batch insert
>>> db.posts.insert([dict(count=i+1) for i in range(3)])
[1, 2, 3]

#batch update (with optional transactions)
>>> def inc(r): r.count+=1
>>> def dec(r): r.count-=1
>>> db.posts.update(1,[2,3],dict(count=0),dict(count=lambda v: 
>>> v+2),dec,inc,count=lambda v: v-2)
3

#batch get
>>> db.posts.select(orderby=db.posts.id)
[{'count': 0L, 'id': 1}, {'count': 0L, 'id': 2}, {'count': 0L, 'id':
3}]

#batch delete
>>> db.posts.delete([3,2],1)
3

And its fully transactional when you pass callable args, all the
drivers will get it for free because it is not done at the driver
level.

Robin

On Feb 8, 3:46 pm, Robin B  wrote:
> I think in SQL you can use '|' to generate each in 1 query.
>
> Robin
>
> On Feb 8, 3:44 pm, mdipierro  wrote:
>
> > In principle I am for all of these but I am not sure they can be
> > implemented easily in SQL without loops. Can they?
>
> > On Feb 8, 3:39 pm, Robin B  wrote:
>
> > > We could add select and delete to tables and limitby could have a
> > > shortcut:
>
> > > instead of:
> > > (db.posts.id>0).select(orderby=~db.posts.created_at,limitby=(0,10))
>
> > > how about:
> > > db.posts.select(orderby=~db.posts.created_at, limitby=10)
>
> > > batch get:
> > > db.posts.select([3,5,9])
>
> > > and delete could also accept kwargs:
> > > db.posts.delete(orderby=db.posts.created_at,limitby=10)
>
> > > and batch delete:
> > > db.posts.delete([3,5,9])
>
> > > Robin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16076] Re: SQL Designer Import

2009-02-09 Thread dhmorgan

Note: this thread continues from thread of same name:

http://groups.google.com/group/web2py/browse_thread/thread/30eb9ee195b358cb/20f3cf32cfbc876e#20f3cf32cfbc876e

Additionally, I have now posted a how-to on webfaction for setting it
up there:
http://forum.webfaction.com/viewtopic.php?pid=8718#p8718

On Feb 9, 8:57 am, D Harriman Morgan 
wrote:
> Update:
>
> The short of it is that I can only get sqldesigner to save/load server-side
> when I set it up using Boris Manojlovic's (attached) script file for
> installing web2py with sqldesigner included as application 'init'. The  file
> (web2py-designer-patches.zip) includes three files: 'README', which is
> actually a script file that downloads and installs both web2py and
> wwwsqldesigner; '01-routes.patch' which creates a routes.py file, and
> '02-init.patch', which modifies three files within the new 'init'
> application.
>
> Installation using the script file requires that you be ready to browse to
> the new application during the process, as the script must wait for you to
> create an 'init' application via the web2py admin view. In this example, I
> have subdomain sqldesigner.example.com for http and https.
>
> [ in first terminal]
>     copy the README, 01-routes.patch, and 02-init.patch files to directory
> from which you'll serve this web2py instance, mine is
> '~/webapps/sqldesigner'
>
>     make README executable and run it
>         chmod 764 README
>         ./README
>
>     script will prompt you to open another terminal to create an 'init' app.
>
> [ in second terminal}
>     cd ~/webapps/sqldesigner/web2py
>     #  = port number
>     python web2py.py -p 
>         password of your choice
>
> [open browser to admin for this site]
>
>     create new application, 'init'
>
>     at this point the README installation script resumes, which you'll see
> in the first terminal
>
> [ in first terminal]
>
>     script should end by telling you it patched four files and that it
> should just work
>
>     while you're there, kill the web2py you started in the second
> terminal, according to the instructions provided at startup, 'kill -SIGTERM
> # ' for example
>
>     it may just work; in my case, however (installed as webfaction custom
> app) I had to move the contents of sqldesigner/web2py down one level
>
>         try this if it doesn't "just work":
>             mv ~/webapps/sqldesigner/web2py/* ~/webapps/sqldesigner/ rmdir
> ~/webapps/sqldesigner/web2py
>
>     restart web2py
>         screen python web2py.py -p  -password=''
>
> [ in second terminal}
>     screen -d
>
> And you're there. Point your browser tohttp://sqldesigner.example.comand
> you have your own facility for visually modeling data in a format that's
> readily exportable to web2py. As you would hope, the sqldesigner data can be
> administered via admin over https.
>
> My immediate impression with using SQL-Designer is quite positive. Having a
> visual representation and being able to save/retrieve/edit the models is
> allowing me to work far more productively. It has room for improvement (see
> below), which makes me wonder about doing it all fresh in Pyjamas
>
> Rooms for improvement: ordering of output by depedency (order is currently
> chronological(?) which causes errors in web2py model compilation), cannot do
> things like copy/paste tables or fields, cannot select multiple tables for
> repositioning/deleting, documentation button opens wwwsqldesigner twice,
> etc.
>
> Danny
>
>  web2py-designer-patches.zip
> 5KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16078] Model Field Suppression

2009-02-09 Thread TakeTheStage

I'm using T3 and using t2.display to list individual records.
Is there a way to remove certain fields from the display?

Specifically, when displaying the record, I can see the model
instance's id #, with this being the thing I wish to remove.

This is the code I'm using to grab the record from my db:

db.event1.represent=lambda event1: A(event1.title, _href=t2.action('/
wiki/display', event1.id))


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



[web2py:16079] Re: new puppy example please?

2009-02-09 Thread Peter

Massimo,

You are understandably cautious about using absolute urls, but sending
verification mails is one place where we really need them.

Currently, in tools.py line 646 you insert only the key into the
verification message; how about inserting the validation_url as well?

Line 360 could then be something like
   auth.messages.verify_email = \
  'Click on the link: %(validate_url)s/%(key)s to verify your
email'

I would be happy to suggest a patch, but I don't want to sneak in a
fullurl() helper... ;-)

Cheers,
-Peter

On Feb 9, 3:56 pm, Peter  wrote:
> Hi Chris,
>
> AFAIK you only need to configure the mailer as documented in the
> tools.py source. There is an error in the docstring in the Mail class,
> use the example code in the Auth class.
> Check if you can reach the mail server that you configure by running
> "telnet  25" and check that you get a connection on that port.
> Ehmm, I have ZERO experience on GAE, can't help you with mail settings
> there...
>
> # in db.py:
>
> from gluon.tools import Mail, Auth, Crud
> mail=Mail()
> mail.settings.server='smtp.yourprovider.tld:25'
> mail.settings.sender='@somewhere.com'
> # only configure login if you need smtp authentication
> # check your regular mail setup
> mail.settings.login='username:password'
>
> # plus, after the line... auth=Auth(globals(),db)
> auth.settings.mailer=mail
>
> def fullurl(a=None,c=None,f=None,r=None,args=[],vars={}):
>     return '%s://%s%s' % (r.env.wsgi_url_scheme,r.env.http_host,URL
> (a=a,c=c,f=f,r=r,args=args,vars=vars))
>
> auth.messages.verify_email = \
>     'Click on the link ' + fullurl(r=request,f='user',args=
> ['verify_email']) + '/%(key)s to verify your email'
>
> These two last lines are necessary because Massimo maybe wasn't really
> really /really/ ready with the Auth verify code yet... ;-)
>
> That should do the trick...  If you want to bypass user validation,
> ie, grant access without entering the validation string, you can
> simply use the web db admin to clear the validation_key field for that
> user.
>
> If you run into any problems, please post. I'm in Amsterdam GMT+1 so
> timewise that's closer than you may think. ;-)
>
> Cheers,
> -Peter
>
> On Feb 9, 2:59 pm, murray3  wrote:
>
> > Peter,
> > thanks for this I will have a go later (I'm in Dublin GMT), just one
> > thing
> > what needs to be set up to get the code to send the registration email
> > other wise when you enable authentication you are locking yourself out
> > as you can't register or login?
> > regards
> > chris
>
> > On Feb 8, 11:32 pm, Peter  wrote:
>
> > > Chris, this is something I was working on, based on the t2.pdf
> > > example... See if it is of any use to you. The indentation will be
> > > screwed up pretty badly, I'm afraid...
>
> > > These instructions replicate the puppy example in the
> > > T2.PDF docs, pages 7-11, for the new tools.py
> > > environment in web2py 1.56
>
> > > 0. From the admin interface, add new app 'puppy'
>
> > > 1. Define table 'puppy' and create a crud instance
>
> > > # db.py:
>
> > > db.define_table('puppy',
> > >     SQLField('name'),
> > >     SQLField('image','upload') )
> > > db.puppy.name.requires=IS_NOT_EMPTY()
>
> > > from gluon.tools import Mail, Auth, Crud
> > > crud=Crud(globals(),db)
>
> > > 2. Enable a RESTful interface through crud
>
> > > # controllers/default.py:
>
> > > def data():
> > >     return dict(form=crud())
>
> > > def download():
> > >     return response.download(request,db)
>
> > > 3. Go tohttp://localhost:8000/puppy/default/data/create/puppy
> > > to see a 'create puppy' form and play around with the default CRUD
> > > interface
>
> > > 4. Create a template for the CRUD pages
>
> > > # views/default/data.html
>
> > > {{extend 'layout.html'}}
> > > {{=form}}
> > > You are now using the data.html template.
>
> > > ...and retry the CRUD URLs; the nice admin/session/etc buttons showed
> > > earlier should be missing now...
>
> > > 5. Define a combo page that shows items + a create form
>
> > > # views/default/customcreate.html
> > > {{extend 'layout.html'}}
>
> > > 
> > > Post the image of a Puppy
> > > {{=form}}
> > > 
> > > 
> > > Puppies
> > > {{=items}}
> > > 
> > > You are now using the customcreate.html template.
>
> > > # controllers/default.py
> > > def customcreate():
> > >     form = crud.create('puppy')
> > >     items = crud.select('puppy', linkto=URL(r=request,f='data',args=
> > > ['read']))
> > >     return dict(form=form, items=items)
>
> > > 6. Optionally include the "search" widget from t2.py?
> > > (see t2.pdf, page 9)
> > > (the high-level stuff such as search, comments, etc has gracefully
> > > been split out of tools.py)
>
> > > 7. Add authentication
>
> > > # in models/db.py:
> > > # define your own auth_user table so you can extend it later...
> > > # you can also set auth.settings.table_user later, but you may lose
> > > users already registered (?)
> > > db.define_table('auth_user',
> > >     SQLField('first_name',length=32,default=''),
> > >     

[web2py:16080] Re: Model Field Suppression

2009-02-09 Thread Wes James

in your db.py put:

db.tablename.exposes=['field1','field2']

only fields in [ ] will be shown

-wj

On Mon, Feb 9, 2009 at 8:41 AM, TakeTheStage  wrote:
>
> I'm using T3 and using t2.display to list individual records.
> Is there a way to remove certain fields from the display?
>
> Specifically, when displaying the record, I can see the model
> instance's id #, with this being the thing I wish to remove.
>
> This is the code I'm using to grab the record from my db:
>
> db.event1.represent=lambda event1: A(event1.title, _href=t2.action('/
> wiki/display', event1.id))
>
>
> Many thanks.
> >
>

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



[web2py:16081] Re: new puppy example please?

2009-02-09 Thread Wes James

As mentioned before it is so the developer can put in their own messge.

-wj

On Mon, Feb 9, 2009 at 9:04 AM, Peter  wrote:
>
> Massimo,
>
> You are understandably cautious about using absolute urls, but sending
> verification mails is one place where we really need them.
>
> Currently, in tools.py line 646 you insert only the key into the
> verification message; how about inserting the validation_url as well?
>
> Line 360 could then be something like
>   auth.messages.verify_email = \
>  'Click on the link: %(validate_url)s/%(key)s to verify your
> email'
>



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



[web2py:16082] SQLTable example does not work

2009-02-09 Thread Rolfa

from the README in the web2py 1.56.2 distribution:

#you can also define once for all

timestamp=SQLTable(None,'timestamp',
SQLField('created_on','datetime',
  writable=False,
  default=request.now),
SQLField('modified_on','datetime',
  writable=False,
  default=request.now,update=request.now))

#and use it in all your tables

db.define_table('mytable',db.Field('somefield'),timestamp)


Error traceback

Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 98, in restricted
exec ccode in environment
  File "/opt/web2py/applications/test_ra/models/db.py", line 11, in

timestamp=SQLTable(None,'timestamp',
NameError: name 'SQLTable' is not defined

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



[web2py:16083] Re: new puppy example please?

2009-02-09 Thread Peter

> As mentioned before

I am aware that I can set message strings if I don't like them.
However, from my POV, email verification is *broken* out of the box.
Sure, a mail gets sent, but the link in that mail doesn't work. Do we
want to make it easy to use this stuff, or what? If this was discussed
before, my apologies.

Now we can do two things. 1. Document this peculiar web2py behavior,
ie, big letters in the Auth docstring, "don't forget to set
message.verify_email, and you may need a fullurl function to go with
it, which we won't provide for security reasons, nah nah nah nah nah"
or 2. Fix it, since it is trivial enough. ;-)

Maybe this is my chance to contribute: please put my suggestion to
Chris in the "official web2py documentation", by way of implementing
option 1. ;-))

Cheers,
-Peter

On Feb 9, 5:07 pm, Wes James  wrote:
> As mentioned before it is so the developer can put in their own messge.
>
> -wj
>
> On Mon, Feb 9, 2009 at 9:04 AM, Peter  wrote:
>
> > Massimo,
>
> > You are understandably cautious about using absolute urls, but sending
> > verification mails is one place where we really need them.
>
> > Currently, in tools.py line 646 you insert only the key into the
> > verification message; how about inserting the validation_url as well?
>
> > Line 360 could then be something like
> >   auth.messages.verify_email = \
> >      'Click on the link: %(validate_url)s/%(key)s to verify your
> > email'
>
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16084] Re: Pyjamas and web2py

2009-02-09 Thread lkcl

> There's going to have to be different server classes because of the
> different api's of django, web2py, web.py.  The one I posted above is
> not truly complete (it doesn't do service description for example),
> but it seems to do the basics correctly when tested with the pyjamas
> JSONRPC client. The client fromhttp://lkcl.net/jsonrpclib.tgzalso
> seems to work fine. I haven't tried any other clients.

 that's brilliant, chris, thank you very much.


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



[web2py:16085] changed file name in file upload

2009-02-09 Thread Wes James

Massimo,

I was looking through the archives and was looking to see if there was
any discussion on why file names are changed when they are upload when
the field is of type upload.  I was looking at how plone does this and
it looks like it just retains the file name when you upload a file so
when you download it, it keeps the same name as was uploaded.  I
thought you had said something about cross-site scripting, but I can't
find anything.  Can you explain why files are being changed to some
form of uuid/uuid4 combo and the original named not retained?

thx,

-wj

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



[web2py:16086] Re: new puppy example please?

2009-02-09 Thread Peter

Hi Wes, on rereading --
maybe my earlier msg gave you the impression that I suggested fixing
the message string itself?? That wasn't what I meant, of course. I
referred to line 360 only to illustrate how a proposed fix would be
used.

Every verification mail will need a functioning (=absolute) link to
the verify_email function, currently not easily provided by web2py --
that is what this is about.

Cheers,
-Peter

On Feb 9, 5:07 pm, Wes James  wrote:
> As mentioned before it is so the developer can put in their own messge.
>
> -wj
>
> On Mon, Feb 9, 2009 at 9:04 AM, Peter  wrote:
>
> > Massimo,
>
> > You are understandably cautious about using absolute urls, but sending
> > verification mails is one place where we really need them.
>
> > Currently, in tools.py line 646 you insert only the key into the
> > verification message; how about inserting the validation_url as well?
>
> > Line 360 could then be something like
> >   auth.messages.verify_email = \
> >      'Click on the link: %(validate_url)s/%(key)s to verify your
> > email'
>
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16087] Abusing model files for common functionality

2009-02-09 Thread hcvst

Hi,

thanks for the new release and all the effort you put in. Even if I am
new to web2py and not a seasoned Python programmer yet, the release
notes sound  very promising and I look forward to experimenting
further.

My question:

Model files seem such a convenient location to place functionality
that is common across controllers, though I suspect that it is bad
style to do so.

For example to create a model file called helper.py with the following
contents:


## Global Configuration
# Primary navigation menu
MENU = [["Home",  URL(r=request, c="default", f="index")],
["Forum", URL(r=request, c="forum",   f="index")],
["Test", "http://test";]]

## Helper functions
def _menu():
"""
Return the menu as a list of lists where each element
takes the form of [strLinkText, boolIsActiveLink, strLinkUrl]
"""
m = []
for text, url in MENU:
m.append([text, URL(r=request) == url, url]);
return m


This enables me to call from every controller function:

response.menu = _menu()


Just the fact that response is in global scope  here is very
convenient. However I do not want to violate the MCV pattern, unless
it is acceptable here. Moving this logic into a separate module is
akward, as one has to move varibles back and forth and needs to
restart web2py every so often for changes to the module to take
effect.

What is best practice, when it comes to sharing code across
controllers please?

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



[web2py:16088] Re: Abusing model files for common functionality

2009-02-09 Thread Timothy Farrell

Welcome to Python and web2py!

There are two ways of looking at this issue.

1) "Model" refers to execution model upon which the controller is run 
and view is rendered.  In this view, it is entirely acceptable to put 
these application-global things in a model file.

2) "Model" refers to data model.  In this view, anything other than data 
descriptions contained in a model file is a violation of MVC.  This is 
the view of MVC purists.

I hold view #2.  However, for those of us who hold view #2, web2py 
offers no easy way to have application-wide settings without violating 
our MVC convictions.  I have reconciled my convictions by creating a 
separate "model" file called "settings.py" placed all my execution model 
stuff in that.  Thereby sort of maintaining my view of MVC separation 
and still having easy access to application-wide settings.

I sacrifice a white lamb to the MVC god every month until there is a 
better solution.

=)

-tim

hcvst wrote:
> Hi,
>
> thanks for the new release and all the effort you put in. Even if I am
> new to web2py and not a seasoned Python programmer yet, the release
> notes sound  very promising and I look forward to experimenting
> further.
>
> My question:
>
> Model files seem such a convenient location to place functionality
> that is common across controllers, though I suspect that it is bad
> style to do so.
>
> For example to create a model file called helper.py with the following
> contents:
>
> 
> ## Global Configuration
> # Primary navigation menu
> MENU = [["Home",  URL(r=request, c="default", f="index")],
> ["Forum", URL(r=request, c="forum",   f="index")],
> ["Test", "http://test";]]
>
> ## Helper functions
> def _menu():
> """
> Return the menu as a list of lists where each element
> takes the form of [strLinkText, boolIsActiveLink, strLinkUrl]
> """
> m = []
> for text, url in MENU:
> m.append([text, URL(r=request) == url, url]);
> return m
> 
>
> This enables me to call from every controller function:
>
> response.menu = _menu()
>
>
> Just the fact that response is in global scope  here is very
> convenient. However I do not want to violate the MCV pattern, unless
> it is acceptable here. Moving this logic into a separate module is
> akward, as one has to move varibles back and forth and needs to
> restart web2py every so often for changes to the module to take
> effect.
>
> What is best practice, when it comes to sharing code across
> controllers please?
>
> Best regards,
> HC
> >
>   

-- 
Timothy Farrell 
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


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



[web2py:16089] Re: RFC: table select/delete, limitby=num

2009-02-09 Thread mdipierro

I am for all of these. Send me a patch!

Massimo

On Feb 9, 9:17 am, Robin B  wrote:
> Its alive!
>
> #batch insert>>> db.posts.insert([dict(count=i+1) for i in range(3)])
>
> [1, 2, 3]
>
> #batch update (with optional transactions)>>> def inc(r): r.count+=1
> >>> def dec(r): r.count-=1
> >>> db.posts.update(1,[2,3],dict(count=0),dict(count=lambda v: 
> >>> v+2),dec,inc,count=lambda v: v-2)
>
> 3
>
> #batch get>>> db.posts.select(orderby=db.posts.id)
>
> [{'count': 0L, 'id': 1}, {'count': 0L, 'id': 2}, {'count': 0L, 'id':
> 3}]
>
> #batch delete>>> db.posts.delete([3,2],1)
>
> 3
>
> And its fully transactional when you pass callable args, all the
> drivers will get it for free because it is not done at the driver
> level.
>
> Robin
>
> On Feb 8, 3:46 pm, Robin B  wrote:
>
> > I think in SQL you can use '|' to generate each in 1 query.
>
> > Robin
>
> > On Feb 8, 3:44 pm, mdipierro  wrote:
>
> > > In principle I am for all of these but I am not sure they can be
> > > implemented easily in SQL without loops. Can they?
>
> > > On Feb 8, 3:39 pm, Robin B  wrote:
>
> > > > We could add select and delete to tables and limitby could have a
> > > > shortcut:
>
> > > > instead of:
> > > > (db.posts.id>0).select(orderby=~db.posts.created_at,limitby=(0,10))
>
> > > > how about:
> > > > db.posts.select(orderby=~db.posts.created_at, limitby=10)
>
> > > > batch get:
> > > > db.posts.select([3,5,9])
>
> > > > and delete could also accept kwargs:
> > > > db.posts.delete(orderby=db.posts.created_at,limitby=10)
>
> > > > and batch delete:
> > > > db.posts.delete([3,5,9])
>
> > > > Robin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16090] Re: Abusing model files for common functionality

2009-02-09 Thread Timothy Farrell

I just looked at your code.  If you're going application-wide.  Why not 
just put "response.menu = _menu()" in the model file.  That way you 
won't have to call it in the controller.

Here's an unrelated Python performance tip...try to avoid using 
for-loops for building a list.  The list.append() method is somewhat 
expensive.  Instead we use something called a list-comprehension.  Your 
code would look like this as a list-comprehension:

def _menu():
"""
Return the menu as a list of lists where each element
takes the form of [strLinkText, boolIsActiveLink, strLinkUrl]
"""
m = [[text, URL(r=request) == url, url] for text, url in MENU]
return m

For small loops (such as this one), no one will notice much difference, 
but it's good to know this for large loops or for areas that just need 
to run really fast.  Also faster code uses less energy and therefore 
does more to save the planet from Republicans.  

-tim

Timothy Farrell wrote:
> Welcome to Python and web2py!
>
> There are two ways of looking at this issue.
>
> 1) "Model" refers to execution model upon which the controller is run 
> and view is rendered.  In this view, it is entirely acceptable to put 
> these application-global things in a model file.
>
> 2) "Model" refers to data model.  In this view, anything other than data 
> descriptions contained in a model file is a violation of MVC.  This is 
> the view of MVC purists.
>
> I hold view #2.  However, for those of us who hold view #2, web2py 
> offers no easy way to have application-wide settings without violating 
> our MVC convictions.  I have reconciled my convictions by creating a 
> separate "model" file called "settings.py" placed all my execution model 
> stuff in that.  Thereby sort of maintaining my view of MVC separation 
> and still having easy access to application-wide settings.
>
> I sacrifice a white lamb to the MVC god every month until there is a 
> better solution.
>
> =)
>
> -tim
>
> hcvst wrote:
>   
>> Hi,
>>
>> thanks for the new release and all the effort you put in. Even if I am
>> new to web2py and not a seasoned Python programmer yet, the release
>> notes sound  very promising and I look forward to experimenting
>> further.
>>
>> My question:
>>
>> Model files seem such a convenient location to place functionality
>> that is common across controllers, though I suspect that it is bad
>> style to do so.
>>
>> For example to create a model file called helper.py with the following
>> contents:
>>
>> 
>> ## Global Configuration
>> # Primary navigation menu
>> MENU = [["Home",  URL(r=request, c="default", f="index")],
>> ["Forum", URL(r=request, c="forum",   f="index")],
>> ["Test", "http://test";]]
>>
>> ## Helper functions
>> def _menu():
>> """
>> Return the menu as a list of lists where each element
>> takes the form of [strLinkText, boolIsActiveLink, strLinkUrl]
>> """
>> m = []
>> for text, url in MENU:
>> m.append([text, URL(r=request) == url, url]);
>> return m
>> 
>>
>> This enables me to call from every controller function:
>>
>> response.menu = _menu()
>>
>>
>> Just the fact that response is in global scope  here is very
>> convenient. However I do not want to violate the MCV pattern, unless
>> it is acceptable here. Moving this logic into a separate module is
>> akward, as one has to move varibles back and forth and needs to
>> restart web2py every so often for changes to the module to take
>> effect.
>>
>> What is best practice, when it comes to sharing code across
>> controllers please?
>>
>> Best regards,
>> HC
>> 
>>   
>> 
>
>   

-- 
Timothy Farrell 
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


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



[web2py:16091] Re: Model Field Suppression

2009-02-09 Thread mdipierro

This

> db.tablename.exposes=['field1','field2']
> only fields in [ ] will be shown

is the old T2 only notation. It still works with T2 and T3 but this is
the new way (since 1.56)

db.tablename.field1.writable=True
db.tablename.field2.writable=True
db.tablename.field3.writable=False


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



[web2py:16092] Re: SQLTable example does not work

2009-02-09 Thread mdipierro

either

from gluon.sql import SQLTable

or better replace SQLTable with db.Table (since 1.56)

Massimo

On Feb 9, 10:08 am, Rolfa  wrote:
> from the README in the web2py 1.56.2 distribution:
>
> #you can also define once for all
>
> timestamp=SQLTable(None,'timestamp',
> SQLField('created_on','datetime',
>   writable=False,
>   default=request.now),
> SQLField('modified_on','datetime',
>   writable=False,
>   default=request.now,update=request.now))
>
> #and use it in all your tables
>
> db.define_table('mytable',db.Field('somefield'),timestamp)
>
> Error traceback
>
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/restricted.py", line 98, in restricted
> exec ccode in environment
>   File "/opt/web2py/applications/test_ra/models/db.py", line 11, in
> 
> timestamp=SQLTable(None,'timestamp',
> NameError: name 'SQLTable' is not defined
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16093] Re: Pyjamas and web2py

2009-02-09 Thread mdipierro

Thank you Chris.

Massimo

On Feb 9, 10:51 am, lkcl  wrote:
> > There's going to have to be different server classes because of the
> > different api's of django, web2py, web.py.  The one I posted above is
> > not truly complete (it doesn't do service description for example),
> > but it seems to do the basics correctly when tested with the pyjamas
> > JSONRPC client. The client fromhttp://lkcl.net/jsonrpclib.tgzalso
> > seems to work fine. I haven't tried any other clients.
>
>  that's brilliant, chris, thank you very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16094] Re: changed file name in file upload

2009-02-09 Thread mdipierro

For 3 reasons:
1) avoid directory traversal attacks
2) avoid conflicts (two files uploaded with same name)
3) be able to identify which table and which record a file belongs to
from the file name itself.

Massimo

On Feb 9, 11:10 am, Wes James  wrote:
> Massimo,
>
> I was looking through the archives and was looking to see if there was
> any discussion on why file names are changed when they are upload when
> the field is of type upload.  I was looking at how plone does this and
> it looks like it just retains the file name when you upload a file so
> when you download it, it keeps the same name as was uploaded.  I
> thought you had said something about cross-site scripting, but I can't
> find anything.  Can you explain why files are being changed to some
> form of uuid/uuid4 combo and the original named not retained?
>
> thx,
>
> -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16095] Re: Abusing model files for common functionality

2009-02-09 Thread mdipierro

Mind that models are called in alphabetic order. I call my settings
file

0_database.py
0_googlemaps.py
0_etcetc.py
0_private.py (stuff that I do not want to go under version control)

Massimo



On Feb 9, 1:54 pm, Timothy Farrell  wrote:
> I just looked at your code.  If you're going application-wide.  Why not
> just put "response.menu = _menu()" in the model file.  That way you
> won't have to call it in the controller.
>
> Here's an unrelated Python performance tip...try to avoid using
> for-loops for building a list.  The list.append() method is somewhat
> expensive.  Instead we use something called a list-comprehension.  Your
> code would look like this as a list-comprehension:
>
> def _menu():
> """
> Return the menu as a list of lists where each element
> takes the form of [strLinkText, boolIsActiveLink, strLinkUrl]
> """
> m = [[text, URL(r=request) == url, url] for text, url in MENU]
> return m
>
> For small loops (such as this one), no one will notice much difference,
> but it's good to know this for large loops or for areas that just need
> to run really fast.  Also faster code uses less energy and therefore
> does more to save the planet from Republicans.  
>
> -tim
>
>
>
> Timothy Farrell wrote:
> > Welcome to Python and web2py!
>
> > There are two ways of looking at this issue.
>
> > 1) "Model" refers to execution model upon which the controller is run
> > and view is rendered.  In this view, it is entirely acceptable to put
> > these application-global things in a model file.
>
> > 2) "Model" refers to data model.  In this view, anything other than data
> > descriptions contained in a model file is a violation of MVC.  This is
> > the view of MVC purists.
>
> > I hold view #2.  However, for those of us who hold view #2, web2py
> > offers no easy way to have application-wide settings without violating
> > our MVC convictions.  I have reconciled my convictions by creating a
> > separate "model" file called "settings.py" placed all my execution model
> > stuff in that.  Thereby sort of maintaining my view of MVC separation
> > and still having easy access to application-wide settings.
>
> > I sacrifice a white lamb to the MVC god every month until there is a
> > better solution.
>
> > =)
>
> > -tim
>
> > hcvst wrote:
>
> >> Hi,
>
> >> thanks for the new release and all the effort you put in. Even if I am
> >> new to web2py and not a seasoned Python programmer yet, the release
> >> notes sound  very promising and I look forward to experimenting
> >> further.
>
> >> My question:
>
> >> Model files seem such a convenient location to place functionality
> >> that is common across controllers, though I suspect that it is bad
> >> style to do so.
>
> >> For example to create a model file called helper.py with the following
> >> contents:
>
> >> 
> >> ## Global Configuration
> >> # Primary navigation menu
> >> MENU = [["Home",  URL(r=request, c="default", f="index")],
> >> ["Forum", URL(r=request, c="forum",   f="index")],
> >> ["Test", "http://test";]]
>
> >> ## Helper functions
> >> def _menu():
> >> """
> >> Return the menu as a list of lists where each element
> >> takes the form of [strLinkText, boolIsActiveLink, strLinkUrl]
> >> """
> >> m = []
> >> for text, url in MENU:
> >> m.append([text, URL(r=request) == url, url]);
> >> return m
> >> 
>
> >> This enables me to call from every controller function:
>
> >> response.menu = _menu()
>
> >> Just the fact that response is in global scope  here is very
> >> convenient. However I do not want to violate the MCV pattern, unless
> >> it is acceptable here. Moving this logic into a separate module is
> >> akward, as one has to move varibles back and forth and needs to
> >> restart web2py every so often for changes to the module to take
> >> effect.
>
> >> What is best practice, when it comes to sharing code across
> >> controllers please?
>
> >> Best regards,
> >> HC
>
> --
> Timothy Farrell 
> Computer Guy
> Statewide General Insurance Agency (www.swgen.com)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16096] Re: SQL Designer Import

2009-02-09 Thread mdipierro

excellent

On Feb 9, 9:17 am, dhmorgan  wrote:
> Note: this thread continues from thread of same name:
>http://groups.google.com/group/web2py/browse_thread/thread/30eb9ee195...
>
> Additionally, I have now posted a how-to on webfaction for setting it
> up there:
>http://forum.webfaction.com/viewtopic.php?pid=8718#p8718
>
> On Feb 9, 8:57 am, D Harriman Morgan 
> wrote:
>
> > Update:
>
> > The short of it is that I can only get sqldesigner to save/load server-side
> > when I set it up using Boris Manojlovic's (attached) script file for
> > installing web2py with sqldesigner included as application 'init'. The  file
> > (web2py-designer-patches.zip) includes three files: 'README', which is
> > actually a script file that downloads and installs both web2py and
> > wwwsqldesigner; '01-routes.patch' which creates a routes.py file, and
> > '02-init.patch', which modifies three files within the new 'init'
> > application.
>
> > Installation using the script file requires that you be ready to browse to
> > the new application during the process, as the script must wait for you to
> > create an 'init' application via the web2py admin view. In this example, I
> > have subdomain sqldesigner.example.com for http and https.
>
> > [ in first terminal]
> > copy the README, 01-routes.patch, and 02-init.patch files to directory
> > from which you'll serve this web2py instance, mine is
> > '~/webapps/sqldesigner'
>
> > make README executable and run it
> > chmod 764 README
> > ./README
>
> > script will prompt you to open another terminal to create an 'init' app.
>
> > [ in second terminal}
> > cd ~/webapps/sqldesigner/web2py
> > #  = port number
> > python web2py.py -p 
> > password of your choice
>
> > [open browser to admin for this site]
>
> > create new application, 'init'
>
> > at this point the README installation script resumes, which you'll see
> > in the first terminal
>
> > [ in first terminal]
>
> > script should end by telling you it patched four files and that it
> > should just work
>
> > while you're there, kill the web2py you started in the second
> > terminal, according to the instructions provided at startup, 'kill -SIGTERM
> > # ' for example
>
> > it may just work; in my case, however (installed as webfaction custom
> > app) I had to move the contents of sqldesigner/web2py down one level
>
> > try this if it doesn't "just work":
> > mv ~/webapps/sqldesigner/web2py/* ~/webapps/sqldesigner/ rmdir
> > ~/webapps/sqldesigner/web2py
>
> > restart web2py
> > screen python web2py.py -p  -password=''
>
> > [ in second terminal}
> > screen -d
>
> > And you're there. Point your browser tohttp://sqldesigner.example.comand
> > you have your own facility for visually modeling data in a format that's
> > readily exportable to web2py. As you would hope, the sqldesigner data can be
> > administered via admin over https.
>
> > My immediate impression with using SQL-Designer is quite positive. Having a
> > visual representation and being able to save/retrieve/edit the models is
> > allowing me to work far more productively. It has room for improvement (see
> > below), which makes me wonder about doing it all fresh in Pyjamas
>
> > Rooms for improvement: ordering of output by depedency (order is currently
> > chronological(?) which causes errors in web2py model compilation), cannot do
> > things like copy/paste tables or fields, cannot select multiple tables for
> > repositioning/deleting, documentation button opens wwwsqldesigner twice,
> > etc.
>
> > Danny
>
> >  web2py-designer-patches.zip
> > 5KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16097] upload file not being deleted

2009-02-09 Thread Wes James

Massimo,

I just downloaded web2py with svn.   I installed t3 and have a field
with upload type.  When I delete the file with the delete file check
box, the file does not get deleted from uploads as it has been
recently.

-wj

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



[web2py:16098] broken link in the official website

2009-02-09 Thread sebastian

in http://mdp.cti.depaul.edu/examples/default/docs there is a broken
link that should point to the web2py applications with source code.

It points to http://mdp.cti.depaul.edu/applicances but it returns an
invalid function
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16099] Re: upload file not being deleted

2009-02-09 Thread mdipierro

New feature in 1.56. You must set

db.tablename.fieldname.autodelete=True

On Feb 9, 2:14 pm, Wes James  wrote:
> Massimo,
>
> I just downloaded web2py with svn.   I installed t3 and have a field
> with upload type.  When I delete the file with the delete file check
> box, the file does not get deleted from uploads as it has been
> recently.
>
> -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16100] Re: broken link in the official website

2009-02-09 Thread mdipierro

fixed. thanks.

On Feb 9, 2:16 pm, sebastian  wrote:
> inhttp://mdp.cti.depaul.edu/examples/default/docsthere is a broken
> link that should point to the web2py applications with source code.
>
> It points tohttp://mdp.cti.depaul.edu/applicancesbut it returns an
> invalid function
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16101] Re: upload file not being deleted

2009-02-09 Thread Wes James

oops - that's right - need to remember some of these new changes...

-wj

On Mon, Feb 9, 2009 at 1:52 PM, mdipierro  wrote:
>
> New feature in 1.56. You must set
>
> db.tablename.fieldname.autodelete=True
>
> On Feb 9, 2:14 pm, Wes James  wrote:
>> Massimo,
>>
>> I just downloaded web2py with svn.   I installed t3 and have a field
>> with upload type.  When I delete the file with the delete file check
>> box, the file does not get deleted from uploads as it has been
>> recently.
>>
>> -wj
> >
>

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



[web2py:16102] Re: Abusing model files for common functionality

2009-02-09 Thread hcvst

Thank you for your response, Tim. I didn't know that lists
comprehension performs better.
I assumed it to be mostly a short-hand notation inspired by a
functional programming style.

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



[web2py:16103] Re: Abusing model files for common functionality

2009-02-09 Thread Timothy Farrell

The main benefit is for building lists (and dictionaries in Python 2.6+) 
because list.append() has to allocate more memory at each call.

Using the list comprehension allows it to allocate memory just once 
instead of N-times.

-tim

hcvst wrote:
> Thank you for your response, Tim. I didn't know that lists
> comprehension performs better.
> I assumed it to be mostly a short-hand notation inspired by a
> functional programming style.
>
> HC
> >
>   

-- 
Timothy Farrell 
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


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



[web2py:16104] GAE: sql bug

2009-02-09 Thread Sebastian E. Ovide
Hi Massimo,

is this a bug ?

the following model wont work on GAE:



db.define_table('potato',
#  SQLField('size','float',default=0)
  SQLField('size','double',default=0)
)

db(db.potato.id>0).delete()
if len(db(db.potato.id>0).select())==0:
db.potato.insert()
mydb=db(db.potato.id>0).select()[0]



it says



ERROR2009-02-09 22:01:07,757 main.py] Traceback (most recent call last):
  File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
restricted
exec ccode in environment
  File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
line 16, in 
db.potato.insert()
  File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 298, in
insert
tmp = self._tableobj(**fields)
  File
"C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
line 588, in __init__
prop.__set__(self, value)
  File
"C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
line 388, in __set__
value = self.validate(value)
  File
"C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
line 2135, in validate
raise BadValueError('Property %s must be a float' % self.name)
BadValueError: Property size must be a float



and if I set it as float it says:



ERROR2009-02-09 22:05:50,595 main.py] Traceback (most recent call last):
  File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
restricted
exec ccode in environment
  File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
line 10, in 
SQLField('size','float',default=0)
  File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 167, in
define_table
t._create()
  File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 265, in
_create
raise SyntaxError, 'SQLField: unkown field type'
SyntaxError: SQLField: unkown field type

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



[web2py:16105] form pre-population fails if field is shown in 1.56.2

2009-02-09 Thread DenesL

Correct me if I am wrong but I think

form.vars.field='value'

used to work whether or not the field was shown in the form or not.
It doesn't seem to work in 1.56.2 .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16106] Re: GAE: sql bug

2009-02-09 Thread mdipierro

double is correct.

Currently you cannot insert an empty record

db.potato.insert()

even if fields have a default. I can change it.

On Feb 9, 4:08 pm, "Sebastian E. Ovide" 
wrote:
> Hi Massimo,
>
> is this a bug ?
>
> the following model wont work on GAE:
>
> db.define_table('potato',
> #  SQLField('size','float',default=0)
>   SQLField('size','double',default=0)
> )
>
> db(db.potato.id>0).delete()
> if len(db(db.potato.id>0).select())==0:
> db.potato.insert()
> mydb=db(db.potato.id>0).select()[0]
>
> it says
>
> ERROR2009-02-09 22:01:07,757 main.py] Traceback (most recent call last):
>   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
> restricted
> exec ccode in environment
>   File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> line 16, in 
> db.potato.insert()
>   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 298, in
> insert
> tmp = self._tableobj(**fields)
>   File
> "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> line 588, in __init__
> prop.__set__(self, value)
>   File
> "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> line 388, in __set__
> value = self.validate(value)
>   File
> "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> line 2135, in validate
> raise BadValueError('Property %s must be a float' % self.name)
> BadValueError: Property size must be a float
>
> and if I set it as float it says:
>
> ERROR2009-02-09 22:05:50,595 main.py] Traceback (most recent call last):
>   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
> restricted
> exec ccode in environment
>   File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> line 10, in 
> SQLField('size','float',default=0)
>   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 167, in
> define_table
> t._create()
>   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 265, in
> _create
> raise SyntaxError, 'SQLField: unkown field type'
> SyntaxError: SQLField: unkown field type
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16107] Re: form pre-population fails if field is shown in 1.56.2

2009-02-09 Thread mdipierro

I just tried and it works for me. Can you show me your model?

Massimo

On Feb 9, 4:36 pm, DenesL  wrote:
> Correct me if I am wrong but I think
>
> form.vars.field='value'
>
> used to work whether or not the field was shown in the form or not.
> It doesn't seem to work in 1.56.2 .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16108] Re: GAE: sql bug

2009-02-09 Thread mdipierro

correction. You can insert an empty records if at least one field has
a default value.  From your email it there seems to be a problem on
GAE.

@Robin. Can you double check this one?

Massimo

On Feb 9, 4:40 pm, mdipierro  wrote:
> double is correct.
>
> Currently you cannot insert an empty record
>
> db.potato.insert()
>
> even if fields have a default. I can change it.
>
> On Feb 9, 4:08 pm, "Sebastian E. Ovide" 
> wrote:
>
> > Hi Massimo,
>
> > is this a bug ?
>
> > the following model wont work on GAE:
>
> > db.define_table('potato',
> > #  SQLField('size','float',default=0)
> >   SQLField('size','double',default=0)
> > )
>
> > db(db.potato.id>0).delete()
> > if len(db(db.potato.id>0).select())==0:
> > db.potato.insert()
> > mydb=db(db.potato.id>0).select()[0]
>
> > it says
>
> > ERROR2009-02-09 22:01:07,757 main.py] Traceback (most recent call last):
> >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
> > restricted
> > exec ccode in environment
> >   File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > line 16, in 
> > db.potato.insert()
> >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 298, in
> > insert
> > tmp = self._tableobj(**fields)
> >   File
> > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > line 588, in __init__
> > prop.__set__(self, value)
> >   File
> > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > line 388, in __set__
> > value = self.validate(value)
> >   File
> > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > line 2135, in validate
> > raise BadValueError('Property %s must be a float' % self.name)
> > BadValueError: Property size must be a float
>
> > and if I set it as float it says:
>
> > ERROR2009-02-09 22:05:50,595 main.py] Traceback (most recent call last):
> >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
> > restricted
> > exec ccode in environment
> >   File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > line 10, in 
> > SQLField('size','float',default=0)
> >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 167, in
> > define_table
> > t._create()
> >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 265, in
> > _create
> > raise SyntaxError, 'SQLField: unkown field type'
> > SyntaxError: SQLField: unkown field type
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16109] t3 edit fields have "None" to the right

2009-02-09 Thread Wes James

Anyone else seeing "None" to the right of fields while editing data in
a form or editing models, settings, etc in Manage menu?

This is using t3

-wj

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



[web2py:16110] Re: t3 edit fields have "None" to the right

2009-02-09 Thread ANDROSoft

on created pages with forms "None" is too :D

On 10 Lut, 00:21, Wes James  wrote:
> Anyone else seeing "None" to the right of fields while editing data in
> a form or editing models, settings, etc in Manage menu?
>
> This is using t3
>
> -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16111] Re: GAE: sql bug

2009-02-09 Thread Robin B

I think you are misunderstanding the error message.

BadValueError: Property size must be a float

The error message is saying you must pass in a 'float'ing point
number, and 0 is not a floating point number.

# This does not work
gdb = GQLDB()
gdb.define_table('potato',gdb.Field('size','double',default=0))
gdb.potato.insert()

# This works
gdb = GQLDB()
gdb.define_table('potato',gdb.Field('size','double',default=0.0))
gdb.potato.insert()

I am not a fan of type coercion, because it will mask bugs.

Robin



On Feb 9, 4:54 pm, mdipierro  wrote:
> correction. You can insert an empty records if at least one field has
> a default value.  From your email it there seems to be a problem on
> GAE.
>
> @Robin. Can you double check this one?
>
> Massimo
>
> On Feb 9, 4:40 pm, mdipierro  wrote:
>
> > double is correct.
>
> > Currently you cannot insert an empty record
>
> >     db.potato.insert()
>
> > even if fields have a default. I can change it.
>
> > On Feb 9, 4:08 pm, "Sebastian E. Ovide" 
> > wrote:
>
> > > Hi Massimo,
>
> > > is this a bug ?
>
> > > the following model wont work on GAE:
>
> > > db.define_table('potato',
> > > #  SQLField('size','float',default=0)
> > >   SQLField('size','double',default=0)
> > > )
>
> > > db(db.potato.id>0).delete()
> > > if len(db(db.potato.id>0).select())==0:
> > >     db.potato.insert()
> > > mydb=db(db.potato.id>0).select()[0]
>
> > > it says
>
> > > ERROR    2009-02-09 22:01:07,757 main.py] Traceback (most recent call 
> > > last):
> > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
> > > restricted
> > >     exec ccode in environment
> > >   File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > > line 16, in 
> > >     db.potato.insert()
> > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 298, 
> > > in
> > > insert
> > >     tmp = self._tableobj(**fields)
> > >   File
> > > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > line 588, in __init__
> > >     prop.__set__(self, value)
> > >   File
> > > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > line 388, in __set__
> > >     value = self.validate(value)
> > >   File
> > > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > line 2135, in validate
> > >     raise BadValueError('Property %s must be a float' % self.name)
> > > BadValueError: Property size must be a float
>
> > > and if I set it as float it says:
>
> > > ERROR    2009-02-09 22:05:50,595 main.py] Traceback (most recent call 
> > > last):
> > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in
> > > restricted
> > >     exec ccode in environment
> > >   File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > > line 10, in 
> > >     SQLField('size','float',default=0)
> > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 167, 
> > > in
> > > define_table
> > >     t._create()
> > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 265, 
> > > in
> > > _create
> > >     raise SyntaxError, 'SQLField: unkown field type'
> > > SyntaxError: SQLField: unkown field type
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16112] Re: GAE: sql bug

2009-02-09 Thread Sebastian E. Ovide
the strange thing is that it works with SQLLITE ...

On Mon, Feb 9, 2009 at 10:05 PM, Robin B  wrote:

>
> I think you are misunderstanding the error message.
>
> BadValueError: Property size must be a float
>
> The error message is saying you must pass in a 'float'ing point
> number, and 0 is not a floating point number.
>
> # This does not work
> gdb = GQLDB()
> gdb.define_table('potato',gdb.Field('size','double',default=0))
> gdb.potato.insert()
>
> # This works
> gdb = GQLDB()
> gdb.define_table('potato',gdb.Field('size','double',default=0.0))
> gdb.potato.insert()
>
> I am not a fan of type coercion, because it will mask bugs.
>
> Robin
>
>
>
> On Feb 9, 4:54 pm, mdipierro  wrote:
> > correction. You can insert an empty records if at least one field has
> > a default value.  From your email it there seems to be a problem on
> > GAE.
> >
> > @Robin. Can you double check this one?
> >
> > Massimo
> >
> > On Feb 9, 4:40 pm, mdipierro  wrote:
> >
> > > double is correct.
> >
> > > Currently you cannot insert an empty record
> >
> > > db.potato.insert()
> >
> > > even if fields have a default. I can change it.
> >
> > > On Feb 9, 4:08 pm, "Sebastian E. Ovide" 
> > > wrote:
> >
> > > > Hi Massimo,
> >
> > > > is this a bug ?
> >
> > > > the following model wont work on GAE:
> >
> > > > db.define_table('potato',
> > > > #  SQLField('size','float',default=0)
> > > >   SQLField('size','double',default=0)
> > > > )
> >
> > > > db(db.potato.id>0).delete()
> > > > if len(db(db.potato.id>0).select())==0:
> > > > db.potato.insert()
> > > > mydb=db(db.potato.id>0).select()[0]
> >
> > > > it says
> >
> > > > ERROR2009-02-09 22:01:07,757 main.py] Traceback (most recent call
> last):
> > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line
> 98, in
> > > > restricted
> > > > exec ccode in environment
> > > >   File
> "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > > > line 16, in 
> > > > db.potato.insert()
> > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line
> 298, in
> > > > insert
> > > > tmp = self._tableobj(**fields)
> > > >   File
> > > >
> "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > > line 588, in __init__
> > > > prop.__set__(self, value)
> > > >   File
> > > >
> "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > > line 388, in __set__
> > > > value = self.validate(value)
> > > >   File
> > > >
> "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > > line 2135, in validate
> > > > raise BadValueError('Property %s must be a float' % self.name)
> > > > BadValueError: Property size must be a float
> >
> > > > and if I set it as float it says:
> >
> > > > ERROR2009-02-09 22:05:50,595 main.py] Traceback (most recent call
> last):
> > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line
> 98, in
> > > > restricted
> > > > exec ccode in environment
> > > >   File
> "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > > > line 10, in 
> > > > SQLField('size','float',default=0)
> > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line
> 167, in
> > > > define_table
> > > > t._create()
> > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line
> 265, in
> > > > _create
> > > > raise SyntaxError, 'SQLField: unkown field type'
> > > > SyntaxError: SQLField: unkown field type
> >
>

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



[web2py:16113] Re: star-nix.com web2py hosting not confidence inspiring

2009-02-09 Thread Baron

"crappy...expensive...not confidence inspiring"
you're not being very constructive.
Phyo's offering a free web2py enabled hosting service and has an
advertisement for web2py on the front page - that's fantastic!


On Feb 8, 8:35 pm, Tokyo Dan  wrote:
> I wonder when *Nix is going to correct the link 
> onhttp://www.star-nix.com/34/the-first-web2py-enabled-hosting-service?
>
> It still says the web2py demo is at 2web2py.star-nix.com".
>
> Also there's no page where you can setup an account nor see the prices
> of the hosting plans.
>
> This hosting provider is still not confidence inspiring.
>
> On Feb 3, 4:06 am, phyo.arkarl...@gmail.com wrote:
>
> >http://web2rokee.star-nix.com/welcome
>
> > Please check here now.
>
> > On 2/2/09, phyo.arkarl...@gmail.com  wrote:
>
> > > Thanks massimo.
>
> > > Soon we will start a free web2py enabled hosting service for everyone.
> > > Right now demo is not avaliable due to transfering of host.
>
> > > Tokyo Dan. Please do not evaluate our services without even trying yet.
>
> > > On 2/2/09, mdipierro  wrote:
>
> > >> The creator of star-nix is Phyo. He is a very active member of this
> > >> community.
>
> > >> I am sure these are temporary problems and he'll be here soon
> > >> explaining it.
>
> > >> Massimo
>
> > >> On Feb 2, 12:18 am, Tokyo Dan  wrote:
> > >>> "You can now start checking our web2py demo at web2py.star-nix.com."
>
> > >>> Went to this hosting site and tried to find "web2py.star-nix.com".
> > >>> It's not there. Also searching for web2py on that website doesn't
> > >>> return much info. Not confidence inspiring
>
> > >>> Seems like a crappy hosting service. Expensive too.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16115] Re: t3 edit fields have "None" to the right

2009-02-09 Thread mdipierro

I will look into this for now:

for field in db.table.fields: db.table[fields].comment=''


On Feb 9, 5:56 pm, ANDROSoft  wrote:
> on created pages with forms "None" is too :D
>
> On 10 Lut, 00:21, Wes James  wrote:
>
> > Anyone else seeing "None" to the right of fields while editing data in
> > a form or editing models, settings, etc in Manage menu?
>
> > This is using t3
>
> > -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16116] Re: thank you!

2009-02-09 Thread Lance

thank you Massimo :)

On Feb 9, 10:03 am, mdipierro  wrote:
> I just wanted to acknowledge and thank Bill, Robin, Douglas, Fran, Wes
> and Luke for all the patches they sent me these days (averaging at
> more than 10 per day).
>
> I apologize if I have been slow in keeping up but I am also reviewing
> 4 large projects for the Department of Energy and one for the National
> Science Foundation. Not to mention my own research projects, my
> courses, my students, my committee work, the PyCon registration, and
> family.
>
> If I did not respond to you I will. If I still do not answer to you,
> please remind me.
>
> It feels great to be part of this group of competent, qualified and
> active people!
>
> Short term priorities:
> 1) rewrite sql.py to be more modular (Bill and Robin are leading this
> effort and making lot of progress)
> 2) include support zxJDBC (experimental in trunk)
> 3) fix t2 and t3 to use the new gluon/tools
> 4) better documentation.
>
> Forgetting something?
>
> If you want to take over the maintenance of any of the web2py
> applications please ask. I encourage it.
>
> Massimo

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



[web2py:16117] Re: star-nix.com web2py hosting not confidence inspiring

2009-02-09 Thread mdipierro

Yes it is fantastic!

Massimo

On Feb 9, 6:23 pm, Baron  wrote:
> Phyo's offering a free web2py enabled hosting service and has an
> advertisement for web2py on the front page - that's fantastic!
>
> On Feb 8, 8:35 pm, Tokyo Dan  wrote:
>
> > I wonder when *Nix is going to correct the link 
> > onhttp://www.star-nix.com/34/the-first-web2py-enabled-hosting-service?
>
> > It still says the web2py demo is at 2web2py.star-nix.com".
>
> > Also there's no page where you can setup an account nor see the prices
> > of the hosting plans.
>
> > This hosting provider is still not confidence inspiring.
>
> > On Feb 3, 4:06 am, phyo.arkarl...@gmail.com wrote:
>
> > >http://web2rokee.star-nix.com/welcome
>
> > > Please check here now.
>
> > > On 2/2/09, phyo.arkarl...@gmail.com  wrote:
>
> > > > Thanks massimo.
>
> > > > Soon we will start a free web2py enabled hosting service for everyone.
> > > > Right now demo is not avaliable due to transfering of host.
>
> > > > Tokyo Dan. Please do not evaluate our services without even trying yet.
>
> > > > On 2/2/09, mdipierro  wrote:
>
> > > >> The creator of star-nix is Phyo. He is a very active member of this
> > > >> community.
>
> > > >> I am sure these are temporary problems and he'll be here soon
> > > >> explaining it.
>
> > > >> Massimo
>
> > > >> On Feb 2, 12:18 am, Tokyo Dan  wrote:
> > > >>> "You can now start checking our web2py demo at web2py.star-nix.com."
>
> > > >>> Went to this hosting site and tried to find "web2py.star-nix.com".
> > > >>> It's not there. Also searching for web2py on that website doesn't
> > > >>> return much info. Not confidence inspiring
>
> > > >>> Seems like a crappy hosting service. Expensive too.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16118] Re: GAE: sql bug

2009-02-09 Thread mdipierro

Yes. SQLDB does not always convert types. Robin, can you fix this else
I can do it.

Massimo

On Feb 9, 6:18 pm, "Sebastian E. Ovide" 
wrote:
> the strange thing is that it works with SQLLITE ...
>
> On Mon, Feb 9, 2009 at 10:05 PM, Robin B  wrote:
>
> > I think you are misunderstanding the error message.
>
> > BadValueError: Property size must be a float
>
> > The error message is saying you must pass in a 'float'ing point
> > number, and 0 is not a floating point number.
>
> > # This does not work
> > gdb = GQLDB()
> > gdb.define_table('potato',gdb.Field('size','double',default=0))
> > gdb.potato.insert()
>
> > # This works
> > gdb = GQLDB()
> > gdb.define_table('potato',gdb.Field('size','double',default=0.0))
> > gdb.potato.insert()
>
> > I am not a fan of type coercion, because it will mask bugs.
>
> > Robin
>
> > On Feb 9, 4:54 pm, mdipierro  wrote:
> > > correction. You can insert an empty records if at least one field has
> > > a default value.  From your email it there seems to be a problem on
> > > GAE.
>
> > > @Robin. Can you double check this one?
>
> > > Massimo
>
> > > On Feb 9, 4:40 pm, mdipierro  wrote:
>
> > > > double is correct.
>
> > > > Currently you cannot insert an empty record
>
> > > > db.potato.insert()
>
> > > > even if fields have a default. I can change it.
>
> > > > On Feb 9, 4:08 pm, "Sebastian E. Ovide" 
> > > > wrote:
>
> > > > > Hi Massimo,
>
> > > > > is this a bug ?
>
> > > > > the following model wont work on GAE:
>
> > > > > db.define_table('potato',
> > > > > #  SQLField('size','float',default=0)
> > > > >   SQLField('size','double',default=0)
> > > > > )
>
> > > > > db(db.potato.id>0).delete()
> > > > > if len(db(db.potato.id>0).select())==0:
> > > > > db.potato.insert()
> > > > > mydb=db(db.potato.id>0).select()[0]
>
> > > > > it says
>
> > > > > ERROR2009-02-09 22:01:07,757 main.py] Traceback (most recent call
> > last):
> > > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line
> > 98, in
> > > > > restricted
> > > > > exec ccode in environment
> > > > >   File
> > "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > > > > line 16, in 
> > > > > db.potato.insert()
> > > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line
> > 298, in
> > > > > insert
> > > > > tmp = self._tableobj(**fields)
> > > > >   File
>
> > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > > > line 588, in __init__
> > > > > prop.__set__(self, value)
> > > > >   File
>
> > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > > > line 388, in __set__
> > > > > value = self.validate(value)
> > > > >   File
>
> > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py",
> > > > > line 2135, in validate
> > > > > raise BadValueError('Property %s must be a float' % self.name)
> > > > > BadValueError: Property size must be a float
>
> > > > > and if I set it as float it says:
>
> > > > > ERROR2009-02-09 22:05:50,595 main.py] Traceback (most recent call
> > last):
> > > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line
> > 98, in
> > > > > restricted
> > > > > exec ccode in environment
> > > > >   File
> > "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py",
> > > > > line 10, in 
> > > > > SQLField('size','float',default=0)
> > > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line
> > 167, in
> > > > > define_table
> > > > > t._create()
> > > > >   File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line
> > 265, in
> > > > > _create
> > > > > raise SyntaxError, 'SQLField: unkown field type'
> > > > > SyntaxError: SQLField: unkown field type
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16119] Re: form pre-population fails if field is shown in 1.56.2

2009-02-09 Thread DenesL


db.define_table('calls',
  SQLField('number','integer'),
  SQLField('created','datetime')
)

def indexC():
  return dict()

def updateC():
  rows=db(db.calls.id==1).select()
  form1=SQLFORM(db.calls,rows[0])
  form1.vars.number=5
  if form1.accepts(request.vars):
session.flash='form accepted!'
redirect(URL(r=request,f='index'))
  elif form1.errors:
response.flash='please fix errors and re-submit'
  return dict(form1=form1)

Shouldn't updateC change the number of call with id==1 to 5?

Actually, the value does not get changed in previous versions either,
but the manual says:

Prepopulating the form

It is always possible to prepopulate a form using the syntax:
form.vars.name='fieldvalue'
Statements like the one above must be inserted after the form
declaration and
before the form is accepted, whether or not the field ("name" in the
example)
is explicitly visualized in the form.

If you hide the number field using
form1=SQLFORM(db.calls,rows[0],fields=['created'])
then the number of the call with id==1 gets changed to 5.

Maybe it is just a wording misunderstanding.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16120] Re: Multiple validation problem (bug?)

2009-02-09 Thread ionel

Hello Massimo,

Any solution for this problem?

Thanks

ionel

On Feb 1, 9:26 am, mdipierro  wrote:
> Let me try this
>
> On Feb 1, 9:41 am, ionel  wrote:
>
> > I already did that:
>
> > 1) db.book.title.requires=IS_UPPER()
> > db.book.author.requires=IS_UPPER()
> > db.book.author.requires=IS_NOT_IN_DB(db
> >     ((db.book.title==request.vars.title)&
> > (db.book.volume==request.vars.volume)),'book.author')
>
> > INPUT:             RESULT IN DATABASE:
> > Author, Title      Author, Title
> > python  python     python  PYTHON
> > PythoN  PythoN     PythoN  PYTHON
>
> > IS_UPPER don't works for Author!
>
> > 2) db.book.title.requires=IS_UPPER()
> > db.book.author.requires=[IS_UPPER(), IS_NOT_IN_DB(db
> > ((db.book.title==request.vars.title)&
> > (db.book.volume==request.vars.volume)),'book.author')]
>
> > INPUT:             RESULT IN DATABASE:
> > Author, Title      Author, Title
> > python  python     PYTHON  PYTHON
> > PythoN  PythoN     PYTHON  PYTHON
>
> > The result is 2 identical records in database despite of IS_NOT_IN_DB!
>
> > Thanks.
>
> > ionel
>
> > On Feb 1, 4:12 am, Fran  wrote:
>
> > > > db.book.author.requires=[IS_UPPER(),
> > > >     IS_NOT_IN_DB(db((db.book.title==request.vars.title)&
> > > > (db.book.volume==request.vars.volume)),'book.author')]
> > > > The condition "IS_NOT_IN_DB" don't works anymore.
>
> > > Split across 2 lines:
> > > db.book.author.requires=IS_UPPER()
> > > db.book.author.requires=IS_NOT_IN_DB(db
> > > ((db.book.title==request.vars.title)&
> > > (db.book.volume==request.vars.volume)),'book.author')
>
> > > F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16121] Re: form pre-population fails if field is shown in 1.56.2

2009-02-09 Thread mdipierro

I believe this is and should be the correct behaviour.

form.accepts happens after form.vars.number=5 is set, thus it should
store in form.vars.number whatever is in the form, unless the field
was not in the form to begin with.


Massimo

On Feb 9, 9:25 pm, DenesL  wrote:
> db.define_table('calls',
>   SQLField('number','integer'),
>   SQLField('created','datetime')
> )
>
> def indexC():
>   return dict()
>
> def updateC():
>   rows=db(db.calls.id==1).select()
>   form1=SQLFORM(db.calls,rows[0])
>   form1.vars.number=5
>   if form1.accepts(request.vars):
>     session.flash='form accepted!'
>     redirect(URL(r=request,f='index'))
>   elif form1.errors:
>     response.flash='please fix errors and re-submit'
>   return dict(form1=form1)
>
> Shouldn't updateC change the number of call with id==1 to 5?
>
> Actually, the value does not get changed in previous versions either,
> but the manual says:
>
> Prepopulating the form
>
> It is always possible to prepopulate a form using the syntax:
> form.vars.name='fieldvalue'
> Statements like the one above must be inserted after the form
> declaration and
> before the form is accepted, whether or not the field ("name" in the
> example)
> is explicitly visualized in the form.
>
> If you hide the number field using
> form1=SQLFORM(db.calls,rows[0],fields=['created'])
> then the number of the call with id==1 gets changed to 5.
>
> Maybe it is just a wording misunderstanding.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16122] Re: Multiple validation problem (bug?)

2009-02-09 Thread mdipierro

Hi ionel,

it is not a bug. The validatior should be

db.book.author.requires=[IS_UPPER(), IS_NOT_IN_DB(db
((db.book.title==request.vars.get('title','').upper())&
(db.book.volume==request.vars.volume)),'book.author')]

since the title is in always in upper case in the db but it may not be
in upper case in the request.vars.


On Feb 9, 10:00 pm, ionel  wrote:
> Hello Massimo,
>
> Any solution for this problem?
>
> Thanks
>
> ionel
>
> On Feb 1, 9:26 am, mdipierro  wrote:
>
> > Let me try this
>
> > On Feb 1, 9:41 am, ionel  wrote:
>
> > > I already did that:
>
> > > 1) db.book.title.requires=IS_UPPER()
> > > db.book.author.requires=IS_UPPER()
> > > db.book.author.requires=IS_NOT_IN_DB(db
> > >     ((db.book.title==request.vars.title)&
> > > (db.book.volume==request.vars.volume)),'book.author')
>
> > > INPUT:             RESULT IN DATABASE:
> > > Author, Title      Author, Title
> > > python  python     python  PYTHON
> > > PythoN  PythoN     PythoN  PYTHON
>
> > > IS_UPPER don't works for Author!
>
> > > 2) db.book.title.requires=IS_UPPER()
> > > db.book.author.requires=[IS_UPPER(), IS_NOT_IN_DB(db
> > > ((db.book.title==request.vars.title)&
> > > (db.book.volume==request.vars.volume)),'book.author')]
>
> > > INPUT:             RESULT IN DATABASE:
> > > Author, Title      Author, Title
> > > python  python     PYTHON  PYTHON
> > > PythoN  PythoN     PYTHON  PYTHON
>
> > > The result is 2 identical records in database despite of IS_NOT_IN_DB!
>
> > > Thanks.
>
> > > ionel
>
> > > On Feb 1, 4:12 am, Fran  wrote:
>
> > > > > db.book.author.requires=[IS_UPPER(),
> > > > >     IS_NOT_IN_DB(db((db.book.title==request.vars.title)&
> > > > > (db.book.volume==request.vars.volume)),'book.author')]
> > > > > The condition "IS_NOT_IN_DB" don't works anymore.
>
> > > > Split across 2 lines:
> > > > db.book.author.requires=IS_UPPER()
> > > > db.book.author.requires=IS_NOT_IN_DB(db
> > > > ((db.book.title==request.vars.title)&
> > > > (db.book.volume==request.vars.volume)),'book.author')
>
> > > > F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16123] Re: thank you!

2009-02-09 Thread mr.freeze

Sometimes I think that Massimo isn't a single person, but a collective
of young energetic hackers that wake each other in shifts to write
Python code around the clock :)  Thanks for web2py!

On Feb 9, 7:44 pm, Lance  wrote:
> thank you Massimo :)
>
> On Feb 9, 10:03 am, mdipierro  wrote:
>
> > I just wanted to acknowledge and thank Bill, Robin, Douglas, Fran, Wes
> > and Luke for all the patches they sent me these days (averaging at
> > more than 10 per day).
>
> > I apologize if I have been slow in keeping up but I am also reviewing
> > 4 large projects for the Department of Energy and one for the National
> > Science Foundation. Not to mention my own research projects, my
> > courses, my students, my committee work, the PyCon registration, and
> > family.
>
> > If I did not respond to you I will. If I still do not answer to you,
> > please remind me.
>
> > It feels great to be part of this group of competent, qualified and
> > active people!
>
> > Short term priorities:
> > 1) rewrite sql.py to be more modular (Bill and Robin are leading this
> > effort and making lot of progress)
> > 2) include support zxJDBC (experimental in trunk)
> > 3) fix t2 and t3 to use the new gluon/tools
> > 4) better documentation.
>
> > Forgetting something?
>
> > If you want to take over the maintenance of any of the web2py
> > applications please ask. I encourage it.
>
> > Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16124] Re: thank you!

2009-02-09 Thread mdipierro

This explains what all those loud voices in my head are! How do I make
them go away?

Massimo

On Feb 9, 11:17 pm, "mr.freeze"  wrote:
> Sometimes I think that Massimo isn't a single person, but a collective
> of young energetic hackers that wake each other in shifts to write
> Python code around the clock :)  Thanks for web2py!
>
> On Feb 9, 7:44 pm, Lance  wrote:
>
> > thank you Massimo :)
>
> > On Feb 9, 10:03 am, mdipierro  wrote:
>
> > > I just wanted to acknowledge and thank Bill, Robin, Douglas, Fran, Wes
> > > and Luke for all the patches they sent me these days (averaging at
> > > more than 10 per day).
>
> > > I apologize if I have been slow in keeping up but I am also reviewing
> > > 4 large projects for the Department of Energy and one for the National
> > > Science Foundation. Not to mention my own research projects, my
> > > courses, my students, my committee work, the PyCon registration, and
> > > family.
>
> > > If I did not respond to you I will. If I still do not answer to you,
> > > please remind me.
>
> > > It feels great to be part of this group of competent, qualified and
> > > active people!
>
> > > Short term priorities:
> > > 1) rewrite sql.py to be more modular (Bill and Robin are leading this
> > > effort and making lot of progress)
> > > 2) include support zxJDBC (experimental in trunk)
> > > 3) fix t2 and t3 to use the new gluon/tools
> > > 4) better documentation.
>
> > > Forgetting something?
>
> > > If you want to take over the maintenance of any of the web2py
> > > applications please ask. I encourage it.
>
> > > Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16125] error when import

2009-02-09 Thread INeedHelp

def import_file():
   form=FORM(INPUT(_type='file',_name='data'),INPUT
(_type='submit'))
  if form.accepts(request.vars):
db.import_from_csv_file(form.vars.data.file)
   # for every table
   for table in db.tables:  # for every uuid, delete
all but the most
   items = db(db[table].id>0).select(db[table].id,
   db[table].uuid,orderby=~db[table].modified_on,
  groupby=db[table].uuid)
   for item in items:
   db((db[table].uuid==item.uuid)&(db[table].id!=
item.id)).delete
 return dict(form=form)


with error:
TypeError: long() argument must be a string or a number, not 'list'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16126] TypeError: coercing to Unicode: need string or buffer, list found

2009-02-09 Thread INeedHelp

I want to zip a file in a folder.
but with this error

TypeError: coercing to Unicode: need string or buffer, list found
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16127] Re: error when import

2009-02-09 Thread mdipierro

Do you have the traceback from the ticket?

Massimo

On Feb 9, 11:51 pm, INeedHelp  wrote:
> def import_file():
>    form=FORM(INPUT(_type='file',_name='data'),INPUT
> (_type='submit'))
>   if form.accepts(request.vars):
>     db.import_from_csv_file(form.vars.data.file)
>    # for every table
>    for table in db.tables:                  # for every uuid, delete
> all but the most
>        items = db(db[table].id>0).select(db[table].id,
>    db[table].uuid,orderby=~db[table].modified_on,
>   groupby=db[table].uuid)
>    for item in items:
>    db((db[table].uuid==item.uuid)&(db[table].id!=
> item.id)).delete
>  return dict(form=form)
>
> with error:
> TypeError: long() argument must be a string or a number, not 'list'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16128] Re: TypeError: coercing to Unicode: need string or buffer, list found

2009-02-09 Thread mdipierro

please post code and traceback else it is hard to figure out what the
issue is.

Massimo

On Feb 9, 11:52 pm, INeedHelp  wrote:
> I want to zip a file in a folder.
> but with this error
>
> TypeError: coercing to Unicode: need string or buffer, list found
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16129] Re: TypeError: coercing to Unicode: need string or buffer, list found

2009-02-09 Thread INeedHelp

import os
import zipfile

def zip():

form = FORM(TABLE("", INPUT(_type="submit",_value="SUBMIT")))

if form.accepts(request.vars):

uploaded_files = os.listdir([os.getcwd
(),'applications',request.application, 'uploads'])
zipf = zipfile.Zipfile(os.getcwd(),
'applications',request.application,
'uploads','uploads_backup.zip','w')
for f in uploaded_files:
try: zipf.write(f)
except: pass
#return encode('rot13')

f.close()


return dict(form=form)
return unicode


On Feb 10, 1:59 pm, mdipierro  wrote:
> please post code and traceback else it is hard to figure out what the
> issue is.
>
> Massimo
>
> On Feb 9, 11:52 pm, INeedHelp  wrote:
>
>
>
> > I want to zip a file in a folder.
> > but with this error
>
> > TypeError: coercing to Unicode: need string or buffer, list found- Hide 
> > quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16130] Re: error when import

2009-02-09 Thread INeedHelp

what do you mean?

On Feb 10, 1:58 pm, mdipierro  wrote:
> Do you have the traceback from the ticket?
>
> Massimo
>
> On Feb 9, 11:51 pm, INeedHelp  wrote:
>
>
>
> > def import_file():
> >    form=FORM(INPUT(_type='file',_name='data'),INPUT
> > (_type='submit'))
> >   if form.accepts(request.vars):
> >     db.import_from_csv_file(form.vars.data.file)
> >    # for every table
> >    for table in db.tables:                  # for every uuid, delete
> > all but the most
> >        items = db(db[table].id>0).select(db[table].id,
> >    db[table].uuid,orderby=~db[table].modified_on,
> >   groupby=db[table].uuid)
> >    for item in items:
> >    db((db[table].uuid==item.uuid)&(db[table].id!=
> > item.id)).delete
> >  return dict(form=form)
>
> > with error:
> > TypeError: long() argument must be a string or a number, not 'list'- Hide 
> > quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16131] SyntaxError: user is tampering with form

2009-02-09 Thread Maurice Ling

Hi Massimo

I have a problem here. One of my functions work perfectly in Version
1.47 (2008-10-27 12:36:17) but failed in Version 1.56.2 (2009-02-08
21:49:34) with this error

Traceback (most recent call last):
  File "D:\web2py\gluon\restricted.py", line 98, in restricted
exec ccode in environment
  File "D:/web2py/applications/cynote/controllers/cynote.py", line
145, in 
  File "D:\web2py\gluon\globals.py", line 74, in 
self._caller = lambda f: f()
  File "D:/web2py/applications/cynote/controllers/cynote.py", line 26,
in show
if comments.accepts(request.vars,session):
  File "D:\web2py\gluon\sqlhtml.py", line 422, in accepts
raise SyntaxError, 'user is tampering with form'
SyntaxError: user is tampering with form

A snipplet of the model is this:

cynotedb.define_table('entry',
SQLField('title'),
SQLField('file','upload'),
SQLField('filename'),
SQLField('keywords',length=256),
SQLField('notebook',cynotedb.notebook),
SQLField('datetime','datetime',default=now),
SQLField('description','text'))

#the comment table
#entry_id link to entry table
cynotedb.define_table('comment',
SQLField('author'),
SQLField('file','upload'),
SQLField('filename'),
SQLField('body', 'text'),
SQLField('datetime','datetime',default=now),
SQLField('entry_id',cynotedb.entry))

The code in question is this:

def show():
# called to show one entry and its linked comments based on
# the entry.id
# called by TOC in order to provide an entry.id
id=request.vars.id
entries=cynotedb(cynotedb.entry.id==id).select()
# to prevent showing a 'None' (null) entry
if not len(entries): redirect(URL(r=request,f='entries'))
# form to post new comments
comments=SQLFORM(cynotedb.comment,fields=['author','body'])
# give entry.id for comment output
comments.vars.entry_id = id;
# return the comment that is listed with the entry id
records=cynotedb(cynotedb.comment.entry_id==id)\
.select(orderby=cynotedb.comment.entry_id)
# show a flash when comment is posted
if comments.accepts(request.vars,session):
 response.flash = "comment posted"
return dict(entry=entries[0],comments=comments,records=records)

The error seems to lie at
if comments.accepts(request.vars,session):
 response.flash = "comment posted"

When I comment out these Version 1.56.2 (2009-02-08 21:49:34), the
function works but I am not able to add new comments into
cynotedb.comment table.

I think this error seems to be induced by a new version of web2py.
My reasons being:

1. When I run a older developmental version of my application (cynote)
in Version 1.47, it works nicely - Not in Version 1.56.2

2. When I copy and pasted the older version into my application in
web2py Version 1.56.2 (trying to rule out indentation and invisible
characters error), it failed.

3. When I copied the entire application directory into web2py Version
1.47, it works fine.

Hence, the only reason that I cannot rule out is the difference in
web2py versions.

Please advice.

Thanks
Maurice Ling


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



[web2py:16132] Re: error when import

2009-02-09 Thread INeedHelp

Traceback (most recent call last):  File "/Users/mdipierro/web2py/
gluon/restricted.py", line 98, in restricted  File "C:/Documents and
Settings/__/Desktop/web2py_win/web2py/applications/cynoteDup/
controllers/zip.py", line 24, in   File "/Users/mdipierro/
web2py/gluon/globals.py", line 74, in   File "C:/Documents and
Settings/__/Desktop/web2py_win/web2py/applications/cynoteDup/
controllers/zip.py", line 10, in zipTypeError: coercing to Unicode:
need string or buffer, list found

On Feb 10, 2:39 pm, INeedHelp  wrote:
> what do you mean?
>
> On Feb 10, 1:58 pm, mdipierro  wrote:
>
>
>
> > Do you have the traceback from the ticket?
>
> > Massimo
>
> > On Feb 9, 11:51 pm, INeedHelp  wrote:
>
> > > def import_file():
> > >    form=FORM(INPUT(_type='file',_name='data'),INPUT
> > > (_type='submit'))
> > >   if form.accepts(request.vars):
> > >     db.import_from_csv_file(form.vars.data.file)
> > >    # for every table
> > >    for table in db.tables:                  # for every uuid, delete
> > > all but the most
> > >        items = db(db[table].id>0).select(db[table].id,
> > >    db[table].uuid,orderby=~db[table].modified_on,
> > >   groupby=db[table].uuid)
> > >    for item in items:
> > >    db((db[table].uuid==item.uuid)&(db[table].id!=
> > > item.id)).delete
> > >  return dict(form=form)
>
> > > with error:
> > > TypeError: long() argument must be a string or a number, not 'list'- Hide 
> > > quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16133] Re: error when import

2009-02-09 Thread INeedHelp

sorry. should be this one

Traceback (most recent call last):  File "/Users/mdipierro/web2py/
gluon/restricted.py", line 98, in restricted  File "C:/Documents and
Settings/__/Desktop/web2py_win/web2py/applications/cynoteDup/
controllers/rep.py", line 31, in   File "/Users/mdipierro/
web2py/gluon/globals.py", line 74, in   File "C:/Documents and
Settings/__/Desktop/web2py_win/web2py/applications/cynoteDup/
controllers/rep.py", line 18, in import_sync  File "/Users/mdipierro/
web2py/gluon/sql.py", line 850, in import_from_csv_file  File "/Users/
mdipierro/web2py/gluon/sql.py", line 1318, in import_from_csv_file
File "/Users/mdipierro/web2py/gluon/sql.py", line 968, in __getitem__
File "/Users/mdipierro/web2py/gluon/sql.py", line 914, in
is_integerTypeError: long() argument must be a string or a number, not
'list'

On Feb 10, 3:00 pm, INeedHelp  wrote:
> Traceback (most recent call last):  File "/Users/mdipierro/web2py/
> gluon/restricted.py", line 98, in restricted  File "C:/Documents and
> Settings/__/Desktop/web2py_win/web2py/applications/cynoteDup/
> controllers/zip.py", line 24, in   File "/Users/mdipierro/
> web2py/gluon/globals.py", line 74, in   File "C:/Documents and
> Settings/__/Desktop/web2py_win/web2py/applications/cynoteDup/
> controllers/zip.py", line 10, in zipTypeError: coercing to Unicode:
> need string or buffer, list found
>
> On Feb 10, 2:39 pm, INeedHelp  wrote:
>
>
>
> > what do you mean?
>
> > On Feb 10, 1:58 pm, mdipierro  wrote:
>
> > > Do you have the traceback from the ticket?
>
> > > Massimo
>
> > > On Feb 9, 11:51 pm, INeedHelp  wrote:
>
> > > > def import_file():
> > > >    form=FORM(INPUT(_type='file',_name='data'),INPUT
> > > > (_type='submit'))
> > > >   if form.accepts(request.vars):
> > > >     db.import_from_csv_file(form.vars.data.file)
> > > >    # for every table
> > > >    for table in db.tables:                  # for every uuid, delete
> > > > all but the most
> > > >        items = db(db[table].id>0).select(db[table].id,
> > > >    db[table].uuid,orderby=~db[table].modified_on,
> > > >   groupby=db[table].uuid)
> > > >    for item in items:
> > > >    db((db[table].uuid==item.uuid)&(db[table].id!=
> > > > item.id)).delete
> > > >  return dict(form=form)
>
> > > > with error:
> > > > TypeError: long() argument must be a string or a number, not 'list'- 
> > > > Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16134] Re: TypeError: coercing to Unicode: need string or buffer, list found

2009-02-09 Thread INeedHelp

import os
import zipfile

def zip():

form = FORM(TABLE("", INPUT(_type="submit",_value="SUBMIT")))

if form.accepts(request.vars):

uploaded_files = os.listdir([os.getcwd
(),'applications',request.application, 'uploads'])
zipf = zipfile.Zipfile(os.getcwd(),
'applications',request.application,
'uploads','uploads_backup.zip','w')
for f in uploaded_files:
try: zipf.write(f)
except: pass
#return encode('rot13')

f.close()


return dict(form=form)
return unicode

Traceback (most recent call last):
  File "/Users/mdipierro/web2py/gluon/restricted.py", line 98, in
restricted
  File "C:/Documents and Settings/__/Desktop/web2py_win/web2py/
applications/cynoteDup/controllers/zip.py", line 24, in 
  File "/Users/mdipierro/web2py/gluon/globals.py", line 74, in

  File "C:/Documents and Settings/__/Desktop/web2py_win/web2py/
applications/cynoteDup/controllers/zip.py", line 10, in zip
TypeError: coercing to Unicode: need string or buffer, list found

On Feb 10, 1:59 pm, mdipierro  wrote:
> please post code and traceback else it is hard to figure out what the
> issue is.
>
> Massimo
>
> On Feb 9, 11:52 pm, INeedHelp  wrote:
>
>
>
> > I want to zip a file in a folder.
> > but with this error
>
> > TypeError: coercing to Unicode: need string or buffer, list found- Hide 
> > quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---