[web2py] Re: Paypal on Appengine

2011-05-28 Thread Arbie Samong
Thanks for the replies guys. I started off with pbreit's snippet:
http://groups.google.com/group/web2py/browse_thread/thread/6cc84d9fb609e74/cdb0d848ed691e40?q=paypal+pbreit#cdb0d848ed691e40

First I ran into a problem in which paypal is saying I'm not
authorized to make the api call. Some googling and found a suggestion
to remove the 'subject' from the call, and it worked, at least on the
part where the api credentials are being verified.

Now when I test on sandbox it redirects fine. However, it displays the
'regular' login screen. When I try to login using a test personal
account, it goes to the user's My Account panel.

I know it should be showing a confirmation page for the purchase,
amirite?  And afterwards it has to go back to my return url for
further processing on my end.

Is that behavior limited to IPN? I know this approach does not make
use of the IPN.

Here's the modified/simplified version of pbreit's code that I use:


# models


paypal_config = {
'user': 'my_api_username',
'pwd': 'my_api_pwd',
'signature': 'my_api_sig',
'version': '66.0',
'button_source': 'https://www.paypal.com/en_US/i/btn/
btn_buynowCC_LG.gif' ,
'return_url' : 'http://localhost:8000/controller/default/
paypal_return',
'cancel_url' : 'http://localhost:8000/controller/default/
paypal_cancel',
'notify_url' : 'http://localhost:8000/controller/default/
paypal_ipn',
}

db.define_table('purchase',
Field('owner', 'reference auth_user', readable=False,
writable=False, default=auth.user_id),
Field('amount'),
Field('item'),
Field('invoice', unique=True),
Field('status', readable=False, writable=False,
default='pending'),
Field('transaction_id'),
Field('date', 'datetime', default=request.now))


#module


import urllib
import cgi

def setec(config, purchase):
values =   {'USER': config['user'],
'PWD': config['pwd'],
'SIGNATURE': config['signature'],
'VERSION': config['version'],
'METHOD': 'SetExpressCheckout',
'PAYMENTREQUEST_0_AMT': purchase.amount,
'PAYMENTREQUEST_0_CURRENCYCODE': 'USD',
'RETURNURL': config['return_url'],
'CANCELURL': config['cancel_url'],
'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale',
'PAYMENTREQUEST_0_INVNUM': purchase.invoice,
'PAYMENTREQUEST_0_NOTIFYURL': config['notify_url']}
return cgi.parse_qs(urllib.urlopen('https://api-3t.paypal.com/
nvp', urllib.urlencode(values)).read())

def getec(config, token, recipient_id):
values =   {'USER': config['user'],
'PWD': config['pwd'],
'SIGNATURE': config['signature'],
'VERSION': config['version'],
'METHOD': 'GetExpressCheckoutDetails',
'TOKEN': token}
return cgi.parse_qs(urllib.urlopen('https://api-3t.paypal.com/
nvp', urllib.urlencode(values)).read())

def doec(config, token, purchase, payerid):
values =   {'USER': config['user'],
'PWD': config['pwd'],
'SIGNATURE': config['signature'],
'VERSION': config['version'],
'METHOD': 'DoExpressCheckoutPayment',
'BUTTONSOURCE': config['button_source'],
'TOKEN': token,
'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale',
'PAYMENTREQUEST_0_DESC': 'Order #%s' % (purchase.id),
'PAYMENTREQUEST_0_AMT': purchase.amount,
'PAYMENTREQUEST_0_CURRENCYCODE': 'USD',
'PAYERID': payerid}
return cgi.parse_qs(urllib.urlopen('https://api-3t.paypal.com/
nvp', urllib.urlencode(values)).read())



# controller

import random, string

def paypal():
session.recipient_id = ''
item = request.args(0)
invoice = ''.join(random.choice(string.ascii_uppercase +
string.digits) for x in range(9)) + item.upper()

purchase = db.purchase.insert(
owner=auth.user.id,
status = 'pending',
item = item,
amount = TEMPLATE_PRICE,
invoice = invoice)
paypal = local_import('paypal', reload=True)
row = db(db.purchase.id==purchase).select().first()
res = paypal.setec(paypal_config, row)
if res['ACK'][0]=='Success':
session.recipient_id = auth.user.email
token = res['TOKEN'][0]
print 'token:', token
url = 'https://www.sandbox.paypal.com/cgi-bin/webscr%3Fcmd
%3D_express-checkout%26useraction%3Dcommit%26token%3D%27'
redirect('%s%s' % (url, token))
return locals()
else:
session.flash = 'Error: Purchase failure'
return locals()


def paypal_return():
token = request.vars.token
recipient_id

[web2py] Re: How do I modify the form on default/user/profile ?

2011-05-28 Thread annet
Hi Luis,

I am not sure I understand your question correctly, but as far as I
know default/user/profile is based on the auth_user table, to which
you can add any field you want e.g.


# Custom Auth table definition
db.define_table(auth.settings.table_user_name,
Field('username', length=20, unique=True),
Field('first_name', length=128, default='', comment='required'),
Field('last_name', length=128, default='', comment='required'),
Field('email', length=128, default='', unique=True),
Field('hide_email', 'boolean', default=False),
Field('phone', length=64, default=''),
Field('homepage', requires=IS_EMPTY_OR(IS_URL())),
Field('facebook_access_token', writable=False, readable=False),
Field('flickr_user', label='Flickr Screenname'),
Field('flickr_id', writable=False),#, readable=False), # computed,
see below
Field('twitter_user'),
Field('bio', 'text', default=''),
Field('ref_friends' , 'list:reference
'+auth.settings.table_user_name,
writable=False, readable=False),
Field('password', 'password', length=64, readable=False,
label='Password'),
Field('registration_key', length=512, writable=False,
readable=False,
default=''),
Field('reset_password_key', length=512, writable=False,
readable=False,
default=''),
Field('registration_id', length=512, writable=False,
readable=False,
default=''),
Field('record_created', 'datetime', default=request.now,
writable=False,
readable=False),
Field('record_updated', 'datetime', default=request.now,
update=request.now, writable=False, readable=False)
)

Whether a field is editable in default/user/profile depends on
writable and readable being True or False.

In one of my apps I wanted the form to display differently, I solved
this by adding the following lines of code to the default/user
function:

form=auth()
if isinstance(form,FORM):
form[0][-1]
[1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location='%s';"%URL(r=request,c='usercms',f='index')))
if request.args(0)=='login':
form.element(_type='submit')['_value']='Login'
if request.args(0)=='profile':
response.view='default/profile.html'
return dict(form=form)


I hope this point you in the right direction.


Kind regards,

Annet.


[web2py] How do I modify the form on default/user/profile ?

2011-05-28 Thread Luis Goncalves
Hello Everyone!

How do I modify default/user/profile to use my own form (where the profile 
contains more information)? 

I think it should be easy, but I haven't found any info or an example yet. 

Thanks in advance!!!

Luis.


[web2py] Do I have to re-invent the wheel to display and manage messages between users on a website?

2011-05-28 Thread Luis Goncalves
Hello!

I'm building an application where logged-in users can send messages to
each other (the message gets sent to the recipient's normal email, and
they use a link to come back to the site and reply).

I want a page (ie, controller, view, (and model)) that allows the user
to see the messages sent and received, and manage them (delete, reply,
etc).  Basically this part of the website is like an email system,
except that you don't ever know the other person's email, and can only
contact them through the site.

I was hoping that something like that already exists (a web2py
messaging "slice", perhaps?).  I'm sure I can implement it, but it
would be clever to use something that already exists (and is likely to
be a more thorough and featured implementation) rather than hacking it
up from scratch.

I have been searching, but haven't found anything.

Does anyone know of anything available that I can use?

Thanks!!!

Luis.


Re: [web2py] Web2conf status & admin request

2011-05-28 Thread Jason Brower
No misunderstanding on my part.  I think it is great you are doing this 
and I hope to see some great results. Perhaps in a year you may even 
switch to mine. :D

---
BR,
Jason

On 05/29/2011 12:14 AM, Mariano Reingart wrote:

Jason:

I did want to announce the project status, maybe it is useful to other
people and we can join forces, or not, maybe it is wise to move on
conf2py.

But please don't misunderstand me, I don't want to blame anyone, I
think this project was and is important to web2py, so it is not good
to let it die, I just want to open the discussion.

I think they are two different approaches:

web2conf: simpler, easy registration (no password, no payment support,
may be provided by external apps), no formal review process (although
I would like implement attendee talk rating, prior and post
conference, to help select talks and good speakers), automatic
schedule generation (timetable), pdf badges and certificates.

conf2py: more advanced, with focus to more traditional academic
conferences (Conference Fee Payment, Configurable billing policy,
Configurable coupon discounts and coupon cancellation, Users can
register other users and pay for them, Paper submission and review
management with roles: author, editor, review, Paper publishing with
bibtex support)


BTW,  You can see the merging issue for further information:
http://code.google.com/p/web2conf/issues/detail?id=4

Regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



On Sat, May 28, 2011 at 5:30 PM, Jason Brower  wrote:

I think that is something to bring up in a personal email.  At least I would
think so.
Anyway, I am excited to see where this project can go as well, as I am
creating my own conferencing tool in web2py. InterestID.
---
Best Regards,
Jason Brower
On 05/28/2011 10:44 PM, Mariano Reingart wrote:

Yarko/Massimo and web2py community:

This year, web2py will host the (inter)-national Python conference
here in Argentina, using web2conf:

http://ar.pycon.org/2011

Indeed, it is replacing pycon-tech, the django app, that not only was
old, complex and unmaintainable, but also died suddenly (no more
render request, eating 100% CPU, in two different machines and setups,
we don't know why...), so I'm preparing a migration tool to get
attendee and talks information imported into web2py app.

Also web2conf is running for the second year the Free Software
Regional Conferences (where Massimo attended last year):

http://www.jornadasregionales.org/jrsl2011
http://www.jornadasregionales.org/jrsl2010v2

it helped for the first Ubuntu Conference here in my country:

http://www.ubucon.org.ar/2010

and is serving 4 Python Days (one currently open, other to come):

http://www.pyday.com.ar/rafaela2010
http://www.pyday.com.ar/buenosaires2010
http://www.pyday.com.ar/cordoba2011
http://www.pyday.com.ar/catan2011

I'm hosting the code in my clone of web2conf, as I doesn't have access
to the main repository:

http://code.google.com/r/reingart-web2conf/

That is not enough, we cannot upload documentation nor downloadable
files and we cannot use issue tracking system.

I know that PyCon US decided not to use web2conf, and Massimo started
a fork (conf2py) with other goals, but I think web2conf has proven to
be a suitable for at least our conferences style, and, as you can see,
it is not inactive as states the project page.

So please, if you agree, could you give me admin access to main project
site:

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

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com






[web2py] Vote for One_Clic-Install of Web2py on Dreamhost...

2011-05-28 Thread Jason Brower

If your using dreamhost then you should vote here!

https://panel.dreamhost.com/index.cgi?tree=home.sugg&category=_all&search=One%20click%20install%20We

BR,
Jason Brower


Re: [web2py] What is documentation top priotity?

2011-05-28 Thread Bruno Rocha
Things that I was testing and I can remember is:

0. Test example codes in the book to unsure it keep working with newest
version.
1. new DAL and the newest features added.
2. new router.
3. new custom importer.
4. new thread locals current object.
5. security changes in generic views.
6. auth.extra_fields
7. auth is now a CAS service
8. Multi tentant feature on DAL
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Sun, May 29, 2011 at 12:38 AM, Vinicius Assef wrote:

> Hey guys,
> I had volunteered to help in documentation.
>
> In your oppinion, what would be the top priority to work on?
>
> --
> Vinicius Assef.
>


[web2py] Re: Google app engine

2011-05-28 Thread Plumo
I use 2.6 and it still works.

Occasionally I get that error, but works again later. Must be a temporary 
problem with upload service.


[web2py] What is documentation top priotity?

2011-05-28 Thread Vinicius Assef
Hey guys,
I had volunteered to help in documentation.

In your oppinion, what would be the top priority to work on?

--
Vinicius Assef.


[web2py] GAE and MySQL

2011-05-28 Thread Ialejandro
Hi every one!!!

I was wondering if is possible to deploy an app using GAE but taking
data from a MySQL server, for example

I have a free account at 000webhost with MySQL DB and I'd like to use
GAE just as a hosting service and connect to my 000webhost DB.

Is it possible??? if not, any suggestion for a free hosting to fully
use web2py???

Thank's!!!


Re: [web2py] Username field is editable on profile

2011-05-28 Thread Bruno Rocha
def user():
if request.args(0)=='profile':
db.auth_user.username.readable = db.auth_user.username.writable =
False

return dict(form=auth())


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



On Sat, May 28, 2011 at 11:28 PM, Bruno Rocha  wrote:

> You have to do that in the controller, not in view.
>
> {{=form}} is already builded in the controller, so if you define 'readable'
> in view it will not effect the already created object.
>
> Go to controllers/deafult.py and in 'def user()' include the piece of code.
> --
> Bruno Rocha
> [ About me: http://zerp.ly/rochacbruno ]
>
>
>
> On Sat, May 28, 2011 at 11:12 PM, Tito Garrido wrote:
>
>> I've tried:
>>
>> {{extend 'layout.html'}}
>> 
>> {{=T( request.args(0).replace('_',' ').capitalize() )}}
>> 
>> {{if request.args(0)=='profile':}}
>> {{db.auth_user.username.readable = False}}
>> {{db.auth_user.username.writable = False}}
>> {{pass}}
>> {{=form}}
>>
>> Didn't work... what am I doing wrong here?
>>
>>
>> On Sat, May 28, 2011 at 11:09 PM, Tito Garrido wrote:
>>
>>> Good point!
>>>
>>> Thanks!
>>>
>>>
>>>
>>>
>>> On Sat, May 28, 2011 at 9:46 PM, pbreit  wrote:
>>>
 You can set it in the controller. Something like if
 request.args(0)=='profile': in the user() function
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Linux User #387870
>>> .
>>>  _/_õ|__|
>>> ..º[ .-.___.-._| . . . .
>>> .__( o)__( o).:___
>>>
>>
>>
>>
>> --
>>
>> Linux User #387870
>> .
>>  _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:___
>>
>
>


Re: [web2py] Username field is editable on profile

2011-05-28 Thread Bruno Rocha
You have to do that in the controller, not in view.

{{=form}} is already builded in the controller, so if you define 'readable'
in view it will not effect the already created object.

Go to controllers/deafult.py and in 'def user()' include the piece of code.
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Sat, May 28, 2011 at 11:12 PM, Tito Garrido wrote:

> I've tried:
>
> {{extend 'layout.html'}}
> 
> {{=T( request.args(0).replace('_',' ').capitalize() )}}
> 
> {{if request.args(0)=='profile':}}
> {{db.auth_user.username.readable = False}}
> {{db.auth_user.username.writable = False}}
> {{pass}}
> {{=form}}
>
> Didn't work... what am I doing wrong here?
>
>
> On Sat, May 28, 2011 at 11:09 PM, Tito Garrido wrote:
>
>> Good point!
>>
>> Thanks!
>>
>>
>>
>>
>> On Sat, May 28, 2011 at 9:46 PM, pbreit  wrote:
>>
>>> You can set it in the controller. Something like if
>>> request.args(0)=='profile': in the user() function
>>
>>
>>
>>
>> --
>>
>> Linux User #387870
>> .
>>  _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:___
>>
>
>
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>


Re: [web2py] Username field is editable on profile

2011-05-28 Thread Tito Garrido
I've tried:

{{extend 'layout.html'}}

{{=T( request.args(0).replace('_',' ').capitalize() )}}

{{if request.args(0)=='profile':}}
{{db.auth_user.username.readable = False}}
{{db.auth_user.username.writable = False}}
{{pass}}
{{=form}}

Didn't work... what am I doing wrong here?

On Sat, May 28, 2011 at 11:09 PM, Tito Garrido wrote:

> Good point!
>
> Thanks!
>
>
>
>
> On Sat, May 28, 2011 at 9:46 PM, pbreit  wrote:
>
>> You can set it in the controller. Something like if
>> request.args(0)=='profile': in the user() function
>
>
>
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>



-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] Username field is editable on profile

2011-05-28 Thread Tito Garrido
Good point!

Thanks!



On Sat, May 28, 2011 at 9:46 PM, pbreit  wrote:

> You can set it in the controller. Something like if
> request.args(0)=='profile': in the user() function




-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] Re: append auth.signature to db._common_fields

2011-05-28 Thread villas
Seems OK now.  Thanks!

On May 28, 5:41 pm, Massimo Di Pierro 
wrote:
> check now, please
>
> On May 28, 11:35 am, Massimo Di Pierro 
> wrote:
>
> > It is a bug. should work. I will fix it later today
>
> > On May 28, 11:25 am, villas  wrote:
>
> > > Hi Massimo
>
> > > I tried that.  I have this in db.py:
>
> > > db._common_fields=[Field('request_tenant',default=request.env.http_host,wri
> > >  table=False,readable=False),auth.signature]
>
> > > db.define_table('test',Field('testname'))
>
> > > Traceback:
> > >   File "C:/Users/David/Documents/web2py/applications/multitenant/
> > > models/db.py", line 95, in 
> > >     db.define_table('test',Field('testname'))
> > >   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4195, in
> > > define_table
> > >     common_field_names = [f.name for f in self._common_fields]
> > >   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4620, in
> > > __getattr__
> > >     return self[key]
> > >   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4564, in
> > > __getitem__
> > >     return dict.__getitem__(self, str(key))
> > > KeyError: 'name'
>
>


Re: [web2py] Re: LOAD ajax=False bug

2011-05-28 Thread pbreit
Ok, thanks. Does it end up that many/most functions are programmed to handle 
either a string or tuple?


Re: [web2py] Username field is editable on profile

2011-05-28 Thread pbreit
You can set it in the controller. Something like if request.args(0)=='profile': 
in the user() function


[web2py] Re: Web2conf status & admin request

2011-05-28 Thread pbreit
If the project owner doesn't want to turn over ownership I suspect you'll need 
to continue on with the fork. Perhaps he'd at least include a link to your fork 
on the home page.


Re: [web2py] Username field is editable on profile

2011-05-28 Thread Tito Garrido
Ok, but if I set it as readable and writable false it will disappear during
the registration ;)

On Sat, May 28, 2011 at 6:27 PM, contatogilson...@gmail.com <
contatogilson...@gmail.com> wrote:

> Yes, it is more a field to be edited. What you can do is hide this field in
> the actionprofile like this:
>
> db.auth_user.username.readable = \
>
> db.auth_user.username.writable = False
>
>
>
> _
> *Gilson Filho*
> *Web Developer
> http://gilsondev.com*
>
>
>
> 2011/5/28 Tito Garrido 
>
>> Folks,
>>
>> I've enabled the username field and it's editable editing the profile...
>> is it expected?
>>
>> Regards,
>>
>> Tito
>>
>> --
>>
>> Linux User #387870
>> .
>>  _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:___
>>
>
>


-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] Re: LOAD ajax=False bug

2011-05-28 Thread Bruno Rocha
On Sat, May 28, 2011 at 9:13 PM, pbreit  wrote:

> In python do you have to include the comma in a one item tuple?


Yes, one item tuple needs extra comma.

>>> t = (1)
>>> type(t)


>>> t= (1,)
>>>type(t)



[web2py] Re: LOAD ajax=False bug

2011-05-28 Thread pbreit
In python do you have to include the comma in a one item tuple?


[web2py] Re: Paypal on Appengine

2011-05-28 Thread pbreit
Express Checkout doesn't need the crypto stuff.

And the crypto stuff is actually optional on PayPal "_cart" and "_xclick". Just 
make sure to review your payments visually or with IPN to make sure there was 
no tampering.


[web2py] Re: Highest ID and UPDATE table with variable

2011-05-28 Thread Massimo Di Pierro
My mistake:

max_id = db(db.table).select(db.table.id.max()).first()
[db.table.id.max()]
and
db(db.table.id==max_id).update(field='avariable')

On May 28, 10:23 am, Massimo Di Pierro 
wrote:
> max_id = db(db.table).select(db.table.id.max())
> and
> db(db.table.id==max_id).update(field='avariable')
>
> or
>
> db(db.table.id.belongs(db(db.table)._select(db.table.id.max())).update(fiel 
> d='avariable')
>
> but you should not count on id being sequential. That is not true on
> GAE and it is not true for other NoSQL which we partially support. You
> should use a datetime timestemp.
>
> On May 28, 3:22 am, Blackpainter  wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > im pretty new to web2py and encountered a little problem.
> > i need to find the highest ID in my table ( which through other
> > threads i
> > already accomplished) and update another field in this entry with an
> > variable.
> > (db.table.insert(field=db.table.field.store(request.body,'picture.jpg'))
>
> > i started with:
> > db.executesql(""" UPDATE table SET field='*variable*' WHERE id=(SELECT
> > MAX(id) FROM table)""")
>
> > but kinda reached a dead end as its probably not possible to include
> > my
> > variable in the executesql command.
> > The Variable comes from a flash application, which takes a webcam foto
> > and
> > accesses a function in web2py.
> > plz, help, cant help myself :/
>
> > Your newbie,
> > Blackpainter


[web2py] Re: Paypal on Appengine

2011-05-28 Thread kawate
I posted the issue at paypal:

https://www.x.com/thread/52494?tstart=0

On 5月29日, 午前7:02, howesc  wrote:
> i tried to get my implementation (slice 106) to work on app engine, but
> could not find a way to properly sign the requests using the pycrypto
> library that GAE provides.  you get a gold star if you figure it out cause
> i'd like to use it! :)
>
> cfh


[web2py] Re: TypeError: 'module' object is not callable on globals()

2011-05-28 Thread Massimo Di Pierro
This is fixed in trunk.
You cannot do

from gluon import *

in version before 1.95.1


On May 28, 3:44 pm, dlypka  wrote:
> I am trying to use crud but I get
>
> TypeError: 'module' object is not callable
> when I reference
>    globals() in
>
>   crud = Crud(globals(), mydb)
>
> At the top of my source file I have
>
> from gluon import *
> from gluon.globals import *
> from gluon.tools import Crud
>
> My web2py is Version 1.93.2 (2011-03-04 23:48:59)
>
> Any ideas?


[web2py] Re: gae list type field

2011-05-28 Thread Massimo Di Pierro
Docs are wrong but we can make this work.

I just made a change to trunk to fix that particular error. Please try
again, there may be other errors related to this.

On May 28, 3:30 pm, Rip Ryness  wrote:
> This syntax:
> Field('list_tags',type=gae.StringListProperty(),widget=str_list.widget),
>
> Caused this error:
>
> File "\src\gluon\sqlhtml.py", line 1164, in accepts
>     elif field.type.startswith('list:'):
> AttributeError: 'StringListProperty' object has no attribute 'startswith'
>
> This works though:
> Field('list_tags', 'list:string',widget=str_list.widget),
>
> Docs claim both should work.
>
> -Rip


[web2py] Re: LOAD: ajax_trap errors...

2011-05-28 Thread Massimo Di Pierro
If you are not using trunk, can you try trunk?

On May 28, 3:25 pm, "Sebastian E. Ovide" 
wrote:
> Hi All,
>
> I'm trying to use the ajax_trap funcs. but I'm getting JS errors and
> therefore the traps are not working meither for the forms nor for the links:
>
> In firebug I'm getting this error:
> syntax error
> [Break On This Error]
> web2py_trap_form('('/soso/default/hello.load',)','c926878903071');
>
> To reproduce it from scratch you can go to default/test
>
> test.html
> {{extend 'layout.html'}}
> {{=LOAD(f="hello.load",ajax_trap=True)}}
>
> in default.py
> def hello():
>     return dict()
>
> def test():
>     return dict()
>
> Am I missing something ?
>
> thanks
>
> --
> Sebastian E. Ovide


[web2py] Re: LOAD ajax=False bug

2011-05-28 Thread Massimo Di Pierro
Anyway, I think this is now fixed in trunk. Please check it and let me
know.

On May 28, 2:45 pm, "Sebastian E. Ovide" 
wrote:
> On Sat, May 28, 2011 at 6:36 PM, Massimo Di Pierro <
>
> massimo.dipie...@gmail.com> wrote:
> > Please try:
>
> > {{=LOAD("default","hello.load",args=("World",))}}
> > {{=LOAD("default","hello.load",args=(123,))}}
>
> > Notice the extra comma. Anyway, your original code should also work. I
> > will take a look.
>
> yes, with the extra comma it works fine ;)
>
> --
> Sebastian E. Ovide


[web2py] Re: Highest ID and UPDATE table with variable

2011-05-28 Thread Blackpainter
hey,
thanks für ur fast reply (:

Still cant make it work though..
I guess for the first version i need to convert rows to int somehow,
as the MAX_id function does not
return a single integer :/. Always get this error:

TypeError: int() argument must be a string or a number, not 'Rows'


After failing dramatically trying to convert it myself, i trief the
second version.
Unluckily with some other errors i cant quite figure out :/

AttributeError: 'Query' object has no attribute 'update'

ok, thought there might be some braces wrong, but it still gave me
similar errors
only that 'Query' was replaced by 'Expression' or other stuff :/.
Sry for being such a pain, im really not good at this.


On 28 Mai, 17:23, Massimo Di Pierro 
wrote:
> max_id = db(db.table).select(db.table.id.max())
> and
> db(db.table.id==max_id).update(field='avariable')
>
> or
>
> db(db.table.id.belongs(db(db.table)._select(db.table.id.max())).update(field='avariable')
>
> but you should not count on id being sequential. That is not true on
> GAE and it is not true for other NoSQL which we partially support. You
> should use a datetime timestemp.
>
> On May 28, 3:22 am, Blackpainter  wrote:
>
> > Hi all,
>
> > im pretty new to web2py and encountered a little problem.
> > i need to find the highest ID in my table ( which through other
> > threads i
> > already accomplished) and update another field in this entry with an
> > variable.
> > (db.table.insert(field=db.table.field.store(request.body,'picture.jpg'))
>
> > i started with:
> > db.executesql(""" UPDATE table SET field='*variable*' WHERE id=(SELECT
> > MAX(id) FROM table)""")
>
> > but kinda reached a dead end as its probably not possible to include
> > my
> > variable in the executesql command.
> > The Variable comes from a flash application, which takes a webcam foto
> > and
> > accesses a function in web2py.
> > plz, help, cant help myself :/
>
> > Your newbie,
> > Blackpainter
>
>


[web2py] Re: Web2conf status & admin request

2011-05-28 Thread Mariano Reingart
Yarko: thanks for your answer, I'll reply bellow:

On Sat, May 28, 2011 at 5:44 PM, Yarko Tymciurak  wrote:
> Mariano -
> Here are my thoughts about this:
>
> You have changed the code fairly significantly, as I recall;

Yes and no, the code evolved, some old stuff was removed, some
remains, even the layout and configuration are the same.
I've just clean up the code, divided db.py in several files, renamed
some tables, etc.
Also I've updated some ancient code (t2, pdf generation with
reportlab), to newer plugins or libraries supported by web2py.

You can see each change starting from googlecode clone, so in my
opinion is the same code base:
http://code.google.com/r/reingart-web2conf/source/list

> I think - to keep from confusion between the original launchpad-web2conf,
> and it's pointers to google code's web2conf:
>
> You should create a new repository on google code (and set all licensing,
> etc. appropriately)
> Massimo has done the same with his updates / re-factored conference tool
> (conf2py)
> This will keep confusion (about the evolution) to a minimum
>
> If you have no better ideas on naming your new repository, you might
> consider one of these:
>
> web2conf2    (the second version, second person driving)
> nweb2conf   (from old unix naming schemes:   nSomething ==  New Something)

I would prefer not to create a new project, I think it would cause
more confusion, ending with at least 3 projects for conference
software with web2py., with a project inactive? what for?

This is not the same case as Massimos' conf2py, my clone is not a full
rewrite, it has the same codebase as stated earlier.

Projects don't create new projects for each version, as the wording
suggests, it is not logical, I don't think that is a good signal for
our community.
I think it is better to manage branches in the repository, managing
old and new code in the same place.
Although it is true that web2py advances quickly, showing
understanding, stability and commitment to long term projects is a
good sign.

IMHO

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


[web2py] Re: Paypal on Appengine

2011-05-28 Thread howesc
i tried to get my implementation (slice 106) to work on app engine, but 
could not find a way to properly sign the requests using the pycrypto 
library that GAE provides.  you get a gold star if you figure it out cause 
i'd like to use it! :)

cfh


Re: [web2py] Username field is editable on profile

2011-05-28 Thread contatogilson...@gmail.com
Yes, it is more a field to be edited. What you can do is hide this field in
the actionprofile like this:

db.auth_user.username.readable = \

db.auth_user.username.writable = False



_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/5/28 Tito Garrido 

> Folks,
>
> I've enabled the username field and it's editable editing the profile... is
> it expected?
>
> Regards,
>
> Tito
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>


[web2py] Username field is editable on profile

2011-05-28 Thread pbreit
I would think it would be editable. If you don't wan to let users change it, 
you could set readable = writable = False.


[web2py] Paypal on Appengine

2011-05-28 Thread pbreit
I posted some code here on the forums. For gae, the main thing is to replace 
the urllib calls with gae's fetch function.


Re: [web2py] Web2conf status & admin request

2011-05-28 Thread Mariano Reingart
Jason:

I did want to announce the project status, maybe it is useful to other
people and we can join forces, or not, maybe it is wise to move on
conf2py.

But please don't misunderstand me, I don't want to blame anyone, I
think this project was and is important to web2py, so it is not good
to let it die, I just want to open the discussion.

I think they are two different approaches:

web2conf: simpler, easy registration (no password, no payment support,
may be provided by external apps), no formal review process (although
I would like implement attendee talk rating, prior and post
conference, to help select talks and good speakers), automatic
schedule generation (timetable), pdf badges and certificates.

conf2py: more advanced, with focus to more traditional academic
conferences (Conference Fee Payment, Configurable billing policy,
Configurable coupon discounts and coupon cancellation, Users can
register other users and pay for them, Paper submission and review
management with roles: author, editor, review, Paper publishing with
bibtex support)


BTW,  You can see the merging issue for further information:
http://code.google.com/p/web2conf/issues/detail?id=4

Regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



On Sat, May 28, 2011 at 5:30 PM, Jason Brower  wrote:
> I think that is something to bring up in a personal email.  At least I would
> think so.
> Anyway, I am excited to see where this project can go as well, as I am
> creating my own conferencing tool in web2py. InterestID.
> ---
> Best Regards,
> Jason Brower
> On 05/28/2011 10:44 PM, Mariano Reingart wrote:
>>
>> Yarko/Massimo and web2py community:
>>
>> This year, web2py will host the (inter)-national Python conference
>> here in Argentina, using web2conf:
>>
>> http://ar.pycon.org/2011
>>
>> Indeed, it is replacing pycon-tech, the django app, that not only was
>> old, complex and unmaintainable, but also died suddenly (no more
>> render request, eating 100% CPU, in two different machines and setups,
>> we don't know why...), so I'm preparing a migration tool to get
>> attendee and talks information imported into web2py app.
>>
>> Also web2conf is running for the second year the Free Software
>> Regional Conferences (where Massimo attended last year):
>>
>> http://www.jornadasregionales.org/jrsl2011
>> http://www.jornadasregionales.org/jrsl2010v2
>>
>> it helped for the first Ubuntu Conference here in my country:
>>
>> http://www.ubucon.org.ar/2010
>>
>> and is serving 4 Python Days (one currently open, other to come):
>>
>> http://www.pyday.com.ar/rafaela2010
>> http://www.pyday.com.ar/buenosaires2010
>> http://www.pyday.com.ar/cordoba2011
>> http://www.pyday.com.ar/catan2011
>>
>> I'm hosting the code in my clone of web2conf, as I doesn't have access
>> to the main repository:
>>
>> http://code.google.com/r/reingart-web2conf/
>>
>> That is not enough, we cannot upload documentation nor downloadable
>> files and we cannot use issue tracking system.
>>
>> I know that PyCon US decided not to use web2conf, and Massimo started
>> a fork (conf2py) with other goals, but I think web2conf has proven to
>> be a suitable for at least our conferences style, and, as you can see,
>> it is not inactive as states the project page.
>>
>> So please, if you agree, could you give me admin access to main project
>> site:
>>
>> http://code.google.com/p/web2conf/
>>
>> Best regards,
>>
>> Mariano Reingart
>> http://www.sistemasagiles.com.ar
>> http://reingart.blogspot.com
>
>


[web2py] TypeError: 'module' object is not callable on globals()

2011-05-28 Thread dlypka
I am trying to use crud but I get

TypeError: 'module' object is not callable
when I reference
   globals() in

  crud = Crud(globals(), mydb)


At the top of my source file I have

from gluon import *
from gluon.globals import *
from gluon.tools import Crud


My web2py is Version 1.93.2 (2011-03-04 23:48:59)


Any ideas?



Re: [web2py] Web2conf status & admin request

2011-05-28 Thread Jason Brower
I think that is something to bring up in a personal email.  At least I 
would think so.
Anyway, I am excited to see where this project can go as well, as I am 
creating my own conferencing tool in web2py. InterestID.

---
Best Regards,
Jason Brower
On 05/28/2011 10:44 PM, Mariano Reingart wrote:

Yarko/Massimo and web2py community:

This year, web2py will host the (inter)-national Python conference
here in Argentina, using web2conf:

http://ar.pycon.org/2011

Indeed, it is replacing pycon-tech, the django app, that not only was
old, complex and unmaintainable, but also died suddenly (no more
render request, eating 100% CPU, in two different machines and setups,
we don't know why...), so I'm preparing a migration tool to get
attendee and talks information imported into web2py app.

Also web2conf is running for the second year the Free Software
Regional Conferences (where Massimo attended last year):

http://www.jornadasregionales.org/jrsl2011
http://www.jornadasregionales.org/jrsl2010v2

it helped for the first Ubuntu Conference here in my country:

http://www.ubucon.org.ar/2010

and is serving 4 Python Days (one currently open, other to come):

http://www.pyday.com.ar/rafaela2010
http://www.pyday.com.ar/buenosaires2010
http://www.pyday.com.ar/cordoba2011
http://www.pyday.com.ar/catan2011

I'm hosting the code in my clone of web2conf, as I doesn't have access
to the main repository:

http://code.google.com/r/reingart-web2conf/

That is not enough, we cannot upload documentation nor downloadable
files and we cannot use issue tracking system.

I know that PyCon US decided not to use web2conf, and Massimo started
a fork (conf2py) with other goals, but I think web2conf has proven to
be a suitable for at least our conferences style, and, as you can see,
it is not inactive as states the project page.

So please, if you agree, could you give me admin access to main project site:

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

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com




[web2py] gae list type field

2011-05-28 Thread Rip Ryness
This syntax:
Field('list_tags',type=gae.StringListProperty(),widget=str_list.widget),

Caused this error:

File "\src\gluon\sqlhtml.py", line 1164, in accepts
elif field.type.startswith('list:'):
AttributeError: 'StringListProperty' object has no attribute 'startswith'


This works though:
Field('list_tags', 'list:string',widget=str_list.widget),

Docs claim both should work.

-Rip


[web2py] LOAD: ajax_trap errors...

2011-05-28 Thread Sebastian E. Ovide
Hi All,

I'm trying to use the ajax_trap funcs. but I'm getting JS errors and
therefore the traps are not working meither for the forms nor for the links:

In firebug I'm getting this error:
syntax error
[Break On This Error]
web2py_trap_form('('/soso/default/hello.load',)','c926878903071');

To reproduce it from scratch you can go to default/test

test.html
{{extend 'layout.html'}}
{{=LOAD(f="hello.load",ajax_trap=True)}}

in default.py
def hello():
return dict()

def test():
return dict()


Am I missing something ?

thanks

-- 
Sebastian E. Ovide


Re: [web2py] Re: LOAD ajax=False bug

2011-05-28 Thread Sebastian E. Ovide
On Sat, May 28, 2011 at 6:36 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Please try:
>
> {{=LOAD("default","hello.load",args=("World",))}}
> {{=LOAD("default","hello.load",args=(123,))}}
>
> Notice the extra comma. Anyway, your original code should also work. I
> will take a look.
>
>
>
>
yes, with the extra comma it works fine ;)


-- 
Sebastian E. Ovide


[web2py] Web2conf status & admin request

2011-05-28 Thread Mariano Reingart
Yarko/Massimo and web2py community:

This year, web2py will host the (inter)-national Python conference
here in Argentina, using web2conf:

http://ar.pycon.org/2011

Indeed, it is replacing pycon-tech, the django app, that not only was
old, complex and unmaintainable, but also died suddenly (no more
render request, eating 100% CPU, in two different machines and setups,
we don't know why...), so I'm preparing a migration tool to get
attendee and talks information imported into web2py app.

Also web2conf is running for the second year the Free Software
Regional Conferences (where Massimo attended last year):

http://www.jornadasregionales.org/jrsl2011
http://www.jornadasregionales.org/jrsl2010v2

it helped for the first Ubuntu Conference here in my country:

http://www.ubucon.org.ar/2010

and is serving 4 Python Days (one currently open, other to come):

http://www.pyday.com.ar/rafaela2010
http://www.pyday.com.ar/buenosaires2010
http://www.pyday.com.ar/cordoba2011
http://www.pyday.com.ar/catan2011

I'm hosting the code in my clone of web2conf, as I doesn't have access
to the main repository:

http://code.google.com/r/reingart-web2conf/

That is not enough, we cannot upload documentation nor downloadable
files and we cannot use issue tracking system.

I know that PyCon US decided not to use web2conf, and Massimo started
a fork (conf2py) with other goals, but I think web2conf has proven to
be a suitable for at least our conferences style, and, as you can see,
it is not inactive as states the project page.

So please, if you agree, could you give me admin access to main project site:

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

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


[web2py] Username field is editable on profile

2011-05-28 Thread Tito Garrido
Folks,

I've enabled the username field and it's editable editing the profile... is
it expected?

Regards,

Tito

-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] Re: LOAD ajax=False bug

2011-05-28 Thread Massimo Di Pierro
Please try:

{{=LOAD("default","hello.load",args=("World",))}}
{{=LOAD("default","hello.load",args=(123,))}}

Notice the extra comma. Anyway, your original code should also work. I
will take a look.



On May 28, 12:04 pm, "Sebastian E. Ovide" 
wrote:
> Hi All,
>
> I have a simple controller:
>
> def hello():
>     return dict(test="Hello %s" %(request.args(0)))
>
> in my view
>
> {{=LOAD("default","hello.load",args=("World"),ajax=True)}}
> {{=LOAD("default","hello.load",args=(123),ajax=True)}}
>
> both works displaying "Hello World" "Hello 123"
>
> Nevertheless:
>
> {{=LOAD("default","hello.load",args=("World"))}} displays only "Hello W"
> {{=LOAD("default","hello.load",args=(123))}} displays Internal error
>
> any ideas ? (last stable 1.95.1)
>
> --
> Sebastian E. Ovide


[web2py] Paypal on Appengine

2011-05-28 Thread Arbie Samong
Hello,

Would just like to know if anybody has successfully implement a simple
Paypal express checkout procedure under the AppEngine environment? I
searched around and I found no instances where anyone has implemented
this. So far all I've found were:

http://web2pyslices.com/main/slices/take_slice/9
http://web2pyslices.com/main/slices/take_slice/106

and neither is reputed to work on GAE.

Thanks,
Arbie



[web2py] LOAD ajax=False bug

2011-05-28 Thread Sebastian E. Ovide
Hi All,

I have a simple controller:

def hello():
return dict(test="Hello %s" %(request.args(0)))

in my view

{{=LOAD("default","hello.load",args=("World"),ajax=True)}}
{{=LOAD("default","hello.load",args=(123),ajax=True)}}

both works displaying "Hello World" "Hello 123"

Nevertheless:

{{=LOAD("default","hello.load",args=("World"))}} displays only "Hello W"
{{=LOAD("default","hello.load",args=(123))}} displays Internal error

any ideas ? (last stable 1.95.1)

-- 
Sebastian E. Ovide


Re: [web2py] Using the IS_EMAIL on a string not in a form...

2011-05-28 Thread Jonathan Lundell
On May 28, 2011, at 9:34 AM, Jason Brower wrote:
> 
> Is there a way to use the IS_EMAIL feature in web2py on string?  If not, what 
> would be the best way to make sure each string I sent it is an email?

IS_EMAIL()('a...@b.com') returns the tuple  ('a...@b.com', None), where the 
second member of the returned tuple is None if the test passed, and an error 
message otherwise. You can add arguments to IS_EMAIL() as usual.

See the doctests in gluon.validators for a lot of examples.



[web2py] Re: append auth.signature to db._common_fields

2011-05-28 Thread Massimo Di Pierro
check now, please

On May 28, 11:35 am, Massimo Di Pierro 
wrote:
> It is a bug. should work. I will fix it later today
>
> On May 28, 11:25 am, villas  wrote:
>
>
>
>
>
>
>
> > Hi Massimo
>
> > I tried that.  I have this in db.py:
>
> > db._common_fields=[Field('request_tenant',default=request.env.http_host,wri 
> > table=False,readable=False),auth.signature]
>
> > db.define_table('test',Field('testname'))
>
> > Traceback:
> >   File "C:/Users/David/Documents/web2py/applications/multitenant/
> > models/db.py", line 95, in 
> >     db.define_table('test',Field('testname'))
> >   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4195, in
> > define_table
> >     common_field_names = [f.name for f in self._common_fields]
> >   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4620, in
> > __getattr__
> >     return self[key]
> >   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4564, in
> > __getitem__
> >     return dict.__getitem__(self, str(key))
> > KeyError: 'name'


[web2py] Re: append auth.signature to db._common_fields

2011-05-28 Thread Massimo Di Pierro
It is a bug. should work. I will fix it later today

On May 28, 11:25 am, villas  wrote:
> Hi Massimo
>
> I tried that.  I have this in db.py:
>
> db._common_fields=[Field('request_tenant',default=request.env.http_host,wri 
> table=False,readable=False),auth.signature]
>
> db.define_table('test',Field('testname'))
>
> Traceback:
>   File "C:/Users/David/Documents/web2py/applications/multitenant/
> models/db.py", line 95, in 
>     db.define_table('test',Field('testname'))
>   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4195, in
> define_table
>     common_field_names = [f.name for f in self._common_fields]
>   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4620, in
> __getattr__
>     return self[key]
>   File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4564, in
> __getitem__
>     return dict.__getitem__(self, str(key))
> KeyError: 'name'


[web2py] Using the IS_EMAIL on a string not in a form...

2011-05-28 Thread Jason Brower
Is there a way to use the IS_EMAIL feature in web2py on string?  If not, 
what would be the best way to make sure each string I sent it is an email?

---
Best Regards,
Jason Brower


[web2py] Re: append auth.signature to db._common_fields

2011-05-28 Thread villas
Hi Massimo

I tried that.  I have this in db.py:

db._common_fields=[Field('request_tenant',default=request.env.http_host,writable=False,readable=False),auth.signature]

db.define_table('test',Field('testname'))

Traceback:
  File "C:/Users/David/Documents/web2py/applications/multitenant/
models/db.py", line 95, in 
db.define_table('test',Field('testname'))
  File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4195, in
define_table
common_field_names = [f.name for f in self._common_fields]
  File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4620, in
__getattr__
return self[key]
  File "C:\Users\David\Documents\web2py\gluon\dal.py", line 4564, in
__getitem__
return dict.__getitem__(self, str(key))
KeyError: 'name'


[web2py] Re: append auth.signature to db._common_fields

2011-05-28 Thread Massimo Di Pierro
db._common_fields=[Field('request_tenant',default=request.env.http_host,w
ritable=False,readable=False),auth.signature]

On May 28, 10:52 am, villas  wrote:
> I have this:
>
> db._common_fields=[Field('request_tenant',default=request.env.http_host,w
> ritable=False,readable=False)]
>
> Now,  how can I append auth.signature to the above db._common_fields?


[web2py] append auth.signature to db._common_fields

2011-05-28 Thread villas
I have this:

db._common_fields=[Field('request_tenant',default=request.env.http_host,w
ritable=False,readable=False)]

Now,  how can I append auth.signature to the above db._common_fields?


[web2py] Re: django-and-sqlalchemy-on-web2py

2011-05-28 Thread Massimo Di Pierro
This code was written 2 years ago and posted on he mailing list. I
never had and do not have today any intention of including it in
web2py. I do not like the syntax of Django and SQLAlchemy which is
verbose. I just posted the code because I thought it could help users
to migrate their Django modules. In fact, combining this with the new
DAL(...,auto_import) it is possible to have web2py automatically re-
write Django and SQLAlchemy modules in web2py-ese.

I just need to post an example of how to.

On May 28, 8:05 am, JorgeRpo  wrote:
> I would not comment on the technical aspects, which I'm sure are good.
>
> I think it's a good idea to attract Django users, with *migration tools 
> *towards
> web2py.
>
> But adding those features as *permanent *for web2py could mainly forces the
> web2py dev team to redirect time, energy and effort towards maintain and
> improve this Django and Alchemy integration. Time that can be well spent
> maintaining Web2py.
>
>  Because users who use them will prompt and require more and more support on
> it.


Re: [web2py] Re: Create an email queing feature...

2011-05-28 Thread Jason (spot) Brower
After looking at the site I see what you mean.  I will keep it in mind as
the program increases in size.
BR,
Jason Brower


On Sat, May 28, 2011 at 4:55 PM, pbreit  wrote:

> It's not for speed so much as for deliverability.


[web2py] Re: request.vars is empty when variable has leading underscore

2011-05-28 Thread Massimo Di Pierro
I cannot reproduce the behavior you describe.

On May 28, 1:54 am, Geoff  wrote:
> Hello:
>
> I was following the internationalization video tutorial and stumbled
> upon an issue that has left me confused.
>
> In the tutorial, a variable called _language=en is appended to the URL
> such as,
>
> 127.0.0.1/default/index?_language=test
>
> However, when I do this, request.get_vars is empty but
> request.env.query_string: _language=test
>
> Alternatively, when I omit the leading _ in the variable name, as in
>
> 127.0.0.1/default/index?language=test
>
> I get request.get_vars : language:test (as expected) and
> request.env.query_string: language=test
>
> So, unless I am doing something wrong (entirely possible), it seems
> like using a variable with a leading underscore is messing up the
> expected behaviour of request.get_vars.  Has anyone seen something
> like this and can you shed a bit of light on what is going on?


[web2py] Re: Highest ID and UPDATE table with variable

2011-05-28 Thread Massimo Di Pierro
max_id = db(db.table).select(db.table.id.max())
and
db(db.table.id==max_id).update(field='avariable')

or

db(db.table.id.belongs(db(db.table)._select(db.table.id.max())).update(field='avariable')

but you should not count on id being sequential. That is not true on
GAE and it is not true for other NoSQL which we partially support. You
should use a datetime timestemp.

On May 28, 3:22 am, Blackpainter  wrote:
> Hi all,
>
> im pretty new to web2py and encountered a little problem.
> i need to find the highest ID in my table ( which through other
> threads i
> already accomplished) and update another field in this entry with an
> variable.
> (db.table.insert(field=db.table.field.store(request.body,'picture.jpg'))
>
> i started with:
> db.executesql(""" UPDATE table SET field='*variable*' WHERE id=(SELECT
> MAX(id) FROM table)""")
>
> but kinda reached a dead end as its probably not possible to include
> my
> variable in the executesql command.
> The Variable comes from a flash application, which takes a webcam foto
> and
> accesses a function in web2py.
> plz, help, cant help myself :/
>
> Your newbie,
> Blackpainter


[web2py] Re: Documenting a file with sphinx, that has local_import in it

2011-05-28 Thread Massimo Di Pierro
controllers and models in web2py are written in python but are not
python modules. They use objects
(request,response,...,local_import,...) that are not imported.

Sphinx does not understand this.

I am sure there is a way around (for example add to your models and
controllers:

if 1:
from gluon import *
request,response,session,cache,T = \
   current.request,current.response,
   current.session,current.cache,current.T
from gluon.compileapp import local_import_aux as local_import

) but I cannot say for sure without details about what you are trying
to do.





On May 28, 3:47 am, Vasil Petkov  wrote:
> Hello!
>
> I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
> documentation purposes, i have created a 'doc'-directory inside my
> web2py-application. My web2py project has the following structure:
>
> web2py
>    |_ server
>    |      |_ applications
>    |            |_ init
>    |            |     |_ controllers
>    |            |           |_ myapp.py
>   ...         ...
>    |            |_ modules
>    |                  |_ xml2obj.py
>   ...
>    |_ doc
>
> When i try to generate documentation for the myapp.py-file with
> sphinx, i get the following warning:
>
>  Traceback (most recent call
> last):
>   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
> sphinx/ext/autodoc.py", line 329, in import_object
>     __import__(self.modname)
>   File "/home/vpetkov/Documents/web2py/server/applications/init/
> controllers/myapp.py", line 16, in 
>     xml2obj = local_import('xml2obj', reload=False)
> NameError: name 'local_import' is not defined
>
> /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
> autodoc can't import/find module 'myapp', it reported error: "name
> 'local_import' is not defined", please check your spelling and
> sys.path
>
> Additionally. in conf.py Sphinx file, i added
> sys.path.append(os.path.abspath('../applications/init/modules/'))


Re: [web2py] Subdomain Duplicates Content

2011-05-28 Thread Jonathan Lundell
There's support for exclusive domain mapping enforcement in the trunk now. It'd 
be good if someone could try it out, because the unit tests I was able to come 
up with aren't all that close to a real-world environment.

Just set exclusive_domain=True in the BASE router (for all domains) or an app 
router (for that apps's domain). You'll get a SyntaxError exception if you call 
URL() to generate a URL for a different app unless you explicitly provide a 
host= argument to URL.

Or at least that's the intention.

BTW, WRT the issue of search engines being confused by multiple URLs pointing 
to the same pages, you might want to investigate Google's canonical-host logic. 
It may not be helpful, in that it might deal only with complete domain 
duplication (eg www.domain.com and domain.com) rather than overlapping subsets 
of domains; I'm not sure.

Re: [web2py] Re: Create an email queing feature...

2011-05-28 Thread pbreit
It's not for speed so much as for deliverability.


[web2py] Re: django-and-sqlalchemy-on-web2py

2011-05-28 Thread JorgeRpo
I would not comment on the technical aspects, which I'm sure are good.


I think it's a good idea to attract Django users, with *migration tools 
*towards 
web2py.

But adding those features as *permanent *for web2py could mainly forces the 
web2py dev team to redirect time, energy and effort towards maintain and 
improve this Django and Alchemy integration. Time that can be well spent 
maintaining Web2py.

 Because users who use them will prompt and require more and more support on 
it.




[web2py] request.vars is empty when variable has leading underscore

2011-05-28 Thread Geoff
Hello:

I was following the internationalization video tutorial and stumbled
upon an issue that has left me confused.

In the tutorial, a variable called _language=en is appended to the URL
such as,

127.0.0.1/default/index?_language=test

However, when I do this, request.get_vars is empty but
request.env.query_string: _language=test

Alternatively, when I omit the leading _ in the variable name, as in

127.0.0.1/default/index?language=test

I get request.get_vars : language:test (as expected) and
request.env.query_string: language=test

So, unless I am doing something wrong (entirely possible), it seems
like using a variable with a leading underscore is messing up the
expected behaviour of request.get_vars.  Has anyone seen something
like this and can you shed a bit of light on what is going on?





[web2py] Highest ID and UPDATE table with variable

2011-05-28 Thread Blackpainter
Hi all,

im pretty new to web2py and encountered a little problem.
i need to find the highest ID in my table ( which through other
threads i
already accomplished) and update another field in this entry with an
variable.
(db.table.insert(field=db.table.field.store(request.body,'picture.jpg'))

i started with:
db.executesql(""" UPDATE table SET field='*variable*' WHERE id=(SELECT
MAX(id) FROM table)""")

but kinda reached a dead end as its probably not possible to include
my
variable in the executesql command.
The Variable comes from a flash application, which takes a webcam foto
and
accesses a function in web2py.
plz, help, cant help myself :/

Your newbie,
Blackpainter



[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-28 Thread Vineet
At last, after much of sweat & toil, I could write a code for managing
multiple tables (conditional insert or update or delete) from single
form.
I agree, the code is in very raw form & may not be ‘pythonic’.
There are code repeatitions.
But at least I have something to go ahead & build a refined structure.
I present my code as under. (Comments are given to explain the flow)
I would highly welcome any ideas/suggestions for improvements.
##
Code starts here
##
MODELS:
db.define_table('mdlmst',
  Field('mdlmstid','id'),
  Field('mdlmstcd'),
  Field('mdlmstnm'),
  migrate=False,
  format='%(mdlmstnm)s'
  )

db.define_table('wrmst',
  Field('wrmstid','id'),
  Field('wrmstcd'),
  Field('wrmstnm'),
  migrate=False,
  format='%(wrmstnm)s'
  )

db.define_table('extwrmst',
  Field('extwrmstid','id'),
  Field('extwrmstcd'),
  Field('extwrmstnm'),
  migrate=False,
  format='%(extwrmstnm)s'
  )

# from the FORM, data will be populated in the following two tables

db.define_table('mdlwr',
  Field('mdlwrid','id'),
  Field('mdlmstid',db.mdlmst),
  Field('wrmstid',db.wrmst),
  migrate=False
  )

db.define_table('mdlextwr',
  Field('mdlextwrid','id'),
  Field('mdlmstid',db.mdlmst),
  Field('extwrmstid',db.extwrmst),
  migrate=False
  )

CONTROLLERS:
### ‘modelwar’ controller will render the records from ‘mdlmst’ table
def modelwar():
models =
db(db.mdlmst.mdlmstid>0).select(orderby=db.mdlmst.mdlmstnm)
return dict(models=models)

### after clicking a particular record, ‘war_edit’ controller will
manage the tables – ‘mdlwr’ & ‘mdlextwr’

def war_edit():
mdl_id = request.args(0)# variable identifying the
‘mdlmstid’ (which record to be modified)
mdl_nm = request.args(1)# variable for getting ‘mdlmstnm’
warset = db(db.mdlwr.mdlmstid==mdl_id)  # fetch a set
extwarset = db(db.mdlextwr.mdlmstid==mdl_id)
warlist = db(db.mdlwr.mdlmstid==mdl_id).select()# get a ROW
object
extwarlist = db(db.mdlextwr.mdlmstid==mdl_id).select()

form_war=FORM(TABLE(TR("Basic Warranty",
SELECT(_type="select",_name="baswar",*[OPTION(x.wrmstnm,_value=x.wrmstid)for
x in db().select(db.wrmst.ALL)]),
TR("Extended Warranty",
SELECT(_type="select",_name="extwar",*[OPTION(x.extwrmstnm,_value=x.extwrmstid)for
x in db().select(db.extwrmst.ALL)]),
TR("", INPUT(_type='submit',_value='Save')), 

# pre-populate the fields in‘form_war’
if len(warlist)>0:
form_war.vars.baswar = warlist[0].wrmstid

if len(extwarlist)>0:
form_war.vars.extwar = extwarlist[0].extwrmstid

# after successful form submission, manage the table 'mdlwr'
if form_war.accepts(request.vars, session):
if len(warlist)>0:  # if there was any record in the list
fetched from database & sent to FORM,
if form_war.vars.baswar=='':# delete if value returned
from FORM field is blank
warset.delete()
else:
warset.update(wrmstid=form_war.vars.baswar)  # else
update,
else:
db.mdlwr.insert(mdlmstid=mdl_id,
wrmstid=form_war.vars.baswar)   # else insert

# Similarly, manage the table 'mdlextwr'
if len(extwarlist)>0:
if form_war.vars.extwar=='':
extwarset.delete()
else:
extwarset.update(extwrmstid=form_war.vars.extwar)
else:
db.mdlextwr.insert(mdlmstid=mdl_id,
extwrmstid=form_war.vars.extwar)

response.flash = 'Warranty definition saved'
return dict(form_war=form_war,mdlnm=mdl_nm)

VIEW for 'mdlmst' table

{{response.files.append(URL(r=request,c='static',f='jquery.dataTables.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='demo_table.css'))}}
{{extend 'layout.html'}}
jQuery(document).ready(function()
{   jQuery('.smarttable').dataTable();});
Modelwise Warranty Master

  Model IDModel CodeModel Name  
{{for model in models:}}

{{=model.mdlmstid}}
{{=model.mdlmstcd}}
{{=model.mdlmstnm}}
{{=A('edit
warranty',_href=URL('war_edit',args=[model.mdlmstid,model.mdlmstnm]))}}

{{pass}}



Code ends here


A generic class is needed to be written for managing actions (insert/
update/delete) based on the results fetched from database & return
values from FORM. Hopefully, the same might be useful to many other
web2py programmers also.

I look forward to your ideas for enhancement.

Thanks,
Vineet


[web2py] Re: Documenting a file with sphinx, that has local_import in it

2011-05-28 Thread Vasil Petkov
Hello Jason!

On May 28, 11:49 am, Jason Brower  wrote:
> It's not in your version.

What do you mean with this? What is not in my version?

> But the upcoming release I think fixes this
> very issue.

And what and where is fixed?

> As far as I know.
> Best Regards,
> Jason




Re: [web2py] Documenting a file with sphinx, that has local_import in it

2011-05-28 Thread Jason Brower
It's not in your version.  But the upcoming release I think fixes this 
very issue.

As far as I know.
Best Regards,
Jason
On 05/28/2011 11:47 AM, Vasil Petkov wrote:

Hello!

I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
documentation purposes, i have created a 'doc'-directory inside my
web2py-application. My web2py project has the following structure:

web2py
|_ server
|  |_ applications
||_ init
|| |_ controllers
||   |_ myapp.py
   ... ...
||_ modules
|  |_ xml2obj.py
   ...
|_ doc

When i try to generate documentation for the myapp.py-file with
sphinx, i get the following warning:

  Traceback (most recent call
last):
   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
sphinx/ext/autodoc.py", line 329, in import_object
 __import__(self.modname)
   File "/home/vpetkov/Documents/web2py/server/applications/init/
controllers/myapp.py", line 16, in
 xml2obj = local_import('xml2obj', reload=False)
NameError: name 'local_import' is not defined

/home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
autodoc can't import/find module 'myapp', it reported error: "name
'local_import' is not defined", please check your spelling and
sys.path

Additionally. in conf.py Sphinx file, i added
sys.path.append(os.path.abspath('../applications/init/modules/'))




[web2py] Documenting a file with sphinx, that has local_import in it

2011-05-28 Thread Vasil Petkov
Hello!

I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
documentation purposes, i have created a 'doc'-directory inside my
web2py-application. My web2py project has the following structure:

web2py
   |_ server
   |  |_ applications
   ||_ init
   || |_ controllers
   ||   |_ myapp.py
  ... ...
   ||_ modules
   |  |_ xml2obj.py
  ...
   |_ doc

When i try to generate documentation for the myapp.py-file with
sphinx, i get the following warning:

 Traceback (most recent call
last):
  File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
sphinx/ext/autodoc.py", line 329, in import_object
__import__(self.modname)
  File "/home/vpetkov/Documents/web2py/server/applications/init/
controllers/myapp.py", line 16, in 
xml2obj = local_import('xml2obj', reload=False)
NameError: name 'local_import' is not defined

/home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
autodoc can't import/find module 'myapp', it reported error: "name
'local_import' is not defined", please check your spelling and
sys.path

Additionally. in conf.py Sphinx file, i added
sys.path.append(os.path.abspath('../applications/init/modules/'))


Re: [web2py] Re: Create an email queing feature...

2011-05-28 Thread Jason Brower

On 05/28/2011 12:17 AM, pbreit wrote:

I'd also suggest SendGrid (200/day free, 10 cents for 1,000).

It looks like you are now trying it as a background process. I've had 
better luck with cron. And since you only want to send every hour or 
so, you could set the cron to run hourly.
I didn't know these services existed.  I think I will try my way first 
then then try those if I need more speed.

BR,
Jason Brower