[web2py] Is there a web2py IRC channel?

2010-12-07 Thread Robert
nt


[web2py] Re: Is there a web2py IRC channel?

2010-12-07 Thread Robert
Awesome, thanks! :)

Di Pierro might want to update the IRC info on the front page (http://
www.web2py.com/), the on free node seems way more active.



On 7 dec, 15:04, Luther Goh Lu Feng  wrote:
> Yes #web2py on freenode
>
> http://webchat.freenode.net/?channels=web2py
>
> On Dec 7, 7:42 pm, Robert  wrote:
>
>
>
>
>
>
>
> > nt


[web2py] Best way to populate GAE datastore?

2010-12-07 Thread Robert
I recently deployed an web2py application on GAE.  The datastore was
empty at that point, and I couldn't add data through the Datastore
Viewer since the tables/entities were not created yet.

I now solved this by creating a form in web2py where I can manually
populate the database with the initial data my application needs. From
that point on I could use the Datastore Viewer to further edit/setup
my data.

So I am wondering what is the best way to populate the initial
database automatically? Is there a way to define that data in the
web2py db DAL definition as well? Or is there a specific GAE deploy
feature for this I am missing?

Thanks in advance!


[web2py] Re: Best way to populate GAE datastore?

2010-12-07 Thread Robert
Elegant, exactly what I was looking for!

Thanks!

On 7 dec, 20:13, Bruno Rocha  wrote:
> I do in model:
>
> usually "99_fixtures.py"
> 
>
> my_dict_with_values = dict(field='value',anotherfield='anothervalue')
>
> if db(db.table).count() == 0:
>     db.table.insert(**my_dict_with_values)
>
> 
>
> 2010/12/7 Robert 
>
> > I recently deployed an web2py application on GAE.  The datastore was
> > empty at that point, and I couldn't add data through the Datastore
> > Viewer since the tables/entities were not created yet.
>
> > I now solved this by creating a form in web2py where I can manually
> > populate the database with the initial data my application needs. From
> > that point on I could use the Datastore Viewer to further edit/setup
> > my data.
>
> > So I am wondering what is the best way to populate the initial
> > database automatically? Is there a way to define that data in the
> > web2py db DAL definition as well? Or is there a specific GAE deploy
> > feature for this I am missing?
>
> > Thanks in advance!
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


Re: [web2py] web2py 1.91.5 is OUT

2010-12-28 Thread Robert
Nice! Deploying and testing it right away! :)

[web2py] Re: congratulations on making it to pycon2011 :)

2011-01-07 Thread Robert
Congratulations, I hope my vote helped! :)

I would join if it was held in Europe.




[web2py] Re: good news...

2011-01-12 Thread Robert
Nice! 2011 the year of web2py! :)

[web2py] Re: T-Shirts web2py

2011-01-28 Thread Robert

On 2011-01-27 17:03:21 -0500, mikech said:


+1
Zazzle is another alternative.  I don't know if you've ordered t-shirts 
from Cafe Express, but I did some time ago, and they seemed very 
lightweight.  Don't know if Zazzle is

any better.  
Here is a comparison: 
http://www.squidoo.com/cafepress_alternative



Oh, yeah, I would like a thicker shirt.

--
Robert

[web2py] Re: Learning materials for newbie

2011-01-29 Thread Robert

What?!? No web2py tree on the cover!!!   :-D

--
Robert



On 2011-01-28 16:46:25 -0500, Richard Vézina said:


Web2py book : http://www.web2py.com/book

Richard

On Fri, Jan 28, 2011 at 4:38 PM, noob.py 
 wrote:

Hello,
I'm totally new to programming, but very motivated to learn it. I'm
especially interested in creating web application (that's why I post
here). So, can anyone tell me what do I have to learn (except Python
and web2py of course) and point me some good learning materials and
resources (books, ebooks, web tutorials, etc.)?





[web2py] Re: web2py promoted at Google App Engine Montreal Hackathon Sat Jan 22

2011-02-03 Thread Robert
Awesome news, I am really curious to see where this is heading!

By the way, 2 weeks ago I wrote a short post on our experiences on web2py 
and GAE. So I am extra thrilled, and will evangelize it even more. I really 
hope web2py gains more traction in the Netherlands, there are so many 
talented developers here, but the majority of them are lost to PHP.

http://www.unwind.nl/nl/blog/21/unwind_enters_the_cloud_with_google_app_engine_en_web2py/


[web2py] redirect and decorators

2010-05-17 Thread Robert Boulanger
hi,

I have the following issue:

@auth.requires_membership('admin')
def foo():
form=FORM(blah some code here)
if form.accepts(request.vars, session):

#form method points to method bar below
return dict(form=form)


def bar():

redirect(URL(r=request,f=foo))
#when done, go back to foo for a new attempt

As long as foo is NOT decorated all is wonderful.
As soon as the decoration which requires this membership is present,
it results in a request like
application/controller/f   instead of /controller/application/foo
(the f is always here, it's not just the first letter of foo, means if
foo would be bar it's also /application/controller/f )

if the decoration is removed everything is fine again.

Anybody here who has a clue whats the reason for that ?

Thanks

Robert




Re: [web2py] Re: redirect and decorators

2010-05-18 Thread Robert Boulanger
Hi,

that works, thanks. 
I still don't understand the behaviour, but I will have a look deeper inside to 
find that out.

-Robert

Am 18.05.2010 um 00:13 schrieb mdipierro:


> This
> 
> redirect(URL(r=request,f=foo))
> 
> should be
> 
> redirect(URL(r=request,f='foo'))
> 
> 
> On May 17, 4:00 pm, Robert Boulanger 
> wrote:
>> hi,
>> 
>> I have the following issue:
>> 
>> @auth.requires_membership('admin')
>> def foo():
>> form=FORM(blah some code here)
>> if form.accepts(request.vars, session):
>> 
>> #form method points to method bar below
>> return dict(form=form)
>> 
>> def bar():
>> 
>> redirect(URL(r=request,f=foo))
>> #when done, go back to foo for a new attempt
>> 
>> As long as foo is NOT decorated all is wonderful.
>> As soon as the decoration which requires this membership is present,
>> it results in a request like
>> application/controller/f   instead of /controller/application/foo
>> (the f is always here, it's not just the first letter of foo, means if
>> foo would be bar it's also /application/controller/f )
>> 
>> if the decoration is removed everything is fine again.
>> 
>> Anybody here who has a clue whats the reason for that ?
>> 
>> Thanks
>> 
>> Robert



[web2py] "wizard" style forms in web2py

2010-05-29 Thread Robert O'Connor
Hey,

I need to implement a "wizard" style form. (things will exist on
different screens; each "step" or page will post to the next page and
have those values stored and used in the next step.

Now here's the problem: there's seems to be very few examples in
developing something like this in web2py... Does anybody know either
of an app that does this that I can look at for examples or perhaps a
strategy of implementing this?

If you're in the United States -- Happy Memorial Day weekend!
-Robert O'Connor


[web2py] Re: New to web app development -- is web2py a good choice

2010-05-29 Thread Robert O'Connor
Some of the cookbooks are handy.

What if somebody provided a way to do "wizard" style user interfaces.
(I requested information on a separate thread -- which is currently
awaiting moderation)

There is both a lack of official documentation and even resources of
those who've used it! I've done google searches and turned up nil in a
lot of cases! I'll try to contribute a bit when I figure out how to do
what i want. Blogs are the number one untapped resource for learning
new things.

--rob

On May 12, 11:11 am, Thadeus Burgess  wrote:
> We need tutorials, a beginners, intermediate, and expert level on
> web2py apps, each going into different details of web2py step by step
> line by line.
>
> --
> Thadeus
>
> On Wed, May 12, 2010 at 4:17 AM, cjrh  wrote:
> > On May 12, 6:11 am, Richard  wrote:
> >> The book was a huge improvement but there is certainly more to be
> >> done. Unfortunately this kind of work is not fun so happens slowly.
>
> > I am happy to volunteer help for documentation.  I enjoy improving
> > documentation.
>
> >> Would it be worth migrating useful content to the book (and slices)
> >> and close the legacy apps (AlterEgo, wiki)?
>
> > Yes, I think so.   Try to focus on the official documentation as much
> > as possible.  My 2nd edition copy of the book here looks about 325
> > pages, which is already quite long.  From a publisher point-of-view,
> > it may make more economic sense to split the official documentation
> > into two books, e.g. a "reference" manual and a "user" manual, the
> > former concerned with formal specifications of the classes and
> > structure of the framework, and the latter focused on how the
> > framework must be used to create applications?  It should be easy to
> > do this via Lulu.


Re: [web2py] Documentation on moving common code into modules?

2010-06-14 Thread Robert O'Connor
throw it into the "modules" directory in its own file say foo.py
-Rob


On Mon, Jun 14, 2010 at 5:11 PM, David Mitchell  wrote:

> Hello all,
>
> I'm at early days in my 1st serious web2py project, and I've got a few bits
> of code that are common to multiple different controllers.
>
> I want to move these code blocks into their own separate code module so
> they can be maintained at a single place, but I can't find any documentation
> about how to structure such a module nor how to call it from my controllers.
>
> Any tips or URL pointers?
>
> Thanks in advance
>
> Dave M.
>


Re: [web2py] Re: ARTICLE: The good and bad about web2py

2010-08-01 Thread Robert O'Connor
-Rob


On Sun, Aug 1, 2010 at 4:42 PM, Scott  wrote:

> I missed the last few sections when I pasted in my response :-)
>
> - web2py uses the DAL as documented here:
> http://en.wikipedia.org/wiki/Web2py#Database_handling;
> why is an ORM needed?
>
> - web2py has excellent IDE support through Eclipse and Wing IDE.
> Maybe we need more details on his issue.
>
It also happens to work *out of the box* with IntelliJ IDEA --- with full
debugging support!

>
> - As he rightly points out the single-core question is an interpreter
> limitation of sorts and really has nothing to do with web2py.  That
> having been said, you can easily set up multiple instances and load-
> balance them.  All of which is heavily documented in the scalability
> section of the web2py book.
>
> On Aug 1, 4:36 pm, Scott  wrote:
> > Here are my thoughts, point by point:
> >
> > - web2py does support unit testing as it uses python code.  I think
> > the article author means you cannot currently set up unit tests within
> > the administration console.  You can configure tests as much or as
> > little as you like from the command line.
> >
> > - I think the article author should elaborate on the meaning of the
> > phrase “used in a twisted way to design the framework”.  I don't see
> > anything twisted about the implementation; web2py is a WSGI
> > application.  Personally, I think following Style Guide for Python
> > Code (PEP-8) is a good thing.  Why is following the standard Style
> > Guide a bad thing?  It promotes readability, consistency and
> > reusability.
> >
> > - I cannot disagree with the author more on his view of error
> > reporting.  I prefer having the list of errors viewable from the
> > administration console so I can refer to previous errors without
> > grepping through logs.  Not only that, but web2py built-in error
> > reporting gives you hyperlinks to the files so you can track down the
> > root cause.  This is a Good Thing™!  Furthermore, you could just
> > enable & tail the debug log if it bothers you that much.
> >
> > On Aug 1, 1:28 pm, David Marko  wrote:
> >
> >
> >
> >
> >
> >
> >
> > >http://www.ahmedsoliman.com/2010/07/29/the-good-and-bad-about-web2py/
>


[web2py] Making old urls for the book work

2010-08-12 Thread Robert O'Connor
Hey,

Massimo could you make it so that the old URLS (which are cached by
google) work?

You don't break backwards compatibility in web2py, so why not follow
suit with the book?

=D

--rob


Re: [web2py] Re: Making old urls for the book work

2010-08-12 Thread Robert O'Connor
Example: http://web2py.com/book/default/section/7/7 is busted (custom
forms from the 2ed. of the book).

That is cached/indexed by google.

-Rob



On Thu, Aug 12, 2010 at 6:12 PM, mdipierro  wrote:
> Sorry. I do not understand. :-(
>
> On Aug 12, 3:55 pm, "Robert O'Connor"  wrote:
>> Hey,
>>
>> Massimo could you make it so that the old URLS (which are cached by
>> google) work?
>>
>> You don't break backwards compatibility in web2py, so why not follow
>> suit with the book?
>>
>> =D
>>
>> --rob


Re: [web2py] Re: Making old urls for the book work

2010-08-12 Thread Robert O'Connor
No problem!
-Rob



On Thu, Aug 12, 2010 at 6:29 PM, mdipierro  wrote:
> oops. fixed. thanks for pointing this out.
>
>
>
> On Aug 12, 5:21 pm, "Robert O'Connor"  wrote:
>> Example:http://web2py.com/book/default/section/7/7is busted (custom
>> forms from the 2ed. of the book).
>>
>> That is cached/indexed by google.
>>
>> -Rob
>>
>> On Thu, Aug 12, 2010 at 6:12 PM, mdipierro  wrote:
>> > Sorry. I do not understand. :-(
>>
>> > On Aug 12, 3:55 pm, "Robert O'Connor"  wrote:
>> >> Hey,
>>
>> >> Massimo could you make it so that the old URLS (which are cached by
>> >> google) work?
>>
>> >> You don't break backwards compatibility in web2py, so why not follow
>> >> suit with the book?
>>
>> >> =D
>>
>> >> --rob


Re: [web2py] Re: display rows with different color

2010-08-13 Thread Robert O'Connor
Or if the browser supports CSS3:
http://www.w3.org/TR/css3-selectors/#nth-child-pseudo

that works -- but it styles *ALL* tables... be warned :)

-Rob



On Fri, Aug 13, 2010 at 5:09 AM, mdipierro  wrote:
> Add something like this to the view (or the layout):
>
> jQuery("tr:odd").css("background-color", "#ff");
>
> On Aug 13, 4:05 am, dlin  wrote:
>> I want to change the layout of the displayed form which is produced by
>> SQLTABLE and named as mytable.
>>
>> 1 x
>> 2 a
>> 3 b
>> 4 c
>> 5 d
>> 6 e
>>
>> I wish the odd lines and even lines have different background (in .css
>> instead of server side operation).
>> Is there any one here know how to do it?
>>
>> I wish the views/default/index.html could be easier like
>>
>> {{=mytable}}  // this table require odd & even have different
>> background color.
>> {{=mytable2}}  // this table just use the default table view
>>
>> But, I don't understand how to do it, how to fine tune the output
>> table's width,border with the .css client side tech.


[web2py:23201] upload filename

2009-06-03 Thread Robert Marklund
Maybe you should expose the filename making as a method:

   uuid_key = str(uuid.uuid4()).replace('-', '')[-16:]
encoded_filename = base64.b16encode(filename).lower()
newfilename = '%s.%s.%s.%s' % \
(self.table._tablename, fieldname, uuid_key,
 encoded_filename)
# for backward compatibility since upload field if
128bytes
newfilename = newfilename[:122]+'.'+e
self.vars['%s_newfilename' % fieldname] = newfilename
fields[fieldname] = newfilename

So that people with there own fileuploads can make use of the appadmin .

/Robert

-- 
______
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:23670] Auth

2009-06-09 Thread Robert Marklund
Cant auth be changed somhow to it will be easier to extend like this:

db.define_table('auth_user2',
db.auth_user,
SQLField('nickname'),
SQLField('image','upload'))

The problem to day is the:
table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email'
 % self.settings.table_user._tablename)]

It will check the auth_user table instead of my extended table for the email
to be uniq.

I have tested to add this but it doesnt help:

db.auth_user2.email.requiers = [IS_EMAIL(),
IS_NOT_IN_DB(db, 'auth_user2.email')]

/T


-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:24444] Sessions and flash

2009-06-18 Thread Robert Marklund
Hi,
I have a flash uploader that don't send the session cookie to the upload
function.
And there for cant do auth.

Is there any way i solve this ?
Perhaps with post or get data to send the session id ?

/R

-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:24652] Whats the status of T2 ?

2009-06-21 Thread Robert Marklund
I have read every where and on same places iread that the T2 plugin
can/should be used and in some places that some of the functionality is
moved in to web2py itself.
So whats the status of it what should i use ?

/R

-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:24837] Multipe create forms on same page.

2009-06-23 Thread Robert Marklund
I have some problem with multiple create forms on the same page.
def index():
  form1 = crud.create(somedb)
  form2 = crud.create(somedb)
  return dict(form1=form1, form2=form2)

The problem here is that all the rows and the inputs gets the same html id
and thats not good for jQuery manipulation.

I can see a solution in adding a form_prefix=None variable to SQLFORM that
can fix all this.

/R

-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:24887] web2py 1.64.3

2009-06-24 Thread Robert Marklund
I upgraded to web2py 1.64.3 and then:

crud started to set its own table name
 if request.extension != 'html':
 (_session, _formname) = (None, None)
 else:
(_session, _formname) = (session, table._tablename)

This breaks the app if you have multiple forms update and create.
Any special reason for this ?

This works btw:
if request.extension != 'html':
 (_session, _formname) = (None, None)
 else:
 (_session, _formname) = (session,
'%(tablename)s_%(record_id)s')
and this should also work:
if request.extension != 'html':
 (_session, _formname) = (None, None)
 else:
(_session, _formname) = (session, None)

Its the same in .4

/R



-- 
______
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:24970] db query problem

2009-06-25 Thread Robert Marklund
I would like to do a join but get results even if it was unsucessfull.

Like this

query = (db.images.id == db.image_info.image_id)  &
(db.images.id==db.image_keyword.image_id)
& \
  (db.keyword.id==db.image_keyword.keyword_id)

I want to get the resulting rows even doe no keywords exists.
like this row.image = the image
row.image_info = the image info
row.keyword = None if there is no keyword.

Is this possible ?

/R

-- 
______
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:25550] datetime wrong locale.

2009-07-03 Thread Robert Marklund
Hi,
it seams like the locale is not set for datetime objects used in modules
folder.

with locale i mean that the language used by the T object should be set as
locale.

If this is correct how can i get the locale from web2py ?

/R

-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:22923] jQuery noCoflict

2009-05-29 Thread Robert Marklund
Would it be possible to use jQuery in noConflict mode internally so that you
can use other javascript engines as well ?
See this for more info:
http://docs.jquery.com/Using_jQuery_with_Other_Libraries

/Robert

-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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:22935] Re: jQuery noCoflict

2009-05-30 Thread Robert Marklund
Sounds good!

/R

2009/5/29 mdipierro 

>
> yes and no. this would break backward compatibility. we can rewrite
> the provided jquery so that they use jQuery instead of $
> and leave the it to the user to call jQuery.noConflict() if needed.
>
> I would probably take a patch for the welcome app in this direction,
> assuming it does not break anything.
>
> Massimo
>
> On May 29, 3:13 pm, Robert Marklund  wrote:
> > Would it be possible to use jQuery in noConflict mode internally so that
> you
> > can use other javascript engines as well ?
> > See this for more info:
> http://docs.jquery.com/Using_jQuery_with_Other_Libraries
> >
> > /Robert
> >
> > --
> > __
> > Robert Marklund
> >
> > Phone: +46 (0)46 19 36 82
> > Mobile: +46 (0)70 213 22 76
> > E-mail: robbelibob...@gmail.com
> > __
> >
>


-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.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
-~--~~~~--~~--~--~---



Re: [web2py] Re: new demo appliance for gmap and fullcalendar

2012-09-21 Thread Robert O'Connor
Same issue as all the above

---rob

Sent from my phone...excuse any typos.
On Sep 21, 2012 9:27 AM, "Richard Vézina" 
wrote:

> Forgot it :
>
> Don't forget the appliances page:
> http://web2py.com/appliances
>
> I think the AppointmentManager app implements a calendar that might be
> interesting.
> Anyway, it is easy to download it and take a look.
>
>
> Form an other thread...
>
> Richard
>
> On Fri, Sep 21, 2012 at 9:25 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Fullcalendar example seems not there anymore??
>>
>> Richard
>>
>>
>> On Tue, May 29, 2012 at 12:16 PM, Niphlod  wrote:
>>
>>> I have fullcalendar too in my application.
>>>
>>> given that mytable.mydate is a datetime, try serializing the event in a
>>> dict in json with mytable.mydate.strftime('%Y-%m-%dT%H:%M:%SZ')
>>>
>>> Il giorno martedì 29 maggio 2012 17:26:44 UTC+2, villas ha scritto:
>>>
 Hi Anthony
 Well,  yes,  I did look there but I still couldn't find it.
 A working link would still be useful.
 D

>>>
>>
>  --
>
>
>
>

-- 





[web2py] How do you change memcache session expiry?

2012-09-27 Thread Robert Clark
(Using web2py 1.99.7.  Running on Ubuntu/EC2 with Elasticache)

I've followed the deployment recipe for storing sessions in memcache but 
they expire after 300 seconds of inactivity.  That appears to be because 
MEMDB doesn't look to pass down a time_expiry, therefore the set() function 
from gluon/contrib/memcache/__init__.py always uses the default of 300.

The only way I've found to change this is to explicitly modify the default 
value from this source file.

Is there a better way to configure this value for session expiry from 
within application code?  Cheers.

-- 





[web2py] Re: How do you change memcache session expiry?

2012-09-28 Thread Robert Clark
Thanks, I am not having any problems with the memcached api & python 
interface, that part all works as advertised.

The problem is that if you follow the deployment recipe for storing 
sessions in Memcached, then they always expire after 300s and there's no 
way to provide an expiry.  Here's what's the code from deployment recipe 
chapter of web2py book:

from gluon.contrib.memcache import MemcacheClientmemcache_servers = 
['127.0.0.1:11211']
cache.memcache = MemcacheClient(request, memcache_servers)
cache.ram = cache.disk = cache.memcache

..and..

from gluon.contrib.memdb import MEMDB
session.connect(request,response,db=MEMDB(cache.memcache))


If you do this and connect to memcached with e.g. "-vv" you can see that 
session data is passed in with 300s expiry.  I may be missing something 
obvious.  Can I suggest altering the API to be something like this:

session.connect(request, response, db=MEMDB(cache.memcache), 
session_expiry=3600)

Thanks!


On Saturday, September 29, 2012 12:27:55 AM UTC+12, Jose C wrote:
>
> The only way I've found to change this is to explicitly modify the default 
>> value from this source file.
>>
>> Is there a better way to configure this value for session expiry from 
>> within application code?  Cheers.
>>
>> Far as I know it's done like this:  
>
> set(key=key, value=value, time=) 
>
> where (from the source):
> @param time: Tells memcached the time which this value should expire,either
> as a delta number of seconds, or an absolute unix time-since-the-
> epoch
> value. See the memcached protocol docs section "Storage Commands"
> for more info on . We default to 0 == cache forever.
>
>  Are you saying that doesn't work?
>
>

-- 





[web2py] How can you configure memcache and built-in cache to be present at the same time

2012-05-16 Thread Robert Clark

Is there a way to configure both MemcacheClient and the built-in cache at 
the same time?

We would like to use built-in cache to hold singleton or short-life python 
objects across requests (being a process-only cache it suits well) and 
Memcache for everything else (sessions and expensive-to-create application 
data).  It looks like we could configure memcache as described in the 
web2py book, so we're really after a way make another process-only cache 
available for selective use.

Thanks,
Rob

[web2py] Re: How do you change memcache session expiry?

2012-09-29 Thread Robert Clark
Thanks everyone, have added an issue
http://code.google.com/p/web2py/issues/detail?id=1049

On Sunday, September 30, 2012 3:51:10 AM UTC+13, Massimo Di Pierro wrote:
>
> It also looks to me memdb should not be implemented as it is. It should be 
> implemented as a plugin_adapter for DAL.
>
> On Saturday, 29 September 2012 09:50:37 UTC-5, Massimo Di Pierro wrote:
>>
>> I would prefer the syntax:
>>
>> session.connect(request, response, db=MEMDB(cache.memcache, 
>> session_expiry=3600))
>>
>>
>>
>> On Saturday, 29 September 2012 07:11:10 UTC-5, Niphlod wrote:
>>>
>>> yep, open a bug on http://code.google.com/p/web2py/issues/list
>>>
>>> On Saturday, September 29, 2012 5:24:07 AM UTC+2, Robert Clark wrote:
>>>>
>>>> Thanks, I am not having any problems with the memcached api & python 
>>>> interface, that part all works as advertised.
>>>>
>>>> The problem is that if you follow the deployment recipe for storing 
>>>> sessions in Memcached, then they always expire after 300s and there's no 
>>>> way to provide an expiry.  Here's what's the code from deployment recipe 
>>>> chapter of web2py book:
>>>>
>>>> from gluon.contrib.memcache import MemcacheClientmemcache_servers = 
>>>> ['127.0.0.1:11211']
>>>> cache.memcache = MemcacheClient(request, memcache_servers)
>>>> cache.ram = cache.disk = cache.memcache
>>>>
>>>> ..and..
>>>>
>>>> from gluon.contrib.memdb import MEMDB
>>>> session.connect(request,response,db=MEMDB(cache.memcache))
>>>>
>>>>
>>>> If you do this and connect to memcached with e.g. "-vv" you can see 
>>>> that session data is passed in with 300s expiry.  I may be missing 
>>>> something obvious.  Can I suggest altering the API to be something like 
>>>> this:
>>>>
>>>> session.connect(request, response, db=MEMDB(cache.memcache), 
>>>> session_expiry=3600)
>>>>
>>>> Thanks!
>>>>
>>>>
>>>> On Saturday, September 29, 2012 12:27:55 AM UTC+12, Jose C wrote:
>>>>>
>>>>> The only way I've found to change this is to explicitly modify the 
>>>>>> default value from this source file.
>>>>>>
>>>>>> Is there a better way to configure this value for session expiry from 
>>>>>> within application code?  Cheers.
>>>>>>
>>>>>> Far as I know it's done like this:  
>>>>>
>>>>> set(key=key, value=value, time=) 
>>>>>
>>>>> where (from the source):
>>>>> @param time: Tells memcached the time which this value should 
>>>>> expire,either
>>>>> as a delta number of seconds, or an absolute unix time-since-
>>>>> the-epoch
>>>>> value. See the memcached protocol docs section "Storage 
>>>>> Commands"
>>>>> for more info on . We default to 0 == cache forever.
>>>>>
>>>>>  Are you saying that doesn't work?
>>>>>
>>>>>

-- 





[web2py] Re: web3py?

2012-12-10 Thread Robert Clark
A couple of days ago in the "web3py important!" thread I posted some 
thoughts on URL route matching syntax for the @expose() method, but my 
post is yet to surface.  Posting a more-considered version here for 
consideration and feedback.

I've been looking into some other frameworks, and Alloy stands out to me 
(http://alloyframework.org/manual/url-router/), it's the main inspiration 
for the syntax below.  (Also looked at Flask, Silex, Codeignighter, Django 
and considered trade offs each one brings)

In a URL route lets say that '/' delimits segments, and anything between 
matching '<' and '>' pairs is a segment pattern.  Each segment may contain 
either static text or a segment pattern.  Segment patterns cannot span '/' 
separators.

1. Suggest use symbols to define string and integer types in segment 
patterns. ":" = "str", "#" = int (are other types necessary?).  So ':' is 
no longer a delimiter.
@expose('/index/<:company>/<#ssd>')
def index(company, ssd):
  '''company is a string, ssd is an int'''

2. Up to one question mark may be included immediately before any '/' to 
indicate the remaining segment patterns are all optional (and consequently 
map to non-required attributes which may have defaults).  By specifying a 
single point in the route beyond which matching segments are optional, it's 
harder to write ambiguous route definitions.
@expose('/index/<:company>/<#ssd>?/<#favourite>')
def index(company, sad, favourite=None):

@expose('index/<:company>/<#ssd>?/<#favourite>/<#last_visited_article>')
def index(company, ssd, favourite=None, last_visited_article=1):

3. Perhaps use "*" as wildcard to match text (including '/') but there may 
be good security reasons not to allow?  The constraint could be that no 
segment patterns may follow.  Also only one per route.  Always a string.
@expose('index/<:company>/<#ssd>?/<*rest_of_url>')
def index(company, ssd, part_of_url='not provided'):

@expose('index/<:company>/<#ssd>/<*part_of_url>/some-static-text')
def index(company, ssd, part_of_url):

4. Regex.  Must match whole segments - i.e. shouldn't be able to split a 
section into multiple parameters with a regex. Keep type - so regex match 
is still passed through as string or int.  (E.g. the 4-digit year is passed 
through as 'int' here.).  It's not really a validator but could be abused 
that way.
@expose('index/<:company|[A-Za-z ]{3,20}>/<#year|[0-9]{4}>')
def index(company, year):

Cheers
Rob


On Tuesday, November 27, 2012 1:39:06 AM UTC-3, User wrote:
>
> I noticed a thread over in web2py-developers web3py - 
> important!
>  which 
> was exciting to read.  I've flirted with web2py and there's a lot that I 
> like about it.  For some reason I find web2py exciting whereas django 
> doesn't provide that.  I've used Yii on the php side which is great 
> framework as far as php goes and asp.net mvc which is great as well.  I'd 
> love to work with python but the main thing making me hesitate with web2py 
> is critical mass.  
>  
> It seems like it wouldn't be hard for web2py to really dominate the python 
> web framework space if some of the core criticisms were addressed.  I'm not 
> fully up to speed on what they are but I usually hear about unit testing 
> and global variables.  It feels like there is a roadblock preventing the 
> project from skyrocketing.  Python needs a rails.  I understand that the 
> design decisions are by choice with pros and cons.
>  
> My questions are:
> 1. Will web3py likely address these often repeated core criticisms? (I saw 
> point 5 from the thread linked to above: "5) No more global environment. 
> Apps will do "from web3py import *" (see below)")
> 2. The developer thread is over in the developers section.  Will you have 
> a more open forum for users (as opposed to developers) to have input on 
> web3py?
>  
>  
>

-- 





Re: [web2py] Re: web3py?

2012-12-10 Thread Robert Clark
Nice, that is great news that it already behaves like this :). Definitely
gets my vote.

I couldn't see these details elaborated in the web3py thread so was aiming
to suggest some clear rules.   Guess that makes these suggestions syntactic
only.

Still to try web3py, will do soon.

On Mon, Dec 10, 2012 at 9:33 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> web3py does that already. Although it does not support the exact syntax
> you proposed. Did you try it?
>
>
> On Monday, 10 December 2012 17:42:20 UTC-6, Robert Clark wrote:
>>
>> A couple of days ago in the "web3py important!" thread I posted some
>> thoughts on URL route matching syntax for the @expose() method, but my
>> post is yet to surface.  Posting a more-considered version here for
>> consideration and feedback.
>>
>> I've been looking into some other frameworks, and Alloy stands out to me (
>> http://alloyframework.org/**manual/url-router/<http://alloyframework.org/manual/url-router/>),
>> it's the main inspiration for the syntax below.  (Also looked at Flask,
>> Silex, Codeignighter, Django and considered trade offs each one brings)
>>
>> In a URL route lets say that '/' delimits segments, and anything between
>> matching '<' and '>' pairs is a segment pattern.  Each segment may contain
>> either static text or a segment pattern.  Segment patterns cannot span '/'
>> separators.
>>
>> 1. Suggest use symbols to define string and integer types in segment
>> patterns. ":" = "str", "#" = int (are other types necessary?).  So ':' is
>> no longer a delimiter.
>> @expose('/index/<:company>/<#**ssd>')
>> def index(company, ssd):
>>   '''company is a string, ssd is an int'''
>>
>> 2. Up to one question mark may be included immediately before any '/' to
>> indicate the remaining segment patterns are all optional (and consequently
>> map to non-required attributes which may have defaults).  By specifying a
>> single point in the route beyond which matching segments are optional, it's
>> harder to write ambiguous route definitions.
>> @expose('/index/<:company>/<#**ssd>?/<#favourite>')
>> def index(company, sad, favourite=None):
>>
>> @expose('index/<:company>/<#**ssd>?/<#favourite>/<#last_**
>> visited_article>')
>> def index(company, ssd, favourite=None, last_visited_article=1):
>>
>> 3. Perhaps use "*" as wildcard to match text (including '/') but there
>> may be good security reasons not to allow?  The constraint could be that no
>> segment patterns may follow.  Also only one per route.  Always a string.
>> @expose('index/<:company>/<#**ssd>?/<*rest_of_url>')
>> def index(company, ssd, part_of_url='not provided'):
>>
>> @expose('index/<:company>/<#**ssd>/<*part_of_url>/some-**static-text')
>> def index(company, ssd, part_of_url):
>>
>> 4. Regex.  Must match whole segments - i.e. shouldn't be able to split a
>> section into multiple parameters with a regex. Keep type - so regex match
>> is still passed through as string or int.  (E.g. the 4-digit year is passed
>> through as 'int' here.).  It's not really a validator but could be abused
>> that way.
>> @expose('index/<:company|[A-**Za-z ]{3,20}>/<#year|[0-9]{4}>')
>> def index(company, year):
>>
>> Cheers
>> Rob
>>
>>
>> On Tuesday, November 27, 2012 1:39:06 AM UTC-3, User wrote:
>>>
>>> I noticed a thread over in web2py-developers web3py - 
>>> important!<https://groups.google.com/forum/?fromgroups=#!topic/web2py-developers/RCeiRd3Rzs0>
>>>  which
>>> was exciting to read.  I've flirted with web2py and there's a lot that I
>>> like about it.  For some reason I find web2py exciting whereas django
>>> doesn't provide that.  I've used Yii on the php side which is great
>>> framework as far as php goes and asp.net mvc which is great as well.
>>> I'd love to work with python but the main thing making me hesitate with
>>> web2py is critical mass.
>>>
>>> It seems like it wouldn't be hard for web2py to really dominate the
>>> python web framework space if some of the core criticisms were addressed.
>>> I'm not fully up to speed on what they are but I usually hear about unit
>>> testing and global variables.  It feels like there is a roadblock
>>> preventing the project from skyrocketing.  Python needs a rails.  I
>>> understand that the design decisions are by choice with pros and cons.
>>>
>>> My questions are:
>>> 1. Will web3py likely address these often repeated core criticisms? (I
>>> saw point 5 from the thread linked to above: "5) No more global
>>> environment. Apps will do "from web3py import *" (see below)")
>>> 2. The developer thread is over in the developers section.  Will you
>>> have a more open forum for users (as opposed to developers) to have input
>>> on web3py?
>>>
>>>
>>>
>>  --
>
>
>
>



-- 
robert.cl...@niftybean.com
nz.linkedin.com/in/robertclarknz
twitter.com/robot88

Niftybean Productions Ltd · niftybean.com
PO Box 11463 · Manners Street Central · Wellington 6142 · NZ
021.146.9675 · 04.478.2968

-- 





[web2py] SQLFORM.grid and custom display values from fields not displayed in the table.

2012-01-13 Thread Robert Clark
Can I first say that SQLFORM.grid is great and a massive productivity
gain, thanks Massimo & the rest of the web2py team.

My question is around formatting a column when the display value
depends on other non-visible columns (or other related tables).  We're
using the "links" parameter and a lambda function to generate the
label.  The clunky part is that the row function needs to go back to
the database each time as not all the fields required to generate that
display value are available in the "row" value passed to the lambda
function.  It seems like it would be cleaner if we didn't have to
unnecessarily revisit the database each time.

Here's a cut-back model & controller to illustrate.

db.define_table('fileimportgroup',
Field('status', 'string'), # "not_started", "success",
"processing", "cancelled", "errors"
Field('type', 'string'),
Field('start', 'datetime'),
Field('end', 'datetime'))

db.define_table('fileimportitem',
Field('fileimportgroup_id', db.fileimportgroup),
Field('status', 'string'), # "not_started", "unsupported_format",
"duplicate", "removed_prior_to_import", "failed", "imported"
Field('processed', 'datetime'))

# Controller function
def importgroups():
def _processing_status_label(fig):
# This raises a KeyError unless db.fileimportgroup.status is
added in fields
# status = fig.status

# Have to select the status instead
status =
db(db.fileimportgroup.id==fig['id']).select(db.fileimportgroup.status).first()
['status']

fig_id = fig['id']
if status == 'processing':
total =
db(db.fileimportitem.fileimportgroup_id==fig_id).count()
processed =
db((db.fileimportitem.fileimportgroup_id==fig_id)&
(db.fileimportitem.status!='not_started')).count()
return '%d/%d files processed' % (processed, total)
if status == 'success':
return 'Successful'
# ... etc.
return 'Unknown'

links = [dict(header='Status', body=lambda row:
_processing_status_label(row))]
grid=SQLFORM.grid((db.fileimportgroup.id>0), paginate=15,
links=links, orderby=~db.fileimportgroup.start,
fields=[db.fileimportgroup.start, db.fileimportgroup.end])

return dict(importgroups=grid)


(I realise we could change the model and increment a processed count
on fileimportgroup, but I'm hoping for a recommended fix to the
general problem)

Can I suggest adding a new SQLFORM.grid parameter like
"fields_nonvisible" which would select these fields back from the
database but not add columns for them.  That would do the trick, does
that sound reasonable?

Or is there another way to achieve what we're doing without having to
select non "fields" values one at a time?  Thanks.



[web2py] Executing controller- and function-specific models in web2py shell

2012-01-15 Thread Robert Clark

If running a web2py shell, how can model files within controller
subdirectories be made available in the environment?

For example if we have these two model files:
myapp/models/db.py
myapp/models/acontroller/db_controller.py

Then when launching web2py using:
$> python web2py.py -S myapp -M

Typing 'db.tables' prints tables defined in db.py

Is there a way to specify a controller (or function) to execute models
for in a web2py shell?

Thanks


[web2py] new user startup error question

2012-01-20 Thread robert schaefer
Hi,

  I am using RedHat Linux Ver 5.0., python 2.6.2
  I downloaded the source and started the server with the command "python 
web2py.py" and got the message:
  Starting browser... Error showing url: There was an error launching 
default action command associated with this location.

  How serious is this error?
  How do I diagnose it?

thanks,
 bob s.


[web2py] Re: Fw: [security-77] Secure Coding (web app) Competition

2012-03-06 Thread Robert Kooij
This is a Java contest, web2py/Python is out. Wrong boards. ;)

"The web application will be based on Google’s App Engine for Java. 
Progamming with Python and Go is not allowed."

On Tuesday, March 6, 2012 8:16:06 AM UTC+1, Luther Goh Lu Feng wrote:
>
> Fyi for web2py developers
>
> - Forwarded Message -
> > From: thomas lim 
> > To: security...@meetup.com
> > Cc: 
> > Sent: Tuesday, February 28, 2012 10:39 AM
> > Subject: [security-77] Secure Coding (web app) Competition
> > 
> > Hi readers of this mailing list
> > 
> > There will be a Secure Coding (Web Application) Competition at SyScan'12
> > Singapore. This competition will be held 25-27 April and we will be
> > accepting a maximum of 10 teams. So far, 6 teams have already signed up.
> > The First Prize is S$10,000 (cash), Second Prize is S$7,000 (cash) and
> > the Third Prize is S$3,000 (cash).
> > 
> > So do check out the SyScan website (www.syscan.org) to find out more
> > about this competition and sign up quickly.
> > 
> > -- 
> > Thank you
> > Thomas Lim
> > 
> > 
> > 
> > 
> > --
> > Please Note: If you hit "REPLY", your message will be sent to everyone 
> > on this mailing list (security...@meetup.com)
> > http://www.meetup.com/SGSecurityMG/
> > This message was sent by thomas lim (tho...@coseinc.com) from The 
> Singapore 
> > Security Meetup Group.
> > To learn more about thomas lim, visit his/her member profile: 
> > http://www.meetup.com/SGSecurityMG/members/11745624/
> > Set my mailing list to email me
> > 
> > As they are sent
> > http://www.meetup.com/SGSecurityMG/list_prefs/?pref=1
> > 
> > In one daily email
> > http://www.meetup.com/SGSecurityMG/list_prefs/?pref=2
> > 
> > Don't send me mailing list messages
> > http://www.meetup.com/SGSecurityMG/list_prefs/?pref=0
> > Meetup, PO Box 4668 #37895 New York, New York 10163-4668 | 
> supp...@meetup.com
> > 
>
>

Re: [web2py] Re: web2py received 2011 BOSSIE Award by InfoWorld.com

2011-09-08 Thread Robert Kooij
About time. ;) 

Grats everyone and Massimo in particular!



[web2py] Using trunk

2011-09-14 Thread Robert Aldridge
I've been dabbling with web2py for a bit.  Kudos to the developers!  Things
are coming together nicely.

I've been using the stable release (1.98.2), but would like to try some of
the newer features (SQLFORM.grid, SQLFORM.smartgrid, etc.).  I'm using
Ubuntu 11.04 with Python 2.7.1+.  I'm somewhat familiar with Bazaar, Git,
and Mercurial.  What would be the best/easiest way for me to get set up with
either the latest nightly build or trunk?

Thanks,

Robert


[web2py] Re: what about web2py 2.0?

2011-09-20 Thread Robert Kooij
2.0 should be a mark of maturity in my opinion. I fear change in software.

I strongly recommend you all to read the following article, because this is 
not where we want to be in a few years:

http://www.unleashedmind.com/en/blog/sun/the-drupal-crisis

It's about the current state of the well marketed PHP framework/CMS Drupal. 
Imo these are the kind of users we want to attract, people coming from PHP 
showing them web development can be great. :)


[web2py] Re: Found a bug: XMLRPC with basic authorization fails

2011-10-23 Thread Robert Clark
Hi Massimo

Here are the steps to reproduce this problem in web2py 1.99.2 (these
steps worked fine on 1.98.x versions)

1) In web2py admin create "New simple application" called "foo"

2) Add to db.py:
auth.settings.allow_basic_login = True

3) Decorate call() with @auth.requires_login in default.py:

@auth.requires_login()
def call():
...

4) Add a simple XMLPRC method to default.py:

@service.xmlrpc
def multiply(a=1,b=1):
return dict(answer=int(a) * int(b))

5) Register a user with email "bob.sm...@foo.com" password "snowball"

6) From a python shell use ServerProxy to invoke the service

> from xmlrpclib import ServerProxy
> server = 
> ServerProxy('http://bob.sm...@foo.com:snowball@localhost:8000/foo/default/call/xmlrpc',
>  verbose=True)
> server.multiply(2, 2)

...
reply: 'HTTP/1.1 303 SEE OTHER\r\n'
...



Cheers,
Rob


On Oct 22, 2:59 am, Massimo Di Pierro 
wrote:
> Can you provide an example to reproduce the problem?
>
> On Oct 21, 12:38 am,RobinMarshall
> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Just wanted to say that we found a bug in 1.99.2 when using XMLRPC
> > services with the @auth.requires_login decorator using basic
> > authentication.
>
> > It looks like some code was refactored out of requires_login into a
> > generic requires method which might be the cause of the problem.
>
> > A quick hack was to change the following code, but obviously that
> > won't work very well for people who aren't using basic authentication.
>
> >     def is_logged_in(self):
> >         """
> >         checks if the user is logged in and returns True/False.
> >         if so user is in auth.user as well as in session.auth.user
> >         """
> >         if self.user:
> >             return True
> >         return False
>
> > to:
>
> >     def is_logged_in(self):
> >         """
> >         checks if the user is logged in and returns True/False.
> >         if so user is in auth.user as well as in session.auth.user
> >         """
> >         if self.basic() and self.user:
> >             return True
> >         return False
>
> > Cheers,
> >Robin


[web2py] SparkleShare

2011-10-28 Thread Robert Marklund
If someone is looking for a nice mission with web2py why not create a
web UI for the sparkleshare service.
More info here:
http://sparkleshare.org/
https://github.com/hbons/SparkleShare

Whats available today:
https://github.com/hbons/SparkleShare-Dashboard

/R


[web2py] Is there a controller post-action hook? Or should we use a decorator.

2011-11-12 Thread Robert Clark

Is there a simple way to register code for execution after each
controller action has been executed?

Our problem is that most of our controller actions eventually obtain a
pymongo connection object (from cache.ram) which itself pools
connections internally and are thread-safe.  These connection objects
need to have end_request() called to free up their internal
connections.

We were originally calling end_request() everywhere a pymongo
connection was obtained but that doesn't work for nested invocations,
and it's hard to balance when exceptions occur.

Would it be better to write a decorator and wrap the controller action
with this?

Any ideas and feedback much appreciated.


Re: [web2py] can web2py be used as a static website generator?

2011-11-20 Thread Robert Shaver
But can I put an HTML file in a directory on the server and reach it from 
the web? That's what I think of as a static web page.

For example:
http://mydomain.com/index.html


[web2py] Doc Bug Report on the web2py book

2011-11-20 Thread Robert Shaver
Didn't locate a bug reporting system so I thought I'd just post this here.

On page: http://web2py.com/book/default/chapter/04?search=server

Search for "The view sees every variable". Right after this there is an 
unintentional line break causing this text:

"defined in models and returned by the action but does not see global 
bariables defined in the controller."

to be split out from that bullet. (Also I think "bariables" is supposed to 
be "variables".)

Let me know if there is a better place to post this kind of feedback.




Re: [web2py] can web2py be used as a static website generator?

2011-11-20 Thread Robert Shaver
I'm just starting to read the web2py docs so I'm a complete noob ... 
however this may be the answer:

"Requests for files in the static folder are handled directly and large 
files are automatically streamed to the client."

I found this in the web2py book page at this 
link
.

Hope that helps.


[web2py] Can web2py do shared IP hosting

2011-11-20 Thread Robert Shaver
I'm completely new to web2py and so far have only been reading the 
documents to see if it has the features I'm looking for to implement my 
next project. Please let me know if I'm asking the wrong questions or if 
there's anything else I should be considering along with these questions.

Many servers support shared IP hosting. Does web2py support this? (I didn't 
know what to call that feature until I found 
this
.)
Can it also support dedicated IP hosting for multiple web sites? (Each site 
has a unique IP address on the same server.)
Can it also support sub-domains as well? (EXAMPLE: 
http://subdomain.maindomain.com/a/c/f)

This all assumes the DNS is all set up correctly.

I do intend that each of these sites be completely different from the 
others supported on the same server with one instance of web2py.


[web2py] Re: Can web2py do shared IP hosting

2011-11-21 Thread Robert Shaver
Dear Massimo,

Thank you for your quick response. I heard your interview on FLOSS Weekly 
and that's how I discovered web2py.

I guess I misread something. I thought I could download web2py and install 
it with a built-in web server ... Rocket I think was the name. (I haven't 
researched Rocket yet.) Are you saying that these features are addressed as 
part of the server environment and not a defined feature of web2py? (I've 
always had an admin doing this kind of detail work so I've never had to 
understand it in detail.)

I should have been more clear about my computer environment ... my 
assumption was that I would be running web2py on my own dedicated server 
... which is what I do now with my projects. My intention is to replace the 
server/framework I have now with one based on web2py but I want to be sure 
it has all the features I will need to grow.

For example, I want to design all the new web sites to be mobile compatible 
using responsive page design, which scales smoothly for desktop, tablet and 
smart-phone screen sizes. Here's a page with many examples of this in 
production now: http://designmodo.com/responsive-design-examples/

Warmest regards,

Rob:-]


Re: [web2py] Can web2py do shared IP hosting

2011-11-21 Thread Robert Shaver
Hi Phyo,

Thanks for your response.

My current environment is a dedicated server machine with a single web 
server which servers multiple web separate sites on sub-domains and 
dedicated IP addresses. The configuration at this level has always been 
handled by an administrator so I know less about it than I should.

I'm trying to figure out if web2py can replace my existing system and 
provide all the features and flexibility that I will need going forward.

Thanks again for your help.

Peace,

Rob:-]


[web2py] Re: cannot run web2py on windows 7 machine with python 2.7 installed

2011-11-21 Thread Robert Shaver
I am having exactly the same problem. I'm on Windows 7 64 bit. I searched 
my disk for Python and found 6,647 occurrences of the word. From the 
various names on the files I believe that I have versions 2.5, 2.6.1 and 
2.6.6 as a result of installing web2py, OpenOffice, InkScape and Blender.

So when I clicked on the web2py.exe, what exactly did it do? Did it install 
Python 2.5 somewhere? (I found python25.dll in my download directory but 
not inside of the web2py folder.) Did it modify the Windows registry? Did 
it change any environment variables like "path"? Does it move any of the 
files or all they all *installed *in place?

Once I clean up I think I'll try the source version.

Peace,

Rob:-]


[web2py] Re: Proposals for New Tagline

2011-03-15 Thread Robert Kooij

   
   -  Try to avoid vagueness or bad marketing terms. Be factual.
   
   - Would not try to use more than three properties. (secure, scalabale, 
   fast, easy to learn, productive, great community etc.) Pick the three that 
   are most important.
   
   - Let's not forget the obvious, explain the name a bit more, it's mainly 
   to lure in people who see it for the first time. Previous poster said 
   "speed", "security" and "scalability". But of what? Mention web development! 
   That's what we are all here for! And as rapid as we can! :)


web2py: secure & scalable python framework for rapid web development





[web2py] Re: Proposals for New Tagline

2011-03-15 Thread Robert Kooij
If it's all too boring, we could spice things up! :)

web2py: making web development sexy since 2007.




[web2py] Re: we need a few more good people!

2011-03-31 Thread Robert Kooij
Waiting for approval as well. :)

By the way I ran into the following small typo's in the site, maybe someone 
can fix them:

(1) Once logged in on the "Experts" page. 
(http://experts4solutions.com/e4s/default/experts) Typo in the title 
"Experts Pedning Approval"

(2) (C) Footer still says 2010, should make this dynamic / auto update. ;)

(3) Typo in the bottom of the index page:

"You can be listed as an experts4solutions partner if at least one of your 
employees is a member of experts4solution and if your company provides 
development and consulting services in one or more of our approved 
technolgies." 

Technolgies missing an o.

(4) Typo Expert detail page, for example:

http://experts4solutions.com/e4s/default/expert/9

Contact
"... other contat mechanisms to her/his profile at her/his own discretion."

The word "contat" is missing an c.

(5) One more suggestion for an improvement. When submitting this form, the 
submitter receives a copy of the form in their mailbox.

As there is no accompanying message with the email, it may look confusing 
for some users.

So maybe should wrap their message or add a header saying something like: 
"On [date/time] you submitted the following message on 
http://experts4solutions.com/:"; Or this is a copy of the form for your own 
keeping, something to that extent.

Hope that helps!




Re: [web2py] Re: a chance to vote for web2py

2011-05-06 Thread Robert Kooij
Voted! :)



[web2py] Can local_import() import a class definition?

2011-06-28 Thread Robert Clark
I can't seem to get local_import() importing classes from module files
in the same way 'from X import Y' normally works in Python.  Say I
have the following in mymodule.py

def my_func(arg1):
doSomething(arg1)

class my_class(object):
__init__(self):
...etc.

my_class_ref = my_class# Hack explained below



Importing my_func from a controller is fine:

mymodule = local_import('mymodule')
mymodule.my_func(some_arg)

But how can I get a reference to my_class for instantiation?  Normal
python importing would allow me to do this:

from mymodule import my_class
my_instance = my_class()

Some kind of similar syntax for local_import() would be helpful.  My
current 'Hack' is to add a variable (see "my_class_ref" above).
local_import allows those to be referenced from the imported module.
For example this works:

mymodule = local_import('mymodule')
my_new_class_instance = mymodule.my_class_ref()

Is there something I'm missing?  Any recommendations appreciated.


[web2py] Re: Can local_import() import a class definition?

2011-06-28 Thread Robert Clark
Great!  "from mymodule import my_class" works exactly as you
described.

I didn't realise local_import was deprecated.  The web2py Book still
refers to it in this section:
http://web2py.com/book/default/chapter/04#Third-Party-Modules

You were right that something else was going on. I was invoking module
code from unit tests and had a typo in the import name.

Thanks for your help.


On Jun 29, 2:03 am, Massimo Di Pierro 
wrote:
> Are you telling us that this does not work?
>
> mymodule = local_import('mymodule')
> my_new_class_instance = mymodule.my_class()
>
> It is veyr odd and I do not think this has anything to do with
> local_import. Something else is going on.
> Anyway, local_import is deprecated. Try
>
> from mymodule import my_class
>
> this should work now even if mymodule is in applications/yourapp/
> modules/
>
> On Jun 28, 8:54 am, Robert Clark  wrote:
>
>
>
>
>
>
>
> > I can't seem to get local_import() importing classes from module files
> > in the same way 'from X import Y' normally works in Python.  Say I
> > have the following in mymodule.py
>
> > def my_func(arg1):
> >     doSomething(arg1)
>
> > class my_class(object):
> >     __init__(self):
> >         ...etc.
>
> > my_class_ref = my_class    # Hack explained below
>
> > Importing my_func from a controller is fine:
>
> > mymodule = local_import('mymodule')
> > mymodule.my_func(some_arg)
>
> > But how can I get a reference to my_class for instantiation?  Normal
> > python importing would allow me to do this:
>
> > from mymodule import my_class
> > my_instance = my_class()
>
> > Some kind of similar syntax for local_import() would be helpful.  My
> > current 'Hack' is to add a variable (see "my_class_ref" above).
> > local_import allows those to be referenced from the imported module.
> > For example this works:
>
> > mymodule = local_import('mymodule')
> > my_new_class_instance = mymodule.my_class_ref()
>
> > Is there something I'm missing?  Any recommendations appreciated.


Re: [web2py] Re: More Manual Issues

2013-06-04 Thread Robert Moore
Yep, that's the first thing I tried - dinna work.

Actually, I tried lots of variations before I devolved to begging for alms
on the web - as one always should.

On Tue, Jun 4, 2013 at 11:42 AM, Anthony  wrote:

> This works for me:
>
> {{=DIV(B(I("hello ", "")), _class="myclass")}}
>
> The extra ")" was after "".
>
> Anthony
>
>
> On Tuesday, June 4, 2013 11:28:51 AM UTC-4, REM wrote:
>>
>> Still working through the manual, however puzzling and unexplained things
>> do still occur. For instance: why does this code (cut and pasted from
>> P.233) - placed in a view of course - always generate a syntax error?
>>
>> {{=DIV(B(I("hello ", ""))), _class="myclass")}}
>>
>> Well, first I thought it was because there was an unmatched right
>> parentheses at the end but, when you remove it the syntax error remains,
>> so, I beseech The Collective:
>>
>> Is this a manual error or my own error of understanding?
>> Why, indeed, is there an unmatched right parentheses?
>>
>> Many sincere thanks for assisting my future comprehension...
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/YEIot0j5OKw/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Simplest form of internal messaging

2013-08-04 Thread Robert O'Connor
A message queue is also needed potentially...if this is real time...also
this is python...a monkey can do this...
On Aug 4, 2013 9:29 PM, "Alex Glaros"  wrote:

> Can anyone help me think of a primitive form of internal messaging between
> users of an app?  No external email, nothing fancy because I have limited
> programming skill.
>
> The only requirement is that a user can leave a message for another user,
> and the other user can reply.
>
> Example:
>
>
>1. User-A leaves a message for User-B, "Hi, can you please give me
>your external email address?"
>2. User-B says: "Sure, here it is, use...@gmail.com"
>
>
> So I suppose there might be a db.Internal_Mail table.
>
>
>- auth_user_message_sender
>- auth_user_message_recipient
>- subject_of_message
>- body_of_message
>- date_time_sent
>- has_this_message_been_read_yet?
>
>
>
>1. set up permissions so that users can read all records in
>db.Internal_Mail table that have their name either in the
>auth_user_messsage_sender or  auth_user_message_recipient fields
>2. set up permissions so that users can edit/delete all records in
>db.Internal_Mail table that have their name in the auth_user_sender field
>
>
> Based on above, seems that smartgrid or grid could handle all of the
> requirements except knowing how to reply and to who, which seems
> complicated to program. To reply, perhaps would have a controller named
> reply_to_an_email.  It would let user
>
>1. search through the emails
>2. somehow select only one
>3. then create a record in db.Internal_Mail table that switches
>contents of sender and recipient fields of selected record, copies subject
>line from the received message, and let's recipient fill out the body of 
> the
>reply message.
>
>
> Any ideas? Is this already written elsewhere?  If not, would this be
> useful to anyone else?
>
> Thanks,
>
> Alex Glaros
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread Robert O'Connor
EAP is fine.  I use it all the time.
On Aug 8, 2013 4:04 PM, "Richard Vézina" 
wrote:

>
> http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29
>
> 30 days free from july 29
>
> But it not even as stable as a beta... Be aware.
>
> Richard
>
>
> On Thu, Aug 8, 2013 at 3:56 PM, Richard wrote:
>
>> Hello,
>>
>> http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/
>>
>> :)
>>
>> Richard
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Another Book Correction Needed (5th ed P.369)

2013-08-20 Thread Robert Moore
Thanks, now it works.

Man, seems like learning this stuff would be a lot easier *if I had already
learned it*. Then spotting/fixing these book errors would be a breeze.




On Tue, Aug 20, 2013 at 1:46 PM, Alex  wrote:

> seems like
> import re
> is missing at beginning of function.
>
> Alex
>
> Am Dienstag, 20. August 2013 18:47:29 UTC+2 schrieb REM:
>
>> There appears to be another error in the 5th Edition Web2Py book in
>> Chapter 7 on P.369.
>>
>> The issue is with the following code block:
>>
>> def list_records():
>> REGEX = re.compile('^(\w+).(\w+).(\w+)**\=\=(\d+)$')
>> match = REGEX.match(request.vars.query**)
>> if not match:
>> redirect(URL('error'))
>> table, field, id = match.group(2), match.group(3), match.group(4)
>> records = db(db[table][field]==id).selec**t()
>> return dict(records=records)
>>
>> When the related action is run, we get the following error:
>>
>> * global name 're' is not defined
>> *
>> And referring to line 2 of the above function as being the source of the
>> issue:
>>
>> REGEX = re.compile('^(\w+).(\w+).(\w+)**\=\=(\d+)$')
>>
>> So, my question is: with what do we replace the "re" in the problem line?
>>
>>
>>
>> Many thanks!
>>
>>
>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/V_0dYYN6B8E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Help with 5th ed. book example 11.2.1 not working (conditional fields in forms)

2013-09-07 Thread Robert Moore
Thanks a trillion!

I had started looking at the jQuery specifications and had immediately
zeroed in on .attr but, because of my unfamiliarity with Javascript in
general and jQuery in particular, I didn't see the particular issue just
yet.

Your help is extremely appreciated. It's very difficult to learn from a
book when the book contains errors, and I have spent the entire summer
running around trying to get these book errors corrected when I find them.




On Sat, Sep 7, 2013 at 4:33 AM, Alex  wrote:

> write
> if(jQuery('#taxpayer_married').is(':checked'))
> instead of
> if(jQuery('#taxpayer_married').attr('checked'))
>
> attr returns the value as it is initially defined in html. With 'is' you
> are querying the current state.
>
> Alex
>
> Am Samstag, 7. September 2013 05:34:33 UTC+2 schrieb REM:
>
>>
>> I am trying out the 11.2.1 book example on p.504, and it just doesn't
>> function at all. I've tried it with Firefox and Chromium and the behavior
>> is the same. Instead of the spouse name field appearing when the box is
>> checked, nothing happens. I've checked the book code against the web book
>> code against my code and they all appear to be the same.
>>
>> Please help find my error!
>>
>> Here's a cut and paste from the relevant book section:
>>
>> *As an example, create an input form that asks for a taxpayer's name and
>> for the name of the taxpayer's spouse, but only if he/she is married.
>> Create a test application with the following model:
>> *
>>
>> db = DAL('sqlite://db.db')
>> db.define_table('taxpayer',
>> Field('name'),
>> Field('married', 'boolean'),
>> Field('spouse_name'))
>>
>>
>> *the following "default.py" controller:*
>>
>> def index():
>> form = SQLFORM(db.taxpayer)
>> if form.process().accepted:
>> response.flash = 'record inserted'
>> return dict(form=form)
>>
>> *and the following "default/index.html" view:
>> *
>> {{extend 'layout.html'}}
>> {{=form}}
>> 
>> jQuery(document).ready(function(){
>>jQuery('#taxpayer_spouse_name__row').hide();
>>jQuery('#taxpayer_married').change(function(){
>> if(jQuery('#taxpayer_married').attr('checked'))
>> jQuery('#taxpayer_spouse_name__row').show();
>> else jQuery('#taxpayer_spouse_name__row').hide();});
>> });
>> 
>>
>> *The script in the view has the effect of hiding the row containing the
>> spouse's name:
>> *
>>
>> Unfortunately, in my tests, there's no effect. It certainly *looks* from
>> the code as though the row should appear and disappear based on the
>> checkbox, but it doesn't seem to be happening for me. Why doesn't it work?
>>
>> Does it work for you?
>>
>> Thanks.
>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/UWUmUOP8ljE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Making validators trigger only when data is present

2013-09-17 Thread Robert Moore
Well, by now I have tested the heck out of this thing, and the ill behavior
has gone away and I can't get it to come back.

My natural curiosity wants to know why but, in any case, good riddance!






On Tue, Sep 17, 2013 at 4:12 PM, REM <32variati...@gmail.com> wrote:

> In  further exploration, there's some inconsistencies in behavior.
> Sometimes it triggers the error and sometimes it doesn't. I haven't yet
> figured out what the determining factor is.
>
>
>
> On Tuesday, September 17, 2013 4:02:53 PM UTC-4, REM wrote:
>>
>> Actually, in checking out this solution, there is no change. It 
>> *still*always triggers the validator.
>>
>> What could be causing this?
>>
>>
>>
>> On Tuesday, September 17, 2013 2:56:16 PM UTC-4, Anthony wrote:
>>>
>>> requires=IS_EMPTY_OR([IS_**LENGTH(maxsize=200),
>>>  IS_MATCH('^[a-zA-Z0-9\s\#\.\$**\-\_]+$',error_message
>>> ='Character Not Allowed.')])
>>>
>>>
>>> Anthony
>>>
>>> On Tuesday, September 17, 2013 2:44:14 PM UTC-4, REM wrote:

 I have a form field which is not required, but when it is submitted
 with data, I want the data to be validated. The problem is, I get the
 validator triggering when the form is submitted with no value in that
 field. I want it to wait until there's data in there to validate it and
 ignore it if blank. I thought I could get this behavior with required=False
 and then using requires= validators, but it is failing the validation every
 time when there's no data in the field. How do you get it to validate data
 that's present and ignore blanks?

 The field in question is in the db.py as follows:

 Field('special_code1', 'string', length=200, required=False, 
 label='Special
 Code 1',
requires=[IS_LENGTH(maxsize=2**00),
  IS_MATCH('^[a-zA-Z0-9\s\#\.\$**\-\_]+$',error_message
 ='Character Not Allowed.')]
  ),



 There are no other controllers acting on this data, and no combination
 of anything I try above gets me what I want.





  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/HiTi-ofCemA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas

2013-10-28 Thread Robert O'Connor
Posting in english may be a better ideaj

--rob
Sent from my cell...excuse typos
On Oct 28, 2013 10:35 AM, "Carlynhos77"  wrote:

> ola, realmente esse trem nao vai... criei o arquivo db.py, joguei o codigo
> nele, tirei as referencias do gluon, dai ja veio outros erros...
>
> vou rever os videos do curso q fiz com o bruno rocha, apesar o curso ser
> voltado para o SQLLITE, em algum lugar ele fala das conexoes, vou ver se
> ele diz algo sobre postgresql, esse projeto q to começando é baseado nas
> explicacoes e ensinamentos q ele deu... acho q por isso ta dificil eu
> alterar, pois foi feito e configurado pro sqllite... vou estudar mais, do
> jeito q ta nao vai...
>
> agradeço imensamente sua ajuda OVIDIO, e desculpa por nao dá o retorno d
> sucesso...
>
>
>
> Em segunda-feira, 28 de outubro de 2013 08h44min52s UTC-2, Ovidio Marinho
> escreveu:
>>
>> Porque voce nao usa a ORM do web2py, e esta tentando criar o que existe
>> em models, nao mexa na configuração do gluon
>>
>> no seu db.py use no local do sqlite:
>>
>> import psycopg2
>>
>> db = DAL('postgres://usuario:senha@**localhost:5432/meubanco')
>>
>> OBS.: Usuario do Postgresql e senha do postgres.
>>
>>
>>
>>
>>
>>
>>  Ovidio Marinho Falcao Neto
>>   ITJP.NET.BR
>>  ovid...@gmail.com
>>  Brasil
>>
>>
>>
>> Em 27 de outubro de 2013 11:06, Jose Carlos Vicente Pereira <
>> carly...@gmail.com> escreveu:
>>
>>> Ola, bom dia... estou tentando conectar meu banco postgresql ao meu
>>> projeto, so q nao consigo.. veja meu codigo detalhado abaixo...
>>>
>>> --**--**
>>> --**--**
>>> 
>>> *no MODELS  - "appsettings.py"   ta assim*
>>>
>>> from gluon.storage import Storage
>>>  config = Storage(
>>> db=Storage(),
>>> mail=Storage(),
>>> auth=Storage()
>>> )
>>>
>>> import psycopg2
>>> #conn = psycopg2.connect(host='**localho**st', user='postgres',
>>> password='123',dbname='saude')
>>> conn = psycopg2.connect("dbname=saude user=postgres")
>>> db = conn.cursor()
>>>
>>> config.mail.sender = "alu...@blouweb.com"
>>> config.mail.server = "smtp.gmail.com:587" # "smtp.:25"
>>> config.mail.login = "alu...@blouweb.com:"
>>>
>>> response.title = "INFO-SAÚDE"
>>> response.description = "SAÚDE"
>>>
>>> # glob
>>> response.generic_patterns = ['*']
>>>
>>> *no MODELS   "database.py"   tem isso, no sqllite isso era usado, acho
>>> q pro postgresql nao sera usado*
>>>
>>> #coding: utf-8
>>>
>>> # conectar ao banco de dados
>>> # setar opcoes da DAL
>>>
>>> db = DAL(**config.db)
>>>
>>>
>>> *no MODELS   "datamodel_objects.py"   isso foi usado para criar as
>>> tabelas no sqllite, no postgresql ja criei as tabelas*
>>>
>>> db.define_table("cadcidade",
>>> Field("nome", "text", length=128, notnull=True, unique=True),
>>> Field("uf", "text", length=2, notnull=True),
>>> Field("cep", "text", length=8, notnull=True),
>>> Field("cod_ibge", "integer", length=7),
>>> auth.signature,
>>> format="%(nome)s"
>>> )
>>>
>>>
>>> *no CONTROLLERS  "bases.py"   tem esse codigo pra gerar a grid*
>>> *
>>> *
>>> def list_cidade():
>>> query = db.cadcidade.id > 0
>>> headers = {'cadcidade.nome':   'NOME',
>>> 'cadcidade.uf': 'UF',
>>> 'cadcidade.cep': 'CEP',
>>> 'cadcidade.cod_ibge': 'IBGE' }
>>>
>>> grid = SQLFORM.grid(query=query,
>>>  user_signature=False,
>>> paginate=20,
>>> searchable=False,
>>> csv=False,
>>> fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep,
>>> db.cadcidade.cod_ibge],
>>> orderby=db.cadcidade.nome,
>>> headers=headers
>>> )
>>> return dict(grid=grid)
>>>
>>>
>>> dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* -
>>> "list_cidade.html" o codigo ta assim...
>>>
>>> {{extend 'layout.html'}}
>>>
>>> {{block main}}
>>>
>>> 
>>>  CIDADES 
>>> 
>>>
>>> 
>>> {{=grid}}
>>> 
>>>
>>> {{end}}
>>>
>>>
>>> esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta
>>> ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo
>>> gera esse banco automatico...
>>>
>>> o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas
>>> tabelas sem problemas
>>>
>>> lembrando q usando a conexao do sqllite o projeto funciona sem
>>> problemas...
>>> --**--**
>>> --**--**
>>> --**-
>>>
>>> alguem pode me ajudar?
>>>
>>>
>>>  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/**web2py 
>>> (Source code)
>>> - 
>>> https://code.google.com/p/**web2py/issues/list(Report
>>>  Iss

[web2py] Re: How to increase the number of open forms that can be submitted (from 10) ?

2016-06-10 Thread Robert Pates
Well, Thanks Anthony and Leonel for excellent suggestions --
The issue went away when I ensure that each of the 16 forms generated had a 
unique formname value.
However, I spent some time trying to combine this with Leonel's suggestion 
to use ajax (with LOAD= ?).  But didn't manage to figure that out in a 
reasonable amount of time.  If either of you could point me to the best 
(mdipierro) web2py example appliance(s) to study to be able to examine a 
complete application I'd be (even more) grateful --


On Thursday, April 28, 2016 at 11:56:59 AM UTC-4, Anthony wrote:
>
> On Thursday, April 28, 2016 at 11:44:34 AM UTC-4, Leonel Câmara wrote:
>>
>> I would probably change the way the application works. There is 
>> absolutely no need for you to have all the 16 forms in the HTML at the same 
>> time and then try to process each one in the controller to see which was 
>> submitted. Just load the form you need when you need it using ajax. 
>>
>
> Note, if it's multiple copies of the same form, each form will still need 
> a unique name in order to generate unique formkeys in the session.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to increase the number of open forms that can be submitted (from 10) ?

2016-09-12 Thread Robert Pates
Thanks for the comment, Massimo -- Can you point me to any coded examples 
of this technique?

On Saturday, June 18, 2016 at 8:57:23 AM UTC-4, Massimo Di Pierro wrote:
>
> As suggested it is critical that multiple forms on the same name have 
> different formname(s) and this is true even if the forms are LOADed because 
> of the CSRF protection mechanism. Anyway, this one one case where you are 
> looking for the wrong solution to the problem. You should use JS to 
> generate those forms and submit them via ajax to different controller.
>
> On Friday, 10 June 2016 16:54:51 UTC-5, Robert Pates wrote:
>>
>> Well, Thanks Anthony and Leonel for excellent suggestions --
>> The issue went away when I ensure that each of the 16 forms generated had 
>> a unique formname value.
>> However, I spent some time trying to combine this with Leonel's 
>> suggestion to use ajax (with LOAD= ?).  But didn't manage to figure that 
>> out in a reasonable amount of time.  If either of you could point me to the 
>> best (mdipierro) web2py example appliance(s) to study to be able to examine 
>> a complete application I'd be (even more) grateful --
>>
>>
>> On Thursday, April 28, 2016 at 11:56:59 AM UTC-4, Anthony wrote:
>>>
>>> On Thursday, April 28, 2016 at 11:44:34 AM UTC-4, Leonel Câmara wrote:
>>>>
>>>> I would probably change the way the application works. There is 
>>>> absolutely no need for you to have all the 16 forms in the HTML at the 
>>>> same 
>>>> time and then try to process each one in the controller to see which was 
>>>> submitted. Just load the form you need when you need it using ajax. 
>>>>
>>>
>>> Note, if it's multiple copies of the same form, each form will still 
>>> need a unique name in order to generate unique formkeys in the session.
>>>
>>> Anthony
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] CouchDB support

2016-10-24 Thread Robert F
Still on the learning curve regarding Web2py but would like to know how to 
use the CouchDB DAL interface. CouchDB is mentioned in the support docs but 
does not appear during start up in list of database adapters found. For 
example I get:

Database drivers available:  psycopg2, pymysql, imaplib, MySQLdb, sqlite3, 
pyodbc



Looked at the PyDAL code base and CouchDB support appears to be present but 
just is not detected/enabled. (import not found) I have tried both binary 
and source distributions.

What steps do I need to do to enable CouchDB or any other non-standard 
adapter not listed during startup?

Any indications on how mature adapter is.  


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Forgot Password not working?

2016-12-02 Thread Robert Porter
I get this error when trying "Forgot Password": 

tools.py:808 - Mail.send failure:coercing to Unicode: need string or buffer, 
lazyT found

This is running on GAE locally. It works fine for a welcome email and for 
"Lost Username".

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection

2013-12-22 Thread Robert Held
Hello,

I have a function in controllers/default.py 
def test_stream():
'''Test the stream output
'''
import cStringIO
stringio = cStringIO.StringIO()
stringio.write('This is the first line.\n')
stringio.write('This is the second line.')

stringio.seek(0)
return response.stream(stringio, attachment=True, request=request,
   filename='test_%s.txt' % 'stream')

When I call it directly over URL 
http://localhost:8000/myapp/default/test_stream all is ok.
But when I call it over a menu which I have in models/menu.py with 
... ('Teststream', False, URL('default', 'test_stream'))...

I get the following error at the console:

ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection:
Traceback (most recent call last):

  File "/home/robert/Projekte/web2py/gluon/rocket.py", line 1337, in run
self.run_app(conn)

  File "/home/robert/Projekte/web2py/gluon/rocket.py", line 1855, in run_app
self.conn.sendall(b('0\r\n\r\n'))

  File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)

error: [Errno 32] Datenübergabe unterbrochen (broken pipe)

Any idea?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection

2013-12-22 Thread Robert Held

I have a function controllers/default.py test_stream.

def test_stream():
'''Test the stream output
'''
import cStringIO
stringio = cStringIO.StringIO()
stringio.write('This is the first line.\n')
stringio.write('This is the second line.')

stringio.seek(0)
return response.stream(stringio, attachment=True, request=request,
   filename='test_%s.txt' % 'stream')

   
When I call it over URL http://localhost:8000/myapp/default/test_stream all 
is ok.

But when I call it over menu with 

... ('Teststream', False, URL('genre', 'test_stream')) ...



I get the following error at the console:

ERROR:Rocket.Errors.Thread-4:Unhandled Error when serving connection:
Traceback (most recent call last):

  File "/home/robert/Projekte/web2py/gluon/rocket.py", line 1337, in run
self.run_app(conn)

  File "/home/robert/Projekte/web2py/gluon/rocket.py", line 1855, in run_app
self.conn.sendall(b('0\r\n\r\n'))

  File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)

error: [Errno 32] Datenübergabe unterbrochen (broken pipe)

Any idea?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] question about SQLFORM.grid

2014-01-03 Thread Robert Bjornson
Hi all,

I am a newcomer to web2py, and have what I hope is a simple beginner 
question.

I am following the "mywiki" example in the getting started tutorial. In it, 
one can display all the documents for a page
using this url:

*http://127.0.0.1:8000/mywiki/default/documents/1*

*The controller for this page creates a SQLFORM.grid, using this code:*







*def documents(): """browser, edit all documents attached to a certain 
page""" page = db.page(request.args(0,cast=int)) or 
redirect(URL('index')) db.document.page_id.default = page.id
 db.document.page_id.writable = False grid = 
SQLFORM.grid(db.document.page_id==page.id,args=[page.id]) return 
dict(page=page, grid=grid)When the page is rendered by the view, each row 
in the grid, representing a document, has three buttons: view, edit, 
delete.If I look at the action for these buttons I see that they are 
refinements of my current url.  For example edit 
is:http://127.0.0.1:8000/mywiki/default/documents/1/edit/document/1?_signature=75f1c501a80734585179ab4cafd9a8ac90ee7a51I
 
don't understand how this url is getting dispatched.  I would think it 
would go to default.py/documents(), with an args list of [1, edit,document, 
1], and vars of {"_signature:75f1c501a80734585179ab4cafd9a8ac90ee7a51}But, 
I don't see any code in documents() that would handle this is the 
appropriate way.  From the page I end up on when I click edit, it seems 
like it's dispatching to mywiki/controllers/appadmin.py.  I can't figure 
out why it gets there.Thanks for your help.Rob *


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] using CAS

2014-01-16 Thread Robert Bjornson
Hi,

I'm trying to use our university CAS server as the authentication for my 
web2py app.  I am able to direct logins to CAS fine, by using this code in 
my model file:

auth=Auth(db, cas_provider='https://securedev.its.yale.edu/cas')

After completing the cas login, when I look at db.auth_user table, or 
session.auth.user, only auth_user.registration_id has a value, which is 
https://securedev.its.yale.edu/cas/rdb9. 

If I do subsequent logins using the same login name, web2py finds the 
existing user entry and gives me that id.  So far so good.

My question is, how can I cleanly fill in the other fields of the user 
entry (things like firstname, lastname, etc.).  I can pull them from my 
local ldap
server using the login name.  But, what is the clean way to push them into 
the database when the record is first created?  Is there a callback to 
login that I can use for this?

Thanks,

Rob

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: using CAS

2014-01-16 Thread Robert Bjornson
Hi Massimo,

Thanks for the reply.  I'm still not certain the best place to do this.  Is 
there a callback within the login processing where I can stick this code, 
or should I use _next in the CAS redirect to go to a controller that will 
do this?  

Thanks,

Rob


On Thursday, January 16, 2014 5:17:26 PM UTC-5, Massimo Di Pierro wrote:
>
> You can do
>
> if auth.user and not auth.user.first_name:
>  pull them from ldap and store them in auth.user
>
> On Thursday, 16 January 2014 16:10:18 UTC-6, Robert Bjornson wrote:
>>
>> Hi,
>>
>> I'm trying to use our university CAS server as the authentication for my 
>> web2py app.  I am able to direct logins to CAS fine, by using this code in 
>> my model file:
>>
>> auth=Auth(db, cas_provider='https://securedev.its.yale.edu/cas')
>>
>> After completing the cas login, when I look at db.auth_user table, or 
>> session.auth.user, only auth_user.registration_id has a value, which is 
>> https://securedev.its.yale.edu/cas/rdb9. 
>>
>> If I do subsequent logins using the same login name, web2py finds the 
>> existing user entry and gives me that id.  So far so good.
>>
>> My question is, how can I cleanly fill in the other fields of the user 
>> entry (things like firstname, lastname, etc.).  I can pull them from my 
>> local ldap
>> server using the login name.  But, what is the clean way to push them 
>> into the database when the record is first created?  Is there a callback to 
>> login that I can use for this?
>>
>> Thanks,
>>
>> Rob
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to increase the number of open forms that can be submitted (from 10) ?

2016-04-28 Thread Robert Pates
I have inherited a very nice clinical trials randomization module written 
in web2py (2.9.5)  and have been asked to modify it to accommodate a new 
clinical study.
The application features a screen to display all the randomization strata 
in a list on the screen -- each stratum generates a form using 
SQLFORM.factory and these are written to a python dictionary and processed 
in a loop:

if form.process(formname='form1').accepted:

Up to this point the clinical studies have had few strata (< 10).  This 
latest study, however, has N=16 strata.  Everything looked fine until I 
checked the functioning of all the 16 forms and found that some worked 
(i.e. were accepted) and some didn't.  Then, after debugging into html.py 
(accepts function) I noticed that there were only 10 formkeys represented 
in the session at any one time.  Then, after much ado I found this post:

http://comments.gmane.org/gmane.comp.python.web2py/129006
in which Anthony explains that, indeed the formkey list in the session 
holds 10 rotating entries.

I'm wondering what my best options are to address this issue -- I'm 
somewhat at a loss.  Another post I found indicated that the following 
snippet from html.py accepts function generates the formkey list in the 
session:

session[keyname] = list(session.get(keyname,[]))[-9:] + [formkey]

So just for fun I altered the "-9" to "-15" and now everything appears to 
work fine.

I have trouble believing that tampering with web2py code is a reasonable 
approach -- is this change likely to break web2py?  Why is the limit set at 
10 entries by default?  By now you have probably gathered I am new to 
web2py.  Any comments would be welcome.

Thanks --

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Reverse Groupby with Join Bug?

2018-08-27 Thread Robert Porter
I'm trying to do a groupby that gets the last entry for each item checked 
out by a user from db.checkout (i.e. they've checked it out multiple times, 
but I just want the last entry).  I then want to join on db.item.

db.checkout:
user_id
item_id (reference item)

db.item:
item_name

WITHOUT the join works perfectly, giving me the last entry for each item 
checked out by this user:

db(db.checkout.user_id == 1).select(groupby=~db.checkout.item_id)

But WITH the join, it groups by the FIRST checkout entry for each item_id 
for this user (although it *displays* those groups in reverse item_id 
order):

db((db.checkout.user_id == 1) &
   (db.item.id == db.checkout.item_id)).select(groupby=~db.checkout.item_id)

What am I missing?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Reverse Groupby with Join Bug?

2018-08-27 Thread Robert Porter
I'm using GoogleSQL.  DAL sometimes seems to have some nuances there 
compared to MySQL.  I think your suggestion will probably work.  I was just 
as confused at the ~ operator working in groupby as you!

Thanks!

On Monday, 27 August 2018 20:21:22 UTC-7, Anthony wrote:
>
> WITHOUT the join works perfectly, giving me the last entry for each item 
>> checked out by this user:
>>
>> db(db.checkout.user_id == 1).select(groupby=~db.checkout.item_id)
>>
>  
> What database are you using? The ~ operator is for adding "DESC" to an 
> "ORDER BY" clause -- it is not relevant to "GROUP BY" and should be 
> generating an error. Also, to get the most recent record for each item_id, 
> you would want to order by the "id" field (or a datetime field), not the 
> "item_id" field (you are grouping by item_id, so you want to order records 
> within item_id groups and select the most recent). In any case, if you are 
> getting the records you want, it is probably by chance.
>
> Instead, you probably want something like:
>
> max_id_per_item = db(db.checkout)._select(db.checkout.id.max(), groupby=db
> .checkout.item_id)
> rows = db((db.checkout.user_id == 1) &
>   (db.checkout.item_id == db.item.id) &
>   db.checkout.id.belongs(max_id_per_item)).select()
>
> Above, max_id_per_item selects the maximum id within each item_id, and it 
> is used in a nested select (see 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#belongs)
>  
> to select only those records from db.checkout.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Does the latest version of web2py still not allow us to specify key field as UUID ?

2019-04-14 Thread Robert Gilbert
I am using the latest version of web2py and want to implement UUID as my 
primary Key.
Just checking if I still have to use a workaround and create a separate 
uuid field while web2py uses an internal ID (integer) field as record 
identifier ?

Longing for the day when we have a choice in Models to specify whether key 
field is integer (AUTOINC) or varchar (UUID).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Python version in web2py console says 3.7 but 2.7 in the web console settings

2019-05-13 Thread Robert Rice
I am testing OpenCV and need version 2.7 and that is what the site version 
says (2.7.12).
I updated the default.py for this new website and it failed due to the use 
of python v 2.7 classes.
Whats up?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ebc364db-281a-4859-be58-6c61f41d6fae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Can I simulate multiple user logins to web2py from a single computer?

2014-05-04 Thread Robert Kooij
Or if you want to keep it even simpler, just use multiple (different) 
browsers, each browser keep track of their own session. 

I assume, as a web developer you have Chrome, Firefox and Safari installed 
anyway? Should be able to simulate 3 different user to start with. :)


On Monday, May 5, 2014 1:35:56 AM UTC+2, Rufus wrote:
>
> Web2py'ers:
>
> I am trying to create a back end for a multiple user game, including, for 
> instance, a chat room function.
> However, when I try to do this locally, all windows change over to the 
> "most recent" login.
>
> That is to say, I open up another window to the app, sign in with a 
> different user id, and type.into
> the chat app, and get the new message.  But if I go to one of the other 
> "formerly signed in" windows
> and try to chat, it submits as most recently logged in user.
>
> Can I have multiple sessions/log ins from a single computer?
>
> This may be a security issue, but would be useful for testing if it could 
> be overridden, even temporarily.
>
> Rufus
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error when trying to use Google Cloud SQL

2017-05-03 Thread Robert Porter
Ah, I see your errors show "C:", so that has to be the output from the 
local Google Cloud instance on Windows.  Can you show the error message 
from the Google Cloud server logs (after you've deployed the app)?  When I 
tried to recreate the error in the cloud, it worked fine (unfortunately).

If it's a problem on Mac and Windows, maybe the developers are only testing 
GAE locally on Linux...


On Tuesday, 2 May 2017 20:59:00 UTC-7, webm...@trytha.com wrote:
>
> Are you using OSX?  I have the same error and am trying to track down the 
> problem.  Right now I think it might be something specific to macs.
>
> On Tuesday, April 25, 2017 at 7:33:01 AM UTC-7, Jonathan Tomm wrote:
>>
>> I'm struggling to get a basic test app deployed to Google App Engine 
>> using Cloud SQL.
>>
>> 1. I cloned web2py of github two days ago.
>>
>> 2. I created a Google Cloud SQL instance.
>>
>> 3. I created a new sample app called "SQL" using the web2py admin 
>> interface.
>>
>> 4. On the new app, I changed the following line in db.py
>>
>> db = DAL('google:datastore+ndb')
>>
>> to
>>
>> db = DAL('google:sql://web2py-test-165504:my-sql-instance/mysql')
>>
>> 5. I deployed web2py to GAE:
>>
>> gcloud app deploy --project web2py-test-165504
>>
>> After deployment, I can view the Welcome app no problem, since it is 
>> using Datastore. But when I go to my app called "SQL", I get an error.
>>
>> Here is the traceback:
>>
>> ERROR2017-04-24 22:51:17,829 restricted.py:171] Traceback (most 
>> recent call last):
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\restricted.py",
>>  
>> line 216, in restricted
>> exec(ccode, environment)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\applications\SQL\models\db.py",
>>  
>> line 39, in 
>> db1 = DAL('google:sql://root:web2py-test-165504/mydatabase')
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\base.py",
>>  
>> line 170, in __call__
>> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\base.py",
>>  
>> line 475, in __init__
>> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
>> RuntimeError: Failure to connect, tried 5 times:
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\base.py",
>>  
>> line 455, in __init__
>> self._adapter = adapter(**kwargs)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\__init__.py",
>>  
>> line 40, in __call__
>> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\google.py",
>>  
>> line 40, in __init__
>> super(GoogleSQL, self).__init__(*args, **kwargs)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\base.py",
>>  
>> line 367, in __init__
>> super(SQLAdapter, self).__init__(*args, **kwargs)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\base.py",
>>  
>> line 50, in __init__
>> self._initialize_(do_connect)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\google.py",
>>  
>> line 49, in _initialize_
>> super(MySQL, self)._initialize_(do_connect)
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\base.py",
>>  
>> line 63, in _initialize_
>> self._find_work_folder()
>>   File 
>> "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\google.py",
>>  
>> line 44, in _find_work_folder
>> super(GoogleSQL)._find_work_folder()
>> AttributeError: 'super' object has no attribute '_find_work_folder'
>>
>>
>> I've also tried connecting to a local MySQL server following Massimo's 
>> directions here: 
>> https://groups.google.com/forum/#!topic/web2py/SJJBp1dq7VU
>>
>> When I do, I get exactly the same error.
>>
>> Any help would be appreciated!
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] request.requires_https() while using taskqueue.add() in GAE possible?

2017-09-17 Thread Robert Porter
If I use Google's taskqueue.add(), it keeps giving me a 303 error over and 
over in the logs because it tries to use the HTTP version of the page the 
POST is sent to, but I have request.requires_https() in my db.py.  I can't 
find a way for taskqueue to attempt an HTTPS connection.

Removing request.requires_https() solves the issue, but isn't quite ideal.

Anyone know a way around this?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to display Google Maps (iFrame?)

2015-06-01 Thread Robert Porter
I've been beating my head against this for two days, so I'm sorry if it's a 
dumb question, but I'm really lost.

I have googleplaces working and giving me lat/lon data without any problem. 
 Now I want to display this data on a Google Map using web2py.  Am I forced 
to use something like gmaps.js?  I was hoping to handle everything in my 
controller, not an external JS library.

I've tried pygmaps (https://code.google.com/p/pygmaps/) but it is designed 
to output an html file as in its example code below.  So how do I get that 
to export into an iframe in one of my views?  I was thinking something like 
IFRAME(_src='mymap.html'), but that doesn't work...

mymap = pygmaps.maps(37.428, -122.145, 16)
mymap.setgrids(37.42, 37.43, 0.001, -122.15, -122.14, 0.001)
mymap.addpoint(37.427, -122.145, "#FF", 'title')
# mymap.addradpoint(37.429, -122.145, 95, "#FF","my-location")
path = [(37.429, -122.145),(37.428, -122.145),(37.427, -122.145),(37.427, 
-122.146),(37.427, -122.146)]
mymap.addpath(path,"#00FF00")
mymap.draw('./mymap.html')

Or am I going about this all wrong?  I want to display multiple points on a 
single map.  I didn't think it would be this difficult.  I promise, if 
someone helps me figure this thing out, I'll make a nice tutorial so future 
users will have something easy to reference.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: My son made a new web2py logo

2015-06-01 Thread Robert Porter
Then again, combining a capital "W" and the roman numeral "II" has a pretty 
specific meaning for most of the world.

On Monday, 1 June 2015 11:06:16 UTC-7, Massimo Di Pierro wrote:
>
> Time to revamp the web site?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: My son made a new web2py logo

2015-06-01 Thread Robert Porter
You could almost combine the "/ /" of the "W" with the "II" and the pi 
symbol into one character.

On Monday, 1 June 2015 11:06:16 UTC-7, Massimo Di Pierro wrote:
>
> Time to revamp the web site?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to display Google Maps (iFrame?)

2015-06-04 Thread Robert Porter
That sounds like maybe a good idea if I knew how to do that..  So I'll go 
look into it!  Thanks!

On Monday, 1 June 2015 17:04:24 UTC-7, 黄祥 wrote:
>
> just an idea, why not use components for google maps?
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to display Google Maps (iFrame?)

2015-06-15 Thread Robert Porter


On Friday, 5 June 2015 06:28:54 UTC-7, 黄祥 wrote:
>
> please take a look at web2py book about components and plugins
> ref:
>
> http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components--LOAD-and-Ajax
>
> best regards,
> stifan
>

Thanks to both of you.  This was very helpful 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Peculiar behavior of request.vars inside URL() (BUG?)

2015-06-28 Thread Robert Porter
I have lat/lng coordinates in my request.vars['coords'] saved with a '|' 
separating each coordinate.  When I use URL(request.vars['coords']), it 
converts the '|' into '%7C'.

This seems like a web2py error, but please let me know if I've made a 
mistake.  And please let me know if there's some workaround.

Thanks!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Only one table fails to create in MySQL... and there's nothing special about it.

2015-06-29 Thread Robert Porter
I got everything working fine at home on my Ubuntu 14.04 server.  Then I 
did a git push to pythonanywhere.com.  Web2py created all my new tables 
except for one, and it continues to fail to create this table.  Tech 
support at pythonanywhere can't find the problem.

Here's my table that is having problems:

db.define_table('restaurants',
Field('place_id', 'text', required=True),
Field('place_name', 'text'),
Field('rest_lat', 'text'),
Field('rest_lng', 'text'))

I can take off the "required=True" but that doesn't help.  Here's the error 
chain:

 (1146, "Table 
'trytha$test.restaurants' doesn't exist")

Traceback (most recent call last):
  File "/var/www/sites/trytha/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/var/www/sites/trytha/applications/trytha/models/db.py", line 112, 
in 
Field('rest_lng', 'text'))
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/base.py", line 817, 
in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/base.py", line 856, 
in lazy_define_table
polymodel=polymodel)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
line 491, in create_table
fake_migrate=fake_migrate
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
line 604, in migrate_table
self.execute(sub_query)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
line 1326, in execute
return self.log_execute(*a, **b)
  File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
line 1320, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 
205, in execute
self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", 
line 36, in defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1146, "Table 'trytha$test.restaurants' doesn't exist")


Since this works at home, it's obviously a pythonanywhere problem, but they 
requested I ask you guys for help troubleshooting it.

So here's my question:  Anyone know a good web hosting company for Web2py? 
 I really just need vanilla Ubuntu on a server.  Alternatively, if you can 
figure out the error, that might work too, but given pythonanywhere's weird 
MySQL requirement of having your username as part of your DB name caused an 
hour of annoyance when I set everything up the first time, I'm not keen on 
giving them many more chances.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Peculiar behavior of request.vars inside URL() (BUG?)

2015-06-29 Thread Robert Porter
For now, I'm just separating my coordinates with a letter of the alphabet, 
since it doesn't make any difference.  I'll try to give this a shot when I 
get home.  Thanks!

On Sunday, 28 June 2015 16:14:31 UTC-7, villas wrote:
>
> Hi Robert,  
> I think args and vars are all url encoded.  
> I think I worked around it with urllib.unquote( string ) when I hit this 
> problem.
> Regards,  D
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Only one table fails to create in MySQL... and there's nothing special about it.

2015-06-30 Thread Robert Porter
Thanks, that seems to have fixed it.  I'd actually checked there 
(nominally), but since pythonanywhere holds its bare-repositories in a 
folder tree outside of its normal web2py folder structure, it was a bit 
confusing.

On Monday, 29 June 2015 11:53:57 UTC-7, Niphlod wrote:
>
> usually it's not rocket science.. do you have a 
> databases/***_restaurants.table in your databases folder ?
> if yes, drop it and go to the appadmin controller to recreate it. 
> From the error it seems that web2py is trying to migrate a table that is 
> not on the backend but it's supposed to be there (because of a 
> corresponding .table file found on the folder)
>
> On Monday, June 29, 2015 at 8:37:41 PM UTC+2, Robert Porter wrote:
>>
>> I got everything working fine at home on my Ubuntu 14.04 server.  Then I 
>> did a git push to pythonanywhere.com.  Web2py created all my new tables 
>> except for one, and it continues to fail to create this table.  Tech 
>> support at pythonanywhere can't find the problem.
>>
>> Here's my table that is having problems:
>>
>> db.define_table('restaurants',
>> Field('place_id', 'text', required=True),
>> Field('place_name', 'text'),
>> Field('rest_lat', 'text'),
>> Field('rest_lng', 'text'))
>>
>> I can take off the "required=True" but that doesn't help.  Here's the 
>> error chain:
>>
>>  (1146, "Table 
>> 'trytha$test.restaurants' doesn't exist")
>>
>> Traceback (most recent call last):
>>   File "/var/www/sites/trytha/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File "/var/www/sites/trytha/applications/trytha/models/db.py", line 
>> 112, in 
>> Field('rest_lng', 'text'))
>>   File "/var/www/sites/trytha/gluon/packages/dal/pydal/base.py", line 
>> 817, in define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>>   File "/var/www/sites/trytha/gluon/packages/dal/pydal/base.py", line 
>> 856, in lazy_define_table
>> polymodel=polymodel)
>>   File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
>> line 491, in create_table
>> fake_migrate=fake_migrate
>>   File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
>> line 604, in migrate_table
>> self.execute(sub_query)
>>   File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
>> line 1326, in execute
>> return self.log_execute(*a, **b)
>>   File "/var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py", 
>> line 1320, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 
>> 205, in execute
>> self.errorhandler(self, exc, value)
>>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", 
>> line 36, in defaulterrorhandler
>> raise errorclass, errorvalue
>> ProgrammingError: (1146, "Table 'trytha$test.restaurants' doesn't exist")
>>
>>
>> Since this works at home, it's obviously a pythonanywhere problem, but 
>> they requested I ask you guys for help troubleshooting it.
>>
>> So here's my question:  Anyone know a good web hosting company for 
>> Web2py?  I really just need vanilla Ubuntu on a server.  Alternatively, if 
>> you can figure out the error, that might work too, but given 
>> pythonanywhere's weird MySQL requirement of having your username as part of 
>> your DB name caused an hour of annoyance when I set everything up the first 
>> time, I'm not keen on giving them many more chances.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: as_dict() on a row fails when connected to MySQL on Amazon RDS

2015-07-03 Thread Robert Porter
Could you show your DB code for reference?  And you should jump in appadmin 
to check just what has been uploaded to the DB to be sure.

On Wednesday, 1 July 2015 07:01:19 UTC-7, Sean Ballow wrote:
>
> We are connecting successfully to MySQL on RDS
>
> And when attempting to insert a new record it appears to properly insert 
> into the database and we receive an ID back, for instance
>
> result = db.foo.insert(myfield='blah')
>
> print result
> >> 1
>
> The problem occurs when performing the following after successfully 
> inserting a record and committing it
>
> result.as_dict()
> >> TypeError: 'NoneType' object is not callable
>
> result is a ROW instance and the following continues to work
>
> print result.id
> >> 1
>
> however as_dict() fails only when connected to MySQL on RDS and not when 
> using the MySQL local instance
>
> Oddly enough when I use the same application connected to a locally 
> running instance of MySQL we do not receive the exception and everything 
> works as desired.
>
> Any ideas what may be causing the disparity between a connection to a 
> local MySQL instance and a MySQL RDS instance? I have compared system 
> variables between both databases and was unable to identify a problem
>
> Thanks for your help
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Form upload troubles when AJAX=True on component

2015-07-03 Thread Robert Porter
This first part works fine on its own.  It's when I try to make this part 
of an AJAX component inside another page that it fails.

Model:
db.define_table('temp_pics',
Field('image', 'upload', required=True, notnull=True, requires=IS_IMAGE()))

Controller:
# This will reload itself and allow changing the photo after submission.
def upload_temp():
record = db.temp_pics(request.args(0))
pic_upload = SQLFORM(db.temp_pics, record, upload=URL('download'))
if pic_upload.process(formname='pic_upload').accepted:
id = pic_upload.vars.id
redirect(URL('upload_temp', args=id),client_side=True)
return dict(pic_upload=pic_upload)

View:
{{=pic_upload}}

Now I want to put this in a different view using:
{{=LOAD('default', 'upload_temp','upload_temp.load',ajax=True)}}

If I set ajax=False, it will work, but reload the whole page, which fully 
defeats the purpose.

Somewhere you need to have this script referenced (and you'll have to 
download that script online first):
src="{{=URL('static', 'js/jquery.form.js')}}"

And in the default/upload_temp.html (and identical upload_temp.LOAD), you 
need to have this:

{{=pic_upload}}

//