[web2py] Re: duplicate ids on using auth.login and auth.register forms on same page

2010-05-12 Thread Rohan
i am using latest version 1.77.3 (2010-04-20 02:48:54)

On May 12, 8:29 pm, mdipierro  wrote:
> This was fixed. What version of web2py are you using?
>
> On May 12, 5:51 am, Rohan  wrote:
>
>
>
> >  I am using auth.login and auth.register forms on a single page and it
> > is resulting in duplicate ids for email and password rows.
> > similar discussions were going on this 
> > threadhttp://groups.google.com/group/web2py/browse_frm/thread/e43c1203d8749630
> > Is there any update on this?


[web2py] Re: duplicate ids on using auth.login and auth.register forms on same page

2010-05-12 Thread Rohan
i am using  latest version 1.77.3 (2010-04-20 02:48:54)

On May 12, 8:29 pm, mdipierro  wrote:
> This was fixed. What version of web2py are you using?
>
> On May 12, 5:51 am, Rohan  wrote:
>
>
>
> >  I am using auth.login and auth.register forms on a single page and it
> > is resulting in duplicate ids for email and password rows.
> > similar discussions were going on this 
> > threadhttp://groups.google.com/group/web2py/browse_frm/thread/e43c1203d8749630
> > Is there any update on this?


[web2py] Re: ORM-like DAL

2010-05-12 Thread vihang
Maybe we could inherit in some way, but I need to inherit a bunch.
Hence it does not help.

On May 12, 8:08 pm, Thadeus Burgess  wrote:
> VirtualFields?
>
> --
> Thadeus
>
> On Tue, May 11, 2010 at 11:59 PM, vihang  wrote:
> > Some of the apps I am working currently are much more easy to build if
> > the models can be defined as a class with methods that act on them.
>
> > On May 12, 5:51 am, Álvaro Justen  wrote:
> >> On Tue, May 11, 2010 at 21:38, Richard  wrote:
> >> > there was a discussion about this on the developers mailing list last
> >> > week:
> >> >http://groups.google.com/group/web2py-developers/browse_thread/thread...
>
> >> Yes, started by me.
>
> >> > On May 7, 12:50 am, vihang  wrote:
> >> >> Hello,
>
> >> >> A long time back, someone (mostly probably massimo) had written a few
> >> >> lines of code showing how DAL could be extended to be used in class,
> >> >> and effective like ORM. I have spent a lot of time searching for this
> >> >> on this group, but unable to find it. Any help would be appreciated.
>
> >> vihang, why do you want an ORM? :)
>
> >> >> Thanks
> >> >> Vihang
>
> >> --
> >> Álvaro Justen - Turicas
> >>  http://blog.justen.eng.br/
> >>  21 9898-0141


[web2py] Re: ORM-like DAL

2010-05-12 Thread vihang
Cannot inherit virtualfields

On May 12, 8:08 pm, Thadeus Burgess  wrote:
> VirtualFields?
>
> --
> Thadeus
>
> On Tue, May 11, 2010 at 11:59 PM, vihang  wrote:
> > Some of the apps I am working currently are much more easy to build if
> > the models can be defined as a class with methods that act on them.
>
> > On May 12, 5:51 am, Álvaro Justen  wrote:
> >> On Tue, May 11, 2010 at 21:38, Richard  wrote:
> >> > there was a discussion about this on the developers mailing list last
> >> > week:
> >> >http://groups.google.com/group/web2py-developers/browse_thread/thread...
>
> >> Yes, started by me.
>
> >> > On May 7, 12:50 am, vihang  wrote:
> >> >> Hello,
>
> >> >> A long time back, someone (mostly probably massimo) had written a few
> >> >> lines of code showing how DAL could be extended to be used in class,
> >> >> and effective like ORM. I have spent a lot of time searching for this
> >> >> on this group, but unable to find it. Any help would be appreciated.
>
> >> vihang, why do you want an ORM? :)
>
> >> >> Thanks
> >> >> Vihang
>
> >> --
> >> Álvaro Justen - Turicas
> >>  http://blog.justen.eng.br/
> >>  21 9898-0141


[web2py] Django GenericForeignKey

2010-05-12 Thread vihang
Hello,

would anyone know how would one implement GenericForeignKey using
DAL??

Thanks
Vihang


[web2py] Re: amfast rtmp example

2010-05-12 Thread Dane
Did you see the example of producer/consumer messaging on GAE? That's
killer.

On May 11, 12:26 am, mdipierro  wrote:
> you can already use pyqmf with web2py. I am not sure about rtmp. It is
> not a protocol that should be encouraged. http already provide range
> requests/partial content for streaming and it is not a proprietary
> protocol.
>
> Massimo
>
> On May 10, 11:21 pm, elffikk  wrote:
>
> > will it be hard to add this in 
> > web2py?http://code.google.com/p/amfast/source/browse/#svn/trunk/examples/mes...
>
> > or it is again a question for Tim? :)


[web2py] Re: Routes.py on GAE

2010-05-12 Thread Dane
Looks like same problem I've been having.

On May 10, 5:23 pm, Chris S  wrote:
> Does routes.py work on GAE?  I've recently deployed an app which used
> the 5-line routes.py from the book for routing robots.txt and
> favicon.icon.  I just wanted to get rid of that 100% error rate on
> those two files.  I recevied the following message.  Only after
> removing routes.py again did the app launch properly.
>
> begin error message
> #
> 05-10 01:18PM 34.771
> unable to import Rocket
>
> #
> E 05-10 01:18PM 34.774
> Your routes.py has a syntax error. Please fix it before you restart
> web2py
>
> #
> E 05-10 01:18PM 34.778
> : invalid syntax (, line 3)
> Traceback (most recent call last):
>   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> gaehandler.py", line 44, in 
>     import gluon.main
>   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> gluon/main.py", line 66, in 
>     rewrite.load()
>   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> gluon/rewrite.py", line 63, in load
>     raise e


[web2py] Re: jquery libraries

2010-05-12 Thread MaxDoesPython
When in a datepicker cell without opening the calendar you can enter
+ / - to increment or decrement the date. My application is using
slickgrid for data entry, and there will be date columns that on
adding a newrow to the grid will default to previous row, and in some
cases the user may want to simply go to the next or previous day
without typing the entire date or having to mouse the calendar open
and then use arrow to get to next day. This would be the same if
datepicker is used on normal form too.

When I get things sorted out I will be happy to make the code needed
to integrate slick grid into web2py available.

max


On May 12, 11:33 am, mdipierro  wrote:
> datepicker only depends on jquery base. What features did you add?
>
> On May 12, 1:23 pm, MaxDoesPython  wrote:
>
> > I have added a feature to jquery datepicker and need to integrate it
> > into the js libraries that are loaded, so need to know what is
> > included in jquery-ui.custom. I will be using latest jquery libs so
> > can you tell me if I need to also get corresponding libs for rule and
> > event.drag.custom and any other relevant details.
>
> > max


[web2py] Re: Why not session['key'] ?

2010-05-12 Thread mdipierro
You can create it in the view in web2py. It is not a good idea. It
would not be visible in the model and controller until reload.

On May 12, 11:20 pm, ionel  wrote:
> Yes, you are right! I was creating the session variable in the View,
> not in the Controller.
> Oh, poor me! This is my ASP background. There I can create a session
> variable anywhere.
> Thanks.
>
> ionel
>
> On May 13, 12:02 am, Thadeus Burgess  wrote:
>
> > session['fav_color'] = "blue" works just fine.
>
> > session is just a gluon/storage.Storage() class. which is a subclass
> > of "dict" and it only provides an extra method to give you the
> > attribute access to make things easier. Otherwise works exactly like
> > any other python dictionary.
>
> > You can use the session object EXACTLY like in django.
>
> > You CAN create dynamic session variables just as long as your keys are
> > valid in that use... your just doing something wrong, may we see your
> > code that is causing the exception?
>
> > --
> > Thadeus
>
> > On Wed, May 12, 2010 at 10:48 PM, ionel  wrote:
> > > r frameworks and django also do th


[web2py] Re: Why not session['key'] ?

2010-05-12 Thread ionel
Yes, you are right! I was creating the session variable in the View,
not in the Controller.
Oh, poor me! This is my ASP background. There I can create a session
variable anywhere.
Thanks.

ionel


On May 13, 12:02 am, Thadeus Burgess  wrote:
> session['fav_color'] = "blue" works just fine.
>
> session is just a gluon/storage.Storage() class. which is a subclass
> of "dict" and it only provides an extra method to give you the
> attribute access to make things easier. Otherwise works exactly like
> any other python dictionary.
>
> You can use the session object EXACTLY like in django.
>
> You CAN create dynamic session variables just as long as your keys are
> valid in that use... your just doing something wrong, may we see your
> code that is causing the exception?
>
> --
> Thadeus
>
> On Wed, May 12, 2010 at 10:48 PM, ionel  wrote:
> > r frameworks and django also do th


[web2py] Re: Problem with IS_URL

2010-05-12 Thread mdipierro
They and synonymous but IS_EMPTY_OR is the newer syntax, more
coherent.

On May 12, 11:05 pm, weheh  wrote:
> OK, I'm seeing IS_EMPTY_OR in the online doc. Sorry, I've been away
> from my desk for a few weeks. Is IS_NULL_OR deprecated? (Or does it
> depend on what the meaning of IS is? ;^)
>
> On May 13, 12:00 am, weheh  wrote:
>
> > Jonathan: Is this something new? Isn't this the way to do it?
>
> > IS_NULL_OR(IS_URL())


[web2py] Re: Problem with IS_URL

2010-05-12 Thread weheh
OK, I'm seeing IS_EMPTY_OR in the online doc. Sorry, I've been away
from my desk for a few weeks. Is IS_NULL_OR deprecated? (Or does it
depend on what the meaning of IS is? ;^)

On May 13, 12:00 am, weheh  wrote:
> Jonathan: Is this something new? Isn't this the way to do it?
>
> IS_NULL_OR(IS_URL())


[web2py] Re: Auth not showing all my custome feilds...

2010-05-12 Thread mdipierro
Not sure this should have ever worked. It needs

This:
self.settings.table_user = db.users
should be:
self.settings.table_user_name = 'users'

Honestly I have not tested much what happens if you rename the
auth_user table. Please let us know if you encouter ther problems.


On May 12, 10:19 pm, Jason Brower  wrote:
> It used to work back in the day.  But it doesn't seem to be working now.
> Any idea on what I would be doing wrong?
> This is my model and the view is below when I try to register.  As you
> can see they don't go together. :/ For example, I should have university
> affiliation there in the view. Any ideas what I did wrong here?
> ---
> Best Regards,
> Jason Brower
>
>  Screenshot.png
> 117KViewDownload
>
>  example-db.py
> 2KViewDownload


Re: [web2py] Re: Why not session['key'] ?

2010-05-12 Thread Thadeus Burgess
session['fav_color'] = "blue" works just fine.

session is just a gluon/storage.Storage() class. which is a subclass
of "dict" and it only provides an extra method to give you the
attribute access to make things easier. Otherwise works exactly like
any other python dictionary.

You can use the session object EXACTLY like in django.

You CAN create dynamic session variables just as long as your keys are
valid in that use... your just doing something wrong, may we see your
code that is causing the exception?

--
Thadeus





On Wed, May 12, 2010 at 10:48 PM, ionel  wrote:
> r frameworks and django also do th


[web2py] Re: Problem with IS_URL

2010-05-12 Thread weheh
Jonathan: Is this something new? Isn't this the way to do it?

IS_NULL_OR(IS_URL())


[web2py] Re: Why not session['key'] ?

2010-05-12 Thread ionel
Ok, I understand. I create a session variable with

session.my_var = "some content"

but not with session['some_id'] = "some content" (web2py will raise an
exception if the session variable does not exists), and I get the
content with

another_var = session.my_var
or
another_var = session['my_var']

Anyway, my_var is a hard coded key in this situation. I cannot create
dynamically session variables. I think this is not a good practice.

All other frameworks and django also do this.

http://www.djangobook.com/en/2.0/chapter14/
--
# Set a session value:
request.session["fav_color"] = "blue"
--

ionel



On May 9, 12:49 pm, Thadeus Burgess  wrote:
> session['views'] = views  is valid. This is because you are
> setting(creating) a key, not getting it.
>
> You can do...
>
> some_id = 'my_id'
> session[some_id] = 'some content'
>
> and it will work just fine.
>
> --
> Thadeus
>
> On Sun, May 9, 2010 at 8:06 AM, ionel  wrote:
> > But anyway, I have an ASP.NET background. Session["key"] = value is
> > normal.
> > In PHP also: $_SESSION['views'] = $value;
>
> > I see this as a limitation because I cannot persist an object into a
> > session( if the session file it's not created) with a variable as key.
> > For example:
>
> > some_id = 'my_id'
> > session[some_id] = 'some content'
>
> > But I think, I need to learn the python way :)
>
> > i
>
> > On May 9, 8:47 am, ionel  wrote:
> >> Thank you.
> >> I didn't know :) I'm still a python noob, I think.
>
> >> On May 9, 2:03 am, Thadeus Burgess  wrote:
>
> >> > The reason is
>
> >> > session.button1 returns None if the key is not found whereas
> >> > session['button1'] raises an exception when the key is not found.
>
> >> > This is typically python behavior.
>
> >> > --
> >> > Thadeus
>
> >> > On Sat, May 8, 2010 at 11:44 PM, ionel  wrote:
> >> > > I think I found a bug.
>
> >> > > Traceback (most recent call last):
> >> > >  File "G:\dev\proj\python\web2py\gluon\restricted.py", line 178, in
> >> > > restricted
> >> > >    exec ccode in environment
> >> > >  File "G:\dev\proj\python\web2py\applications\myapp/views\default/
> >> > > index.html", line 97, in 
> >> > >  KeyError: 'button1'
>
> >> > > If you don't have any session file in the session folder
> >> > > session['button1'] it is not working, but session.button1 it does.
> >> > > You need to delete all the session files to replicate the bug.
>
> >> > > Thanks.
>
> >> > > ionel
>
> >> > > On May 9, 12:05 am, ionel  wrote:
> >> > >> Mea culpa!
>
> >> > >> Yes, they are equivalent. My key was empty... sorry. I think I'm
> >> > >> tired...
>
> >> > >> Thank you very much.
>
> >> > >> ionel
>
> >> > >> On May 8, 11:27 pm, mdipierro  wrote:
>
> >> > >> > They should be equivalent. Can you show the traceback?
>
> >> > >> > On May 8, 9:54 pm, ionel  wrote:
>
> >> > >> > > But I allready did that... and its working...
>
> >> > >> > > Something like that:
>
> >> > >> > > if not session.c:
> >> > >> > >     c = MyClass()
> >> > >> > >     session.c = c
> >> > >> > > else:
> >> > >> > >     c = session.c
>
> >> > >> > > But my question was why I cannot use session['c'] instead of 
> >> > >> > > session.c
>
> >> > >> > > Thank you!
>
> >> > >> > > i
>
> >> > >> > > On May 8, 9:31 pm, mdipierro  wrote:
>
> >> > >> > > > You cannot store your own classes in the session because the 
> >> > >> > > > session
> >> > >> > > > is retrieved before your own classes are defined. You can only 
> >> > >> > > > store
> >> > >> > > > in session primitive types. You can serialize your objects 
> >> > >> > > > yourself.
>
> >> > >> > > > On May 8, 7:30 pm, ionel  wrote:
>
> >> > >> > > > > Hello,
>
> >> > >> > > > > I'd like to have something like that:
>
> >> > >> > > > > class MyClass():
> >> > >> > > > >    def __init__(self, id)
> >> > >> > > > >        self.id = id
>
> >> > >> > > > > c = MyClass('some_id')
>
> >> > >> > > > > session[c.id] = c
>
> >> > >> > > > > I do not see a solution for this.
> >> > >> > > > > Can somebody help me?
>
> >> > >> > > > > Thanks.
>
> >> > >> > > > > i.


[web2py] Re: Catch and replace vars

2010-05-12 Thread Iceberg
As I said at the end of my previous post: "Of course the latter case
should have better approach. Here I am just demostrating when and when
not to use Field(..., compute=...) "

The point here is I wanna figure out the scenario for all those not-so-
obvious parameters of Field(...), such as compute, authorize, update,
etc. Some answers can be found via google "web2py Field foo", some
don't. And so far the official book seems contain no chapter for that.
[1] is too simple, and [2] is outdated.

[1] http://web2py.com/book/default/section/6/3
[2] http://web2py.com/book/default/docstring/Field

On May12, 11:32pm, mdipierro  wrote:
> Why would you want web2py to auto-compute a field when you have asked
> the user for its value? unless you want the computation BEFORE you
> prompt the user for a value. But in this case it cannot depend on
> other fields because they have not been insrted yet.
>
> On May 12, 9:30 am, Iceberg  wrote:
>
>
>
> > So if I understand it correctly, the Field(..., compute=...) is only
> > suitable for defining a field which is not supposed to be showed in
> > SQLFORM(), neither supposed to be filled by human.
>
> > For example, this case can use Field(..., compute=...).
>
> >     db.define_table('circles',
> >         Field('radius', 'double'),
> >         Field('area', 'double',
> >             compute = lambda record: record['radius']**2*3.14),
> >         )
>
> > And this case should not. (Why? Try.)
>
> >     db.define_table('visitor_booking',
> >         Field('adult', 'integer'),
> >         Field('kid', 'integer',
> >             compute = lambda r: min(r['kid'], r['adult']) ),
> >         # each kid must be accompanied by one dedicated adult
> >         )
>
> > PS: Of course the latter case should have better approach. Here I am
> > just demostrating when and when not to use Field(..., compute=...)
>
> > Regards,
> > iceberg
>
> > On May12, 2:22am, Iceberg  wrote:
>
> > > Thanks for the tip, but there seems some more subtle difference
> > > between form.accepts(..., onvalidation=callback) VS Field('bar',
> > > compute=lambda r:r['foo']).
>
> > > The latter will cause that field no longer showts up in SQLFORM,
> > > because its default self.fields excludes all compute field. Is there
> > > any reason for that?
>
> > > Right now I still have to stick to my form.accepts(...,
> > > onvalidation=callback) approach. :-/
>
> > > Sincerely,
> > > Iceberg
>
> > > On May12, 1:30am, mdipierro  wrote:
>
> > > > Yes but
>
> > > >   Field('bar', compute=lambda r:r['foo'])
>
> > > > not
>
> > > >   Field('bar', compute=lambda r:r.foo)
>
> > > > On May 11, 11:28 am, Iceberg  wrote:
>
> > > > > I must miss the "compute" feature. Now I am picking it up. Would you
> > > > > please confirm whether my understanding is correct?
>
> > > > > The code:
> > > > >         Field('bar', compute=lambda r:r.foo)
> > > > > is an easier equivalent for:
> > > > >         def callback(form): form.vars.bar = form.vars.foo
> > > > >         form.accepts(..., onvalidation=callback)
> > > > > and it only works before inserting or updating a record into db.
>
> > > > > On the contrary, rows.setvirtualfields(...), only works when
> > > > > retrieving records from db. (Detail 
> > > > > inhttp://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
> > > > >  )
>
> > > > > Is it right?
>
> > > > > Regards,
> > > > > iceberg


[web2py] Re: Routes.py on GAE

2010-05-12 Thread Richard
I have a GAE app that successfully uses routes.py, though it was with
an older version of web2py.


On May 11, 7:23 am, Chris S  wrote:
> Does routes.py work on GAE?  I've recently deployed an app which used
> the 5-line routes.py from the book for routing robots.txt and
> favicon.icon.  I just wanted to get rid of that 100% error rate on
> those two files.  I recevied the following message.  Only after
> removing routes.py again did the app launch properly.
>
> begin error message
> #
> 05-10 01:18PM 34.771
> unable to import Rocket
>
> #
> E 05-10 01:18PM 34.774
> Your routes.py has a syntax error. Please fix it before you restart
> web2py
>
> #
> E 05-10 01:18PM 34.778
> : invalid syntax (, line 3)
> Traceback (most recent call last):
>   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> gaehandler.py", line 44, in 
>     import gluon.main
>   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> gluon/main.py", line 66, in 
>     rewrite.load()
>   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> gluon/rewrite.py", line 63, in load
>     raise e


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread JorgeRpo
yeah
bookmarklets are known for like 12 years or so, now.

On May 12, 11:19 am, Adi  wrote:
> Its called a bookmarklet and I believe it was popularized by blogs
> like Wordpress and Tumblr - by clicking their bookmarklet you can
> create a new post for example. We faced a lot of challenge in trying
> to extract embedded video from the server side - because various sites
> use very different mechanisms (javascript, flash, ajax) to render
> embedded videos. That's why we resorted to client-side approach using
> a bookmarklet. Once a page is rendered we can parse the contents and
> grab what we need.
>
> However we will have to figure a way to execute javascript on the
> server side eventually - for example bookmarking a video by right
> clicking a url (without opening the page), something I wish for every
> time I want to queue a video from my twitter feed. Right now I have to
> click the url, open the page and then bookmark.
>
> On May 12, 8:45 pm, mdipierro  wrote:
>
> > I did not know that you can put  javascript in a bookmark instead of
> > simply a URL and when you click on the bookmark the JS code is
> > executed on the page you are currently visiting.


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread JorgeRpo
yeah



On May 12, 11:19 am, Adi  wrote:
> Its called a bookmarklet and I believe it was popularized by blogs
> like Wordpress and Tumblr - by clicking their bookmarklet you can
> create a new post for example. We faced a lot of challenge in trying
> to extract embedded video from the server side - because various sites
> use very different mechanisms (javascript, flash, ajax) to render
> embedded videos. That's why we resorted to client-side approach using
> a bookmarklet. Once a page is rendered we can parse the contents and
> grab what we need.
>
> However we will have to figure a way to execute javascript on the
> server side eventually - for example bookmarking a video by right
> clicking a url (without opening the page), something I wish for every
> time I want to queue a video from my twitter feed. Right now I have to
> click the url, open the page and then bookmark.
>
> On May 12, 8:45 pm, mdipierro  wrote:
>
> > I did not know that you can put  javascript in a bookmark instead of
> > simply a URL and when you click on the bookmark the JS code is
> > executed on the page you are currently visiting.


[web2py] Re: Running a script with Google App Engine

2010-05-12 Thread howesc
Massimo,

yes there are a ton of issues in my example - but it was a run-one-
time upgrade script that i monitored for completionand at the same
time was not overly concerned if a couple of records fell through the
cracks.  all valid and correct points though for building something
that runs repeatedly and is expected to be 100% accurate.  I just
wanted to provide an example of something simple that uses the task
queue to run in a script-like fashion.

and yes, i relied on GAE's retry on fail - even though i catch the
timeout exception sometimes it was not thrown with enough time to save
and re-queue the task before being killed.

re development:  you never get the timeout exception on the
development server either, so it's kinda hard to test all of this
out.  for this one i created a second application in GAE, used the
bulkloader tool to download production data and copy it to my new test
environment, and then tested it there.  i'm sure google does not
approve of this approach though.

cfh

On May 11, 4:30 pm, mdipierro  wrote:
> How safe is this approach? You process 100 records ate the time and
> call the function itself again until done. If this fails for any
> reason (like time constraints imposed by GAE or other GAE db access
> failure), this is not going to call itself again and it will never
> complete. Is it a possibility?
>
> Another issue: your  looping condition is the creation time of the
> record. That works. If the condition where different nothing would
> prevent a new record to be inserted by a different user that would
> fall thought the cracks in the list of records that where already
> processed. This only works for simple queries.
>
> Massimo
>
> On May 11, 5:38 pm, howesc  wrote:
>
> > yes, it applies to the dev environment as well.
>
> > i have not used bulk inserts yet, but they would have to run as a
> > controller that is accessible via URL.  (at least as far as i can
> > tell).  Even the bulkloader.py tool distributed with the SDK talks to
> > a particular app URL and does everything in 30 second chunks.
>
> > here is an example of an upgrade i had to do where i needed to add a
> > new field to the database, and make sure all existing records had a
> > default value for that field (because queries with filters on unset
> > values don't work on google app engine).  I ran it by hitting the URL,
> > and when it ran out of time it just queued itself to keep going.  if
> > you want to cron it look 
> > athttp://code.google.com/appengine/docs/python/config/cron.html
>
> > i put the controller in default.py, so it was accessed at
> > .appspot.com/app/default/task.html
>
> > 
> > def task():
> >     """
> >     today (19-mar-2010) we are going to use this to add
> > processed_audio
> >     field to recordings
> >     """
> >     return
> >     from google.appengine.api.labs import taskqueue
> >     from google.appengine.runtime import DeadlineExceededError
> >     logging.info("in da task")
>
> >     last_id = request.vars.id.split(".")[0]
>
> >     rows = db((db.recording.created_time >=
> > last_id)).select(db.recording.media,
>
> > orderby=db.recording.created_time,
> >                                             limitby=(0, 100))
> >     try:
> >         #update processed_audio
> >         for r in rows:
> >             media_ids = r['media'].split('|')
> >             processed = False
> >             if media_ids:
> >                  processed=True
>
> > db(db.recording.id==r.id).update(processed_audio=processed)
> >             last_id = r.created_time
> >     except DeadlineExceededError:
> >         logging.info("cutoff at %s" %repr(last_id))
> >         taskqueue.add(url='/default/task', params={'id': last_id})
> >         return
>
> >     if len(rows) < 100:
> >         logging.info("no more rows to process")
> >         return
>
> >     logging.info("finished at %s" %repr(last_id))
> >     taskqueue.add(url='/default/task', params={'id': last_id})
> >     return
> > 
>
> > good luck!
>
> > cfh
>
> > On May 10, 7:14 pm, Matthew  wrote:
>
> > > Does this apply to the dev environment as well? Just fire it up and
> > > run it via localhost?
>
> > > If that's the case, would you mind providing an example or the proper
> > > documentation link to help me get started?
>
> > > Also, since bulk inserts are now possible in 
> > > GAEhttp://groups.google.com/group/web2py/browse_thread/thread/93d3dad847...,
> > > does that mean they're only possible from within the application
> > > itself (not via script)?
>
> > > Thanks,
> > > Matthew
>
> > > On May 10, 7:04 pm, howesc  wrote:
>
> > > > everything on GAE must be called via a URL (it must be a controller/
> > > > function).  if you need to run it periodically look up how to do cron
> > > > on GAE and create your cron.yaml.
>
> > > > @auth.requires_membership() is your friend in this case to limit who
> > > > can call your controller. :)
>
> > > > i have several of these sorts of things running on GAE, and it seems
> > > > t

Re: [web2py] hello

2010-05-12 Thread Álvaro Justen
On Tue, May 11, 2010 at 18:39, ciprian  wrote:
> i used this script to install web2py:
> http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> so i have everything in www-data
> and everything works fine.
>
> now..what do i have to install to make php work on the same folder? or
> what do i have to config. i have a very old app writed on php so i
> want to be able to add on the server the demo - because i am rewriting
> my site from php to web2py.

What do you mean with "same folder"?
If you are saying about: mysite.com/somefolder get requests for web2py
AND PHP it'll not be possible, I think.
What you could do is to split the URLs, for example:
web2py.mysite.com will get the requests and send to web2py and
php.mysite.com will send to PHP.
You could do also:
mysite.com/web2py
and
mysite.com/php
Obviously you could use /anything you want and configure Apache to
direct this to web2py or PHP.

> any help would be very helpful for me!

-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


[web2py] Re: hello

2010-05-12 Thread ciprian
anyone please? any tip ?


On May 11, 5:39 pm, ciprian  wrote:
> i used this script to install 
> web2py:http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> so i have everything in www-data
> and everything works fine.
>
> now..what do i have to install to make php work on the same folder? or
> what do i have to config. i have a very old app writed on php so i
> want to be able to add on the server the demo - because i am rewriting
> my site from php to web2py.
>
> any help would be very helpful for me!


Re: [web2py] Re: SSL Error on windows

2010-05-12 Thread Timothy Farrell
This is the error that Jon Lundell's guys found already.  Note that it's 
trying to connect to port 8000 as HTTP.  Connect as HTTPS and it should 
work.


Also try upgrading to trunk, that should issue a "400 Bad Request".

-tim

On 5/12/2010 1:32 PM, mdipierro wrote:

yes please


On May 12, 1:16 pm, Miguel Lopes  wrote:
   

On Tue, May 11, 2010 at 9:41 PM, mr.freeze  wrote:
 

Do you have the win32 extension for Python installed?
http://sourceforge.net/projects/pywin32/
   
 

On May 11, 3:33 pm, Miguel Lopes  wrote:
  >  On Tue, May 11, 2010 at 7:54 PM, mdipierro
wrote:
   

This is concerns me more:
   
 

WARNING:root:WEB2PY CRON: Disabled because no file locking
   
 

what os are you using?
   
 

Windows XP I can check the flavour and service pack tomorrow.
 

I confirm that this error disapers when pywin32 extensions are installed. If
this is the case, then maybe pywin32 should be listed as a dependency.

Unfortunately the SSL problems are an independent issue. Now I get:

C:\Programas\web2py>C:\Python26\python web2py.py -L options
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.77.3 (2010-04-20 02:48:54)
Database drivers available: SQLite3, PostgreSQL
Starting hardcron...
please visit:
http://Tecnicon-s3:8000
use "kill -SIGTERM 832" to shutdown the web2py server
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
 self._threadpool.queue.put((l.accept(),
   File "C:\Python26\lib\ssl.py", line 326, in accept
 suppress_ragged_eofs=self.suppress_ragged_eofs),
   File "C:\Python26\lib\ssl.py", line 118, in __init__
 self.do_handshake()
   File "C:\Python26\lib\ssl.py", line 293, in do_handshake
 self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
 self._threadpool.queue.put((l.accept(),
   File "C:\Python26\lib\ssl.py", line 326, in accept
 suppress_ragged_eofs=self.suppress_ragged_eofs),
   File "C:\Python26\lib\ssl.py", line 118, in __init__
 self.do_handshake()
   File "C:\Python26\lib\ssl.py", line 293, in do_handshake
 self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
 self._threadpool.queue.put((l.accept(),
   File "C:\Python26\lib\ssl.py", line 326, in accept
 suppress_ragged_eofs=self.suppress_ragged_eofs),
   File "C:\Python26\lib\ssl.py", line 118, in __init__
 self.do_handshake()
   File "C:\Python26\lib\ssl.py", line 293, in do_handshake
 self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request

Perhaps I should try a CherryPy based release in order to exclude Rocket as
a possible cause.

Miguel
 




[web2py] Re: Routes.py on GAE

2010-05-12 Thread mdipierro


On May 12, 1:36 pm, Chris S  wrote:
> This only errors on the live.  I've been running on the development
> server with no problem.
>
> Do I simply copy trunk over my working copy and deploy?

yes

> Where do I find the extra error information?  Does it just show up in
> the error log same as above?

yes

>
> I'll try and get this updated in a the next couple of days.
>
> On May 11, 5:51 pm, mdipierro  wrote:
>
> > I just posted a new gluon.rewrite.py in trunk that should report more
> > details about your error.
>
> > Massimo
>
> > On May 11, 7:53 am, Chris S  wrote:
>
> > > The routes.py file that I am attempting to use is:
> > > ---
> > > routes_in = (('/favicon.ico', '/init/static/favicon.ico'),
> > >              ('/robots.txt', '/init/static/robots.txt'),
> > > )
> > > routes_out = ()
> > > ---
> > > I believe that is a direct copy and paste of the example from the
> > > online book.
>
> > > On May 10, 6:04 pm, mdipierro  wrote:
>
> > > > As far as I know it works well on GAE. The errors you get:
>
> > > > "Your routes.py has a syntax error. Please fix it before you restart"
>
> > > > indicates that there is an error in your routes.py.
> > > > If you post it we can help you isolate the problem.
>
> > > > Massimo
>
> > > > On May 10, 4:23 pm, Chris S  wrote:
>
> > > > > Does routes.py work on GAE?  I've recently deployed an app which used
> > > > > the 5-line routes.py from the book for routing robots.txt and
> > > > > favicon.icon.  I just wanted to get rid of that 100% error rate on
> > > > > those two files.  I recevied the following message.  Only after
> > > > > removing routes.py again did the app launch properly.
>
> > > > > begin error message
> > > > > #
> > > > > 05-10 01:18PM 34.771
> > > > > unable to import Rocket
>
> > > > > #
> > > > > E 05-10 01:18PM 34.774
> > > > > Your routes.py has a syntax error. Please fix it before you restart
> > > > > web2py
>
> > > > > #
> > > > > E 05-10 01:18PM 34.778
> > > > > : invalid syntax (, line 3)
> > > > > Traceback (most recent call last):
> > > > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > > > gaehandler.py", line 44, in 
> > > > >     import gluon.main
> > > > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > > > gluon/main.py", line 66, in 
> > > > >     rewrite.load()
> > > > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > > > gluon/rewrite.py", line 63, in load
> > > > >     raise e


[web2py] Re: Routes.py on GAE

2010-05-12 Thread Chris S
This only errors on the live.  I've been running on the development
server with no problem.

Do I simply copy trunk over my working copy and deploy?
Where do I find the extra error information?  Does it just show up in
the error log same as above?

I'll try and get this updated in a the next couple of days.

On May 11, 5:51 pm, mdipierro  wrote:
> I just posted a new gluon.rewrite.py in trunk that should report more
> details about your error.
>
> Massimo
>
> On May 11, 7:53 am, Chris S  wrote:
>
> > The routes.py file that I am attempting to use is:
> > ---
> > routes_in = (('/favicon.ico', '/init/static/favicon.ico'),
> >              ('/robots.txt', '/init/static/robots.txt'),
> > )
> > routes_out = ()
> > ---
> > I believe that is a direct copy and paste of the example from the
> > online book.
>
> > On May 10, 6:04 pm, mdipierro  wrote:
>
> > > As far as I know it works well on GAE. The errors you get:
>
> > > "Your routes.py has a syntax error. Please fix it before you restart"
>
> > > indicates that there is an error in your routes.py.
> > > If you post it we can help you isolate the problem.
>
> > > Massimo
>
> > > On May 10, 4:23 pm, Chris S  wrote:
>
> > > > Does routes.py work on GAE?  I've recently deployed an app which used
> > > > the 5-line routes.py from the book for routing robots.txt and
> > > > favicon.icon.  I just wanted to get rid of that 100% error rate on
> > > > those two files.  I recevied the following message.  Only after
> > > > removing routes.py again did the app launch properly.
>
> > > > begin error message
> > > > #
> > > > 05-10 01:18PM 34.771
> > > > unable to import Rocket
>
> > > > #
> > > > E 05-10 01:18PM 34.774
> > > > Your routes.py has a syntax error. Please fix it before you restart
> > > > web2py
>
> > > > #
> > > > E 05-10 01:18PM 34.778
> > > > : invalid syntax (, line 3)
> > > > Traceback (most recent call last):
> > > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > > gaehandler.py", line 44, in 
> > > >     import gluon.main
> > > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > > gluon/main.py", line 66, in 
> > > >     rewrite.load()
> > > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > > gluon/rewrite.py", line 63, in load
> > > >     raise e
>
>


[web2py] Re: jquery libraries

2010-05-12 Thread mdipierro
datepicker only depends on jquery base. What features did you add?

On May 12, 1:23 pm, MaxDoesPython  wrote:
> I have added a feature to jquery datepicker and need to integrate it
> into the js libraries that are loaded, so need to know what is
> included in jquery-ui.custom. I will be using latest jquery libs so
> can you tell me if I need to also get corresponding libs for rule and
> event.drag.custom and any other relevant details.
>
> max


[web2py] Re: SSL Error on windows

2010-05-12 Thread mdipierro
yes please


On May 12, 1:16 pm, Miguel Lopes  wrote:
> On Tue, May 11, 2010 at 9:41 PM, mr.freeze  wrote:
> > Do you have the win32 extension for Python installed?
> >http://sourceforge.net/projects/pywin32/
>
> > On May 11, 3:33 pm, Miguel Lopes  wrote:
> >  > On Tue, May 11, 2010 at 7:54 PM, mdipierro 
> > wrote:
> > > > This is concerns me more:
>
> > > > WARNING:root:WEB2PY CRON: Disabled because no file locking
>
> > > > what os are you using?
>
> > > Windows XP I can check the flavour and service pack tomorrow.
>
> I confirm that this error disapers when pywin32 extensions are installed. If
> this is the case, then maybe pywin32 should be listed as a dependency.
>
> Unfortunately the SSL problems are an independent issue. Now I get:
>
> C:\Programas\web2py>C:\Python26\python web2py.py -L options
> web2py Enterprise Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2010
> Version 1.77.3 (2010-04-20 02:48:54)
> Database drivers available: SQLite3, PostgreSQL
> Starting hardcron...
> please visit:
>        http://Tecnicon-s3:8000
> use "kill -SIGTERM 832" to shutdown the web2py server
> ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
>   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
>     self._threadpool.queue.put((l.accept(),
>   File "C:\Python26\lib\ssl.py", line 326, in accept
>     suppress_ragged_eofs=self.suppress_ragged_eofs),
>   File "C:\Python26\lib\ssl.py", line 118, in __init__
>     self.do_handshake()
>   File "C:\Python26\lib\ssl.py", line 293, in do_handshake
>     self._sslobj.do_handshake()
> SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
> routines:SSL23_GET_CLIENT_HEL
> LO:http request
> ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
>   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
>     self._threadpool.queue.put((l.accept(),
>   File "C:\Python26\lib\ssl.py", line 326, in accept
>     suppress_ragged_eofs=self.suppress_ragged_eofs),
>   File "C:\Python26\lib\ssl.py", line 118, in __init__
>     self.do_handshake()
>   File "C:\Python26\lib\ssl.py", line 293, in do_handshake
>     self._sslobj.do_handshake()
> SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
> routines:SSL23_GET_CLIENT_HEL
> LO:http request
> ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
>   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
>     self._threadpool.queue.put((l.accept(),
>   File "C:\Python26\lib\ssl.py", line 326, in accept
>     suppress_ragged_eofs=self.suppress_ragged_eofs),
>   File "C:\Python26\lib\ssl.py", line 118, in __init__
>     self.do_handshake()
>   File "C:\Python26\lib\ssl.py", line 293, in do_handshake
>     self._sslobj.do_handshake()
> SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
> routines:SSL23_GET_CLIENT_HEL
> LO:http request
>
> Perhaps I should try a CherryPy based release in order to exclude Rocket as
> a possible cause.
>
> Miguel


[web2py] jquery libraries

2010-05-12 Thread MaxDoesPython
I have added a feature to jquery datepicker and need to integrate it
into the js libraries that are loaded, so need to know what is
included in jquery-ui.custom. I will be using latest jquery libs so
can you tell me if I need to also get corresponding libs for rule and
event.drag.custom and any other relevant details.

max


Re: [web2py] Re: SSL Error on windows

2010-05-12 Thread Miguel Lopes
On Tue, May 11, 2010 at 9:41 PM, mr.freeze  wrote:

> Do you have the win32 extension for Python installed?
> http://sourceforge.net/projects/pywin32/
>
> On May 11, 3:33 pm, Miguel Lopes  wrote:
>  > On Tue, May 11, 2010 at 7:54 PM, mdipierro 
> wrote:
> > > This is concerns me more:
> >
> > > WARNING:root:WEB2PY CRON: Disabled because no file locking
> >
> > > what os are you using?
> >
> > Windows XP I can check the flavour and service pack tomorrow.
>

I confirm that this error disapers when pywin32 extensions are installed. If
this is the case, then maybe pywin32 should be listed as a dependency.

Unfortunately the SSL problems are an independent issue. Now I get:

C:\Programas\web2py>C:\Python26\python web2py.py -L options
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.77.3 (2010-04-20 02:48:54)
Database drivers available: SQLite3, PostgreSQL
Starting hardcron...
please visit:
http://Tecnicon-s3:8000 
use "kill -SIGTERM 832" to shutdown the web2py server
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
  File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
self._threadpool.queue.put((l.accept(),
  File "C:\Python26\lib\ssl.py", line 326, in accept
suppress_ragged_eofs=self.suppress_ragged_eofs),
  File "C:\Python26\lib\ssl.py", line 118, in __init__
self.do_handshake()
  File "C:\Python26\lib\ssl.py", line 293, in do_handshake
self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
  File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
self._threadpool.queue.put((l.accept(),
  File "C:\Python26\lib\ssl.py", line 326, in accept
suppress_ragged_eofs=self.suppress_ragged_eofs),
  File "C:\Python26\lib\ssl.py", line 118, in __init__
self.do_handshake()
  File "C:\Python26\lib\ssl.py", line 293, in do_handshake
self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
  File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
self._threadpool.queue.put((l.accept(),
  File "C:\Python26\lib\ssl.py", line 326, in accept
suppress_ragged_eofs=self.suppress_ragged_eofs),
  File "C:\Python26\lib\ssl.py", line 118, in __init__
self.do_handshake()
  File "C:\Python26\lib\ssl.py", line 293, in do_handshake
self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request

Perhaps I should try a CherryPy based release in order to exclude Rocket as
a possible cause.

Miguel


[web2py] Re: web2py - shared host issue

2010-05-12 Thread mdipierro
A user Shu-I Huang has reported a problem with modpythonhandler.py and
proposed the following fix:

   if 'SCRIPT_NAME' in options:
   # Override SCRIPT_NAME and PATH_INFO if requested.
   env['SCRIPT_NAME'] = options['SCRIPT_NAME']
   req.uri = env['SCRIPT_NAME']# << EDD THIS LINE
   env['PATH_INFO'] = req.uri[len(options['SCRIPT_NAME']):]

I am convinced this fix is a god solution because I am not sure what
happens to get variables. I am also not sure why the problem exists.
Anyway, perhaps this may help you.

On May 12, 11:58 am, Mauricio Darocha 
wrote:
> Hi Alvaro. Thank you for your prompt answer, but I'm still having issues
> with it.
>
> I don't have access to any configuration file. So I'm using .htaccess.
>
> .htaccess =
> SetHandler python-program
> PythonHandler web2py_modpython
> PythonDebug Off
> PythonPath "['/home/mauricio/public_html/'] + sys.path"
>
> web2py_modpython.py =
> from mod_python import apache
> import modpythonhandler
>
> def handler(req):
>     req.subprocess_env['PATH_INFO'] = '/home/mauricio/public_html/'
>     return modpythonhandler.handler(req)
>
> I'll get very sad if I can't use web2py in my host. Any help is greatly
> appreciated.
>
> Thank you.
>
> Mauricio.
>
> On Wed, May 12, 2010 at 1:50 PM, Álvaro Justen  wrote:
> > On Wed, May 12, 2010 at 13:23, Mauricio  wrote:
> > > Hi Everyone!
>
> > > First of all, I would like to congratulate Massimo Di Pierro. If you
> > > can read this, you are the man! I loved web2py.
>
> > > Unfortunately, I'm a beginner from Brazil and I'm having a hard time
> > > to set it up in a shared host.
>
> > > If someone can help me out, I greatly appreciate.
>
> > > I made some research myself before bother anybody with this.
>
> > > Since I don't have access to http.conf file or any other configuration
> > > file, I followed the steps in the manual.
> > >http://web2py.com/book/default/section/11/8
>
> > > But mod_python gives me an error on SCRIPT_URL.
>
> > > So, I put the path '/home/myfolderwithweb2py' to
> > > req.subprocess_env['SCRIPT_URL'], instead.
>
> > > But now, I've got the message "Invalid request", nothing else. Not
> > > even if I change "PythonDebug On" on .htaccess.
>
> > > Can anybody help me out?
>
> > > Thank you in advance.
>
> > > My host ishttp://mochahost.com/webhosting.php
> > > Linux / Apache 2
> > > Python 2.5
> > > mod_python
>
> > Hi Mauricio,
> > I've answered yout question in web2py-users-brazil mail list.
>
> > --
> > Álvaro Justen - Turicas
> >  http://blog.justen.eng.br/
> >  21 9898-0141


Re: [web2py] web2py - shared host issue

2010-05-12 Thread Mauricio Darocha
Hi Alvaro. Thank you for your prompt answer, but I'm still having issues
with it.

I don't have access to any configuration file. So I'm using .htaccess.

.htaccess =
SetHandler python-program
PythonHandler web2py_modpython
PythonDebug Off
PythonPath "['/home/mauricio/public_html/'] + sys.path"

web2py_modpython.py =
from mod_python import apache
import modpythonhandler

def handler(req):
req.subprocess_env['PATH_INFO'] = '/home/mauricio/public_html/'
return modpythonhandler.handler(req)

I'll get very sad if I can't use web2py in my host. Any help is greatly
appreciated.

Thank you.

Mauricio.

On Wed, May 12, 2010 at 1:50 PM, Álvaro Justen  wrote:

> On Wed, May 12, 2010 at 13:23, Mauricio  wrote:
> > Hi Everyone!
> >
> > First of all, I would like to congratulate Massimo Di Pierro. If you
> > can read this, you are the man! I loved web2py.
> >
> > Unfortunately, I'm a beginner from Brazil and I'm having a hard time
> > to set it up in a shared host.
> >
> > If someone can help me out, I greatly appreciate.
> >
> > I made some research myself before bother anybody with this.
> >
> > Since I don't have access to http.conf file or any other configuration
> > file, I followed the steps in the manual.
> > http://web2py.com/book/default/section/11/8
> >
> > But mod_python gives me an error on SCRIPT_URL.
> >
> > So, I put the path '/home/myfolderwithweb2py' to
> > req.subprocess_env['SCRIPT_URL'], instead.
> >
> > But now, I've got the message "Invalid request", nothing else. Not
> > even if I change "PythonDebug On" on .htaccess.
> >
> > Can anybody help me out?
> >
> > Thank you in advance.
> >
> > My host is http://mochahost.com/webhosting.php
> > Linux / Apache 2
> > Python 2.5
> > mod_python
>
> Hi Mauricio,
> I've answered yout question in web2py-users-brazil mail list.
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141
>


Re: [web2py] web2py - shared host issue

2010-05-12 Thread Álvaro Justen
On Wed, May 12, 2010 at 13:23, Mauricio  wrote:
> Hi Everyone!
>
> First of all, I would like to congratulate Massimo Di Pierro. If you
> can read this, you are the man! I loved web2py.
>
> Unfortunately, I'm a beginner from Brazil and I'm having a hard time
> to set it up in a shared host.
>
> If someone can help me out, I greatly appreciate.
>
> I made some research myself before bother anybody with this.
>
> Since I don't have access to http.conf file or any other configuration
> file, I followed the steps in the manual.
> http://web2py.com/book/default/section/11/8
>
> But mod_python gives me an error on SCRIPT_URL.
>
> So, I put the path '/home/myfolderwithweb2py' to
> req.subprocess_env['SCRIPT_URL'], instead.
>
> But now, I've got the message "Invalid request", nothing else. Not
> even if I change "PythonDebug On" on .htaccess.
>
> Can anybody help me out?
>
> Thank you in advance.
>
> My host is http://mochahost.com/webhosting.php
> Linux / Apache 2
> Python 2.5
> mod_python

Hi Mauricio,
I've answered yout question in web2py-users-brazil mail list.

-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


[web2py] web2py - shared host issue

2010-05-12 Thread Mauricio
Hi Everyone!

First of all, I would like to congratulate Massimo Di Pierro. If you
can read this, you are the man! I loved web2py.

Unfortunately, I'm a beginner from Brazil and I'm having a hard time
to set it up in a shared host.

If someone can help me out, I greatly appreciate.

I made some research myself before bother anybody with this.

Since I don't have access to http.conf file or any other configuration
file, I followed the steps in the manual.
http://web2py.com/book/default/section/11/8

But mod_python gives me an error on SCRIPT_URL.

So, I put the path '/home/myfolderwithweb2py' to
req.subprocess_env['SCRIPT_URL'], instead.

But now, I've got the message "Invalid request", nothing else. Not
even if I change "PythonDebug On" on .htaccess.

Can anybody help me out?

Thank you in advance.

My host is http://mochahost.com/webhosting.php
Linux / Apache 2
Python 2.5
mod_python


[web2py] grooverwiki revisited

2010-05-12 Thread blye
the grooverwiki appliance has been subject of previous discussion. My
install is still not working, although it has improved (allows wiki
pages to be entered under admin) when I applied a change suggested in
the thread.

I think I have isolated the problem to the following section:

try:
page_id=int(request.args[0])
curr_page=db(db.WikiPage.id==page_id).select(db.WikiPage.ALL)
[0]
except Exception, e:
curr_page=db().select(db.WikiPage.ALL)[0]
categories=db().select(db.category.ALL)
etc...

I include the suggestion that helped a bit:

"grooverwiki worked when db=sqldb("sqlite://db.db") is changed to
db=sqldb("sqlite:// storage.db") in models/db.py"


After some frustrating 'looping' around the problem are there any
further suggestions ?


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread Adi
Its called a bookmarklet and I believe it was popularized by blogs
like Wordpress and Tumblr - by clicking their bookmarklet you can
create a new post for example. We faced a lot of challenge in trying
to extract embedded video from the server side - because various sites
use very different mechanisms (javascript, flash, ajax) to render
embedded videos. That's why we resorted to client-side approach using
a bookmarklet. Once a page is rendered we can parse the contents and
grab what we need.

However we will have to figure a way to execute javascript on the
server side eventually - for example bookmarking a video by right
clicking a url (without opening the page), something I wish for every
time I want to queue a video from my twitter feed. Right now I have to
click the url, open the page and then bookmark.

On May 12, 8:45 pm, mdipierro  wrote:
> I did not know that you can put  javascript in a bookmark instead of
> simply a URL and when you click on the bookmark the JS code is
> executed on the page you are currently visiting.
>


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread blackthorne
I think those are called "bookmarklets"

On May 12, 4:45 pm, mdipierro  wrote:
> I did not know that you can put  javascript in a bookmark instead of
> simply a URL and when you click on the bookmark the JS code is
> executed on the page you are currently visiting.
>
> On May 12, 10:42 am, Adi  wrote:
>
>
>
> > We don't intend to open source the application. We're flirting with
> > the idea of putting up some of these features as slices/recipes/
> > plugins for easy reuse by the community. This might take a while
> > though. If you need something specific I'll be happy to copy-paste the
> > code and walk you over the implementation. Others can pitch in with
> > better alternatives.
>
> > On May 12, 7:16 pm, blackthorne  wrote:
>
> > > great app! congratulations! Very good work!
>
> > > You mention a set of features which is often asked in this group. Is
> > > your app open source so that it can help answering them?
> > > If yes, would you please tell us where to find it?
>
> > > Thank you,
> > > Best Regards


[web2py] Re: ToscaWidgets

2010-05-12 Thread mdipierro
I do not think anybody did and here is why:

ToscaWidget example

import tw.forms as twf
movie_form = twf.TableForm('movie_form', action='save_movie',
children=[
twf.HiddenField('id'),
twf.TextField('title'),
twf.TextField('year', size=4),
twf.CalendarDatePicker('release_date'),
twf.SingleSelectField('genera', options=['', 'Action', 'Comedy',
'Other']),
twf.TextArea('description'),
])

same code in web2py:

movie_form = SQLFORM.factory(
Field('title','text'),
Field('year', length=4),
Field('release_date','date'),
Field('genera', requires=IS_IN_SET(('Action', 'Comedy',
'Other'),zero='')),
Field('description','text'),
_hidden=dict(id=3),_action=URL(r=request,f='save_movie'))



On May 12, 10:36 am, stefaan  wrote:
> > Nobody know Toscawidgets and have try it with web2py ?
>
> Hello Lannick,
>
> Given the lack of answers it is safe to assume that no-one has tried
> it with web2py...
>
> Best regards,
> Stefaan.


Re: [web2py] Looping in the browser?

2010-05-12 Thread Andrew Evans
ty this is exactly what I need ty very much


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread mdipierro
I did not know that you can put  javascript in a bookmark instead of
simply a URL and when you click on the bookmark the JS code is
executed on the page you are currently visiting.

On May 12, 10:42 am, Adi  wrote:
> We don't intend to open source the application. We're flirting with
> the idea of putting up some of these features as slices/recipes/
> plugins for easy reuse by the community. This might take a while
> though. If you need something specific I'll be happy to copy-paste the
> code and walk you over the implementation. Others can pitch in with
> better alternatives.
>
> On May 12, 7:16 pm, blackthorne  wrote:
>
> > great app! congratulations! Very good work!
>
> > You mention a set of features which is often asked in this group. Is
> > your app open source so that it can help answering them?
> > If yes, would you please tell us where to find it?
>
> > Thank you,
> > Best Regards


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread Adi
We don't intend to open source the application. We're flirting with
the idea of putting up some of these features as slices/recipes/
plugins for easy reuse by the community. This might take a while
though. If you need something specific I'll be happy to copy-paste the
code and walk you over the implementation. Others can pitch in with
better alternatives.

On May 12, 7:16 pm, blackthorne  wrote:
> great app! congratulations! Very good work!
>
> You mention a set of features which is often asked in this group. Is
> your app open source so that it can help answering them?
> If yes, would you please tell us where to find it?
>
> Thank you,
> Best Regards
>
>


[web2py] Re: Video on How to deploy web2py on VPS.net

2010-05-12 Thread mdipierro
http://vimeo.com/10377947

On May 12, 9:47 am, GoldenTiger  wrote:
> Hi Massimo, I am Juan, from Spain.
>
> Some months ago, I read a message from you like that:
>
> "I use vps.net and I cannot be happier. I will make a video on how to
> deploy web2py there"
>
> I am very interested in that video.
>
> Did you make that video?
>
> Thanks a lot
>
> (PD: Web2Py is my favourite framework in the world, thanks ^^)


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread Adi
We have not tested much with Opera - there may be some issues specific
to the browser. I added the same video to my account (I use Chrome on
Ubuntu 9.10) and I could add it: http://radbox.me/watch/video/502
I'll test it on Opera some time.

Perhaps try in a webkit-based browser (Firefox/Chrome/Safari)? We've
encountered some bugs in IE as well since we use a lot of jquery
effects that IE doesn't really like much (and we don't like IE at
all!). When you saw "Saving..." message once it saves the message
should change to "Saved". Give it another shot. Sorry for the issue.

On May 12, 5:25 pm, selecta  wrote:
> I cannot get I to work
> I went tohttp://vimeo.com/10149605
> pressed my bookmarklet, it said saving
> but I cannot find any videos on my radbox page?
> did I do something wrong?
> I am using opera 10.53 Internal on ubuntu 10.04


[web2py] Video on How to deploy web2py on VPS.net

2010-05-12 Thread GoldenTiger
Hi Massimo, I am Juan, from Spain.

Some months ago, I read a message from you like that:

"I use vps.net and I cannot be happier. I will make a video on how to
deploy web2py there"

I am very interested in that video.

Did you make that video?

Thanks a lot

(PD: Web2Py is my favourite framework in the world, thanks ^^)


[web2py] Re: ToscaWidgets

2010-05-12 Thread stefaan
> Nobody know Toscawidgets and have try it with web2py ?

Hello Lannick,

Given the lack of answers it is safe to assume that no-one has tried
it with web2py...

Best regards,
Stefaan.


[web2py] Re: Catch and replace vars

2010-05-12 Thread mdipierro
Why would you want web2py to auto-compute a field when you have asked
the user for its value? unless you want the computation BEFORE you
prompt the user for a value. But in this case it cannot depend on
other fields because they have not been insrted yet.

On May 12, 9:30 am, Iceberg  wrote:
> So if I understand it correctly, the Field(..., compute=...) is only
> suitable for defining a field which is not supposed to be showed in
> SQLFORM(), neither supposed to be filled by human.
>
> For example, this case can use Field(..., compute=...).
>
>     db.define_table('circles',
>         Field('radius', 'double'),
>         Field('area', 'double',
>             compute = lambda record: record['radius']**2*3.14),
>         )
>
> And this case should not. (Why? Try.)
>
>     db.define_table('visitor_booking',
>         Field('adult', 'integer'),
>         Field('kid', 'integer',
>             compute = lambda r: min(r['kid'], r['adult']) ),
>         # each kid must be accompanied by one dedicated adult
>         )
>
> PS: Of course the latter case should have better approach. Here I am
> just demostrating when and when not to use Field(..., compute=...)
>
> Regards,
> iceberg
>
> On May12, 2:22am, Iceberg  wrote:
>
> > Thanks for the tip, but there seems some more subtle difference
> > between form.accepts(..., onvalidation=callback) VS Field('bar',
> > compute=lambda r:r['foo']).
>
> > The latter will cause that field no longer showts up in SQLFORM,
> > because its default self.fields excludes all compute field. Is there
> > any reason for that?
>
> > Right now I still have to stick to my form.accepts(...,
> > onvalidation=callback) approach. :-/
>
> > Sincerely,
> > Iceberg
>
> > On May12, 1:30am, mdipierro  wrote:
>
> > > Yes but
>
> > >   Field('bar', compute=lambda r:r['foo'])
>
> > > not
>
> > >   Field('bar', compute=lambda r:r.foo)
>
> > > On May 11, 11:28 am, Iceberg  wrote:
>
> > > > I must miss the "compute" feature. Now I am picking it up. Would you
> > > > please confirm whether my understanding is correct?
>
> > > > The code:
> > > >         Field('bar', compute=lambda r:r.foo)
> > > > is an easier equivalent for:
> > > >         def callback(form): form.vars.bar = form.vars.foo
> > > >         form.accepts(..., onvalidation=callback)
> > > > and it only works before inserting or updating a record into db.
>
> > > > On the contrary, rows.setvirtualfields(...), only works when
> > > > retrieving records from db. (Detail 
> > > > inhttp://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
> > > >  )
>
> > > > Is it right?
>
> > > > Regards,
> > > > iceberg
>
> > > > On May11, 10:23pm, mdipierro  wrote:
>
> > > > > I think you look for something like
>
> > > > > db.table.field_2.compute=lambda r: request.vars.field_1
>
> > > > > On May 11, 4:01 am, AsmanCom  wrote:
>
> > > > > > That would be a great solution, but i´ve to do this in model 
> > > > > > because i
> > > > > > am using the awesome JQGrid plugin (app.ebansoftware.net/
> > > > > > editable_jqgrid/).
> > > > > > The dilemma is:
> > > > > > - I need to do this in the model
> > > > > > - I can`t get the vars from table.field.default (self-evident)
> > > > > > - I need a working IS_IN_DB(db,'table.id','table.name') validator 
> > > > > > and
> > > > > > label (for the JQGrid plugin)
> > > > > > - I can´t add an aditional validator (because IS_IN_DB +label don´t
> > > > > > show up right, when combined with other validators)
> > > > > > - The form must be visible to the user, so i can´t go with
> > > > > > table.field.compute
>
> > > > > > So I think to implement this with Field default function is the 
> > > > > > right
> > > > > > approach?
> > > > > > But I need to catch the vars, compute someth. and Insert.
>
> > > > > > Any ideas?
>
> > > > > > On 10 Mai, 19:47, Iceberg  wrote:
>
> > > > > > > Model:
> > > > > > > db.define_table('table_1',
> > > > > > >                        Field('field_1'),
> > > > > > >                        Field('field_2')
> > > > > > >                        )
>
> > > > > > > Controller:
> > > > > > > def index():
> > > > > > >   def magic(form):
> > > > > > >     form.vars.field_2 = form.vars.field_1
> > > > > > >   form = SQLFORM(db.table_1)
> > > > > > >   if form.accepts(request.vars, onvalidation=magic):
> > > > > > >     pass # ok
> > > > > > >   return {'form': form}
>
> > > > > > > I did not test it. But it shows you the key of using 
> > > > > > > onvalidation()
> > > > > > > trick.
>
> > > > > > > Regards,
> > > > > > > Iceberg
>
> > > > > > > On May11, 12:08am, AsmanCom  wrote:
>
> > > > > > > > Hi,
>
> > > > > > > > i want to do a simple task:
>
> > > > > > > > def function_1():
> > > > > > > >     var_field_1=request.vars.field_1
> > > > > > > >     if var_field_1:
> > > > > > > >         return var_field_1
>
> > > > > > > > db.define_table('table_1',
> > > > > > > >                        Field('field_1','string' ),
> > > > > > > >                        Field('field_2', default=funct

[web2py] Re: session configuration

2010-05-12 Thread mdipierro
On May 12, 8:59 am, Śląski  wrote:
> The only thinks I found is:
> For Auth operatons -> set  auth.settings.expiration
> For all session -> set   response.cookies[response.session_id_name]
> ['expires']=
> For permanently delete session ->
>           auth.logout(); os.remove(response.session_filename);
>           session=None;
>           del response.cookies[response.session_id_name]
>
> Ok - it is possible, but there is now solution like django
> request.session.flush(), request.session.set_expiry  (http://
> docs.djangoproject.com/en/1.1/topics/http/sessions/#topics-http-
> sessions)

No. Perhaps we should have one.

> 2. Is it possible to save session in database (not in file)? there is
> a function session._try_store_in_db(), but how to set it to default?

session.connect(request,response,db)

> Thanks for response


[web2py] Re: duplicate ids on using auth.login and auth.register forms on same page

2010-05-12 Thread mdipierro
This was fixed. What version of web2py are you using?

On May 12, 5:51 am, Rohan  wrote:
>  I am using auth.login and auth.register forms on a single page and it
> is resulting in duplicate ids for email and password rows.
> similar discussions were going on this 
> threadhttp://groups.google.com/group/web2py/browse_frm/thread/e43c1203d8749630
> Is there any update on this?


Re: [web2py] Re: ORM-like DAL

2010-05-12 Thread Thadeus Burgess
VirtualFields?

--
Thadeus





On Tue, May 11, 2010 at 11:59 PM, vihang  wrote:
> Some of the apps I am working currently are much more easy to build if
> the models can be defined as a class with methods that act on them.
>
>
> On May 12, 5:51 am, Álvaro Justen  wrote:
>> On Tue, May 11, 2010 at 21:38, Richard  wrote:
>> > there was a discussion about this on the developers mailing list last
>> > week:
>> >http://groups.google.com/group/web2py-developers/browse_thread/thread...
>>
>> Yes, started by me.
>>
>> > On May 7, 12:50 am, vihang  wrote:
>> >> Hello,
>>
>> >> A long time back, someone (mostly probably massimo) had written a few
>> >> lines of code showing how DAL could be extended to be used in class,
>> >> and effective like ORM. I have spent a lot of time searching for this
>> >> on this group, but unable to find it. Any help would be appreciated.
>>
>> vihang, why do you want an ORM? :)
>>
>> >> Thanks
>> >> Vihang
>>
>> --
>> Álvaro Justen - Turicas
>>  http://blog.justen.eng.br/
>>  21 9898-0141
>


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

2010-05-12 Thread Thadeus Burgess
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.
>
>


[web2py] Re: Do you use web2py in your company?

2010-05-12 Thread drelyn86
United States.
They are a 3rd party distribution and logistics company.

On May 11, 8:39 pm, mdipierro  wrote:
> Glad to hear about this.
> Can you tell us in which country and in which field your previous
> employer was operating?
>
> On May 11, 7:34 pm, drelyn86  wrote:
>
>
>
> > With my previous employer, I used web2py to build a few basic
> > applications. One was an application to input and track inventory
> > mistakes in warehouse operations. Another was a similar application to
> > input and track the results of daily audits performed by each
> > warehouse department. I also made an application to provide a daily
> > report of the toner and maintenance kit status in 40+ of our
> > production printers. Lastly, I made an application that our IT
> > department used to manage the logins and permissions of users for each
> > of these applications.
> > These projects were part of a bigger initiative to ween the facility
> > off of dependence on dozens of large and unmaintained Microsoft Access
> > databases. The rapid-development and multi-database-friendliness of
> > web2py made it the best tool for what I needed.
>
> > I won't be able to provide the company name, as I haven't maintained
> > contact with my previous employer. Likewise, I will not be able to
> > provide a screenshot, as the layout was branded with company logos.
>
> > I really like working with web2py. It's the first and only framework I
> > have learned so far, and these applications were the first of anything
> > useful I have built outside of "Hello World" in any language I have
> > ever attempted learning. By no means, do I consider myself a
> > programmer... and that's why I think python and web2py works for me
> > (the are, however, very talented programmers using web2py).
>
> > I was able to talk about this experience in a job-interview that
> > landed me at a company that offers MUCH more opportunity. I'd like to
> > thank everyone in the web2py community for being so much help and
> > doing such a great job.
>
> > Yours Truly...
>
> > On May 10, 5:09 pm, mdipierro  wrote:
>
> > > Anthony made some good 
> > > points:http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> > > For now let's concentrate on one of them for now. If you have
> > > developed software in web2py that you use internally in your company
> > > but you cannot release it open source, would you let us know? Can you
> > > tell us what is the software for? Could you provide a screenshot? Can
> > > we quote the name of the company?
>
> > > Massimo


[web2py] Re: Catch and replace vars

2010-05-12 Thread Iceberg
So if I understand it correctly, the Field(..., compute=...) is only
suitable for defining a field which is not supposed to be showed in
SQLFORM(), neither supposed to be filled by human.


For example, this case can use Field(..., compute=...).

db.define_table('circles',
Field('radius', 'double'),
Field('area', 'double',
compute = lambda record: record['radius']**2*3.14),
)


And this case should not. (Why? Try.)

db.define_table('visitor_booking',
Field('adult', 'integer'),
Field('kid', 'integer',
compute = lambda r: min(r['kid'], r['adult']) ),
# each kid must be accompanied by one dedicated adult
)

PS: Of course the latter case should have better approach. Here I am
just demostrating when and when not to use Field(..., compute=...)

Regards,
iceberg

On May12, 2:22am, Iceberg  wrote:
> Thanks for the tip, but there seems some more subtle difference
> between form.accepts(..., onvalidation=callback) VS Field('bar',
> compute=lambda r:r['foo']).
>
> The latter will cause that field no longer showts up in SQLFORM,
> because its default self.fields excludes all compute field. Is there
> any reason for that?
>
> Right now I still have to stick to my form.accepts(...,
> onvalidation=callback) approach. :-/
>
> Sincerely,
> Iceberg
>
> On May12, 1:30am, mdipierro  wrote:
>
>
>
> > Yes but
>
> >   Field('bar', compute=lambda r:r['foo'])
>
> > not
>
> >   Field('bar', compute=lambda r:r.foo)
>
> > On May 11, 11:28 am, Iceberg  wrote:
>
> > > I must miss the "compute" feature. Now I am picking it up. Would you
> > > please confirm whether my understanding is correct?
>
> > > The code:
> > >         Field('bar', compute=lambda r:r.foo)
> > > is an easier equivalent for:
> > >         def callback(form): form.vars.bar = form.vars.foo
> > >         form.accepts(..., onvalidation=callback)
> > > and it only works before inserting or updating a record into db.
>
> > > On the contrary, rows.setvirtualfields(...), only works when
> > > retrieving records from db. (Detail 
> > > inhttp://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
> > >  )
>
> > > Is it right?
>
> > > Regards,
> > > iceberg
>
> > > On May11, 10:23pm, mdipierro  wrote:
>
> > > > I think you look for something like
>
> > > > db.table.field_2.compute=lambda r: request.vars.field_1
>
> > > > On May 11, 4:01 am, AsmanCom  wrote:
>
> > > > > That would be a great solution, but i´ve to do this in model because i
> > > > > am using the awesome JQGrid plugin (app.ebansoftware.net/
> > > > > editable_jqgrid/).
> > > > > The dilemma is:
> > > > > - I need to do this in the model
> > > > > - I can`t get the vars from table.field.default (self-evident)
> > > > > - I need a working IS_IN_DB(db,'table.id','table.name') validator and
> > > > > label (for the JQGrid plugin)
> > > > > - I can´t add an aditional validator (because IS_IN_DB +label don´t
> > > > > show up right, when combined with other validators)
> > > > > - The form must be visible to the user, so i can´t go with
> > > > > table.field.compute
>
> > > > > So I think to implement this with Field default function is the right
> > > > > approach?
> > > > > But I need to catch the vars, compute someth. and Insert.
>
> > > > > Any ideas?
>
> > > > > On 10 Mai, 19:47, Iceberg  wrote:
>
> > > > > > Model:
> > > > > > db.define_table('table_1',
> > > > > >                        Field('field_1'),
> > > > > >                        Field('field_2')
> > > > > >                        )
>
> > > > > > Controller:
> > > > > > def index():
> > > > > >   def magic(form):
> > > > > >     form.vars.field_2 = form.vars.field_1
> > > > > >   form = SQLFORM(db.table_1)
> > > > > >   if form.accepts(request.vars, onvalidation=magic):
> > > > > >     pass # ok
> > > > > >   return {'form': form}
>
> > > > > > I did not test it. But it shows you the key of using onvalidation()
> > > > > > trick.
>
> > > > > > Regards,
> > > > > > Iceberg
>
> > > > > > On May11, 12:08am, AsmanCom  wrote:
>
> > > > > > > Hi,
>
> > > > > > > i want to do a simple task:
>
> > > > > > > def function_1():
> > > > > > >     var_field_1=request.vars.field_1
> > > > > > >     if var_field_1:
> > > > > > >         return var_field_1
>
> > > > > > > db.define_table('table_1',
> > > > > > >                        Field('field_1','string' ),
> > > > > > >                        Field('field_2', default=function_1)
> > > > > > >                        )
>
> > > > > > > db.table_1.field_1.default='Autogenerated'
> > > > > > > db.table_1.field_2.default='Autogenerated'
>
> > > > > > > I want to catch default vars from field 1 and insert them in 
> > > > > > > field_2
> > > > > > > instead.
> > > > > > > Is this possible?
>
> > > > > > > ###becomes interesting when combined, with IS_IN_DB and the
> > > > > > > get_or_create function###


[web2py] Re: Do you use web2py in your company?

2010-05-12 Thread drelyn86
United States

On May 11, 8:39 pm, mdipierro  wrote:
> Glad to hear about this.
> Can you tell us in which country and in which field your previous
> employer was operating?
>
> On May 11, 7:34 pm, drelyn86  wrote:
>
>
>
> > With my previous employer, I used web2py to build a few basic
> > applications. One was an application to input and track inventory
> > mistakes in warehouse operations. Another was a similar application to
> > input and track the results of daily audits performed by each
> > warehouse department. I also made an application to provide a daily
> > report of the toner and maintenance kit status in 40+ of our
> > production printers. Lastly, I made an application that our IT
> > department used to manage the logins and permissions of users for each
> > of these applications.
> > These projects were part of a bigger initiative to ween the facility
> > off of dependence on dozens of large and unmaintained Microsoft Access
> > databases. The rapid-development and multi-database-friendliness of
> > web2py made it the best tool for what I needed.
>
> > I won't be able to provide the company name, as I haven't maintained
> > contact with my previous employer. Likewise, I will not be able to
> > provide a screenshot, as the layout was branded with company logos.
>
> > I really like working with web2py. It's the first and only framework I
> > have learned so far, and these applications were the first of anything
> > useful I have built outside of "Hello World" in any language I have
> > ever attempted learning. By no means, do I consider myself a
> > programmer... and that's why I think python and web2py works for me
> > (the are, however, very talented programmers using web2py).
>
> > I was able to talk about this experience in a job-interview that
> > landed me at a company that offers MUCH more opportunity. I'd like to
> > thank everyone in the web2py community for being so much help and
> > doing such a great job.
>
> > Yours Truly...
>
> > On May 10, 5:09 pm, mdipierro  wrote:
>
> > > Anthony made some good 
> > > points:http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> > > For now let's concentrate on one of them for now. If you have
> > > developed software in web2py that you use internally in your company
> > > but you cannot release it open source, would you let us know? Can you
> > > tell us what is the software for? Could you provide a screenshot? Can
> > > we quote the name of the company?
>
> > > Massimo


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread blackthorne
great app! congratulations! Very good work!

You mention a set of features which is often asked in this group. Is
your app open source so that it can help answering them?
If yes, would you please tell us where to find it?

Thank you,
Best Regards

On May 12, 1:25 pm, selecta  wrote:
> I cannot get I to work
> I went tohttp://vimeo.com/10149605
> pressed my bookmarklet, it said saving
> but I cannot find any videos on my radbox page?
> did I do something wrong?
> I am using opera 10.53 Internal on ubuntu 10.04
>
> On May 11, 11:40 am, Adi  wrote:
>
>
>
> > I saw some discussions flying around about web2py applications and
> > users out there (http://groups.google.com/group/web2py/browse_thread/
> > thread/606b6e90744ab3b5)
> > and thought it would be a good time to talk about my application.
>
> > Radbox (http://radbox.me) is a video bookmarking service. Its still a
> > very young product, but I believe its pretty good at what it does.
>
> > Right now we're using web2py 1.77.3 for the application.
>
> > It has quite a few interesting features from a web2py developer's
> > perspective:
>
> > - custom auth_user table
> > - Facebook integration for sign-up and (very very soon) publish to
> > wall
> > - generic embedded video display using swfobject
> > - Twitter @anywhere integration (this is only in the view layer using
> > javascript)
> > - url rewrite using routes.py
> > - RSS feed (only for users, not visitors)
> > - Ajax "Like" and "Archive" implementation for every video
>
> > Many other things are under development. I mentioned the above because
> > lots of questions in this group are asked about these features.
>
> > Please take the app for a test drive, let me know your feedback and
> > questions on the implementation. My team and I are more than happy to
> > recommend web2py for full-blown professional web applications, and
> > we'll continue to bug this community (specially Massimo and Theadus)
> > every time we hit a rough patch. :)


[web2py] Re: session configuration

2010-05-12 Thread Śląski
The only thinks I found is:
For Auth operatons -> set  auth.settings.expiration
For all session -> set   response.cookies[response.session_id_name]
['expires']=
For permanently delete session ->
  auth.logout(); os.remove(response.session_filename);
  session=None;
  del response.cookies[response.session_id_name]

Ok - it is possible, but there is now solution like django
request.session.flush(), request.session.set_expiry  (http://
docs.djangoproject.com/en/1.1/topics/http/sessions/#topics-http-
sessions)

2. Is it possible to save session in database (not in file)? there is
a function session._try_store_in_db(), but how to set it to default?

Thanks for response




Re: [web2py] Problem with IS_URL

2010-05-12 Thread Jonathan Lundell
On May 12, 2010, at 6:09 AM, Sverre wrote:

> I have a field in DB to store URLs. But for the user this is optional.
> So the user should put in nothing or a URL. But if I use IS_URL in the
> database specification this field is demands always an URL. Is there a
> solution?

IS_EMPTY_OR(IS_URL())


[web2py] Re: Question about implementation of document storage

2010-05-12 Thread Sverre
Yes, you are right. The document is deleted.

Thank you for the answer. My question was a little bit stupid, but I
had my code was not ready.

On 12 Mai, 15:05, mdipierro  wrote:
> The old one should be deleted. Please try it and let is know if you
> have any problem with it.
>
> On May 12, 4:25 am, Sverre  wrote:
>
> > I have an upload field with the attribute autodelete=true. But what
> > will happen to a document fiel if I upload a new document instead of
> > delete the old one and then uploading a new document?


[web2py] Problem with IS_URL

2010-05-12 Thread Sverre
I have a field in DB to store URLs. But for the user this is optional.
So the user should put in nothing or a URL. But if I use IS_URL in the
database specification this field is demands always an URL. Is there a
solution?

Thanks in advance



[web2py] Re: Question about implementation of document storage

2010-05-12 Thread mdipierro
The old one should be deleted. Please try it and let is know if you
have any problem with it.

On May 12, 4:25 am, Sverre  wrote:
> I have an upload field with the attribute autodelete=true. But what
> will happen to a document fiel if I upload a new document instead of
> delete the old one and then uploading a new document?


[web2py] Re: session configuration

2010-05-12 Thread mdipierro
sessions themselves never expires in web2py. Auth does. You can change
the expiration-time in the session cookie and you can change the
auth.expiration time on a per user basis. Let me look more into this
is and repost.

On May 12, 3:30 am, Śląski  wrote:
> Hi,
>   Is it possible to configure session in some clear way? Different
> than changing some hard coded values.
> I just want to customize sessions for different users (for example
> user A has 5 min session expiration time, use B 30 min, user C has no
> session).
>
> The only solution I see now is to add a function, which is evaluated
> on each request and manually check the session time, and after that
> call session.forget().
> Is there better solution?
> Something like in Django session managment:
>   Browser-Length Sessions vs. Persistent Sessions, set_expiry(value),
> get_expiry_age(), get_expiry_date() ...
>    onhttp://www.djangobook.com/en/2.0/chapter14/


[web2py] Re: Question about sequences

2010-05-12 Thread mdipierro
postgresql
http://www.postgresql.org/docs/8.1/interactive/datatype.html

serial  4 bytes autoincrementing integer1 to 2147483647

We made sure they all start at 1.

On May 12, 1:38 am, Sverre  wrote:
> In the database administration a query to select all is (id>0). But
> some databases like postgresql starting a sequence default by 0, not
> like sqlite with 1. So how can I avoid problems?


[web2py] Re: Review my web2py app: Radbox.me

2010-05-12 Thread selecta
I cannot get I to work
I went to http://vimeo.com/10149605
pressed my bookmarklet, it said saving
but I cannot find any videos on my radbox page?
did I do something wrong?
I am using opera 10.53 Internal on ubuntu 10.04

On May 11, 11:40 am, Adi  wrote:
> I saw some discussions flying around about web2py applications and
> users out there (http://groups.google.com/group/web2py/browse_thread/
> thread/606b6e90744ab3b5)
> and thought it would be a good time to talk about my application.
>
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.
>
> Right now we're using web2py 1.77.3 for the application.
>
> It has quite a few interesting features from a web2py developer's
> perspective:
>
> - custom auth_user table
> - Facebook integration for sign-up and (very very soon) publish to
> wall
> - generic embedded video display using swfobject
> - Twitter @anywhere integration (this is only in the view layer using
> javascript)
> - url rewrite using routes.py
> - RSS feed (only for users, not visitors)
> - Ajax "Like" and "Archive" implementation for every video
>
> Many other things are under development. I mentioned the above because
> lots of questions in this group are asked about these features.
>
> Please take the app for a test drive, let me know your feedback and
> questions on the implementation. My team and I are more than happy to
> recommend web2py for full-blown professional web applications, and
> we'll continue to bug this community (specially Massimo and Theadus)
> every time we hit a rough patch. :)


[web2py] duplicate ids on using auth.login and auth.register forms on same page

2010-05-12 Thread Rohan
 I am using auth.login and auth.register forms on a single page and it
is resulting in duplicate ids for email and password rows.
similar discussions were going on this thread
http://groups.google.com/group/web2py/browse_frm/thread/e43c1203d8749630
Is there any update on this?


[web2py] Re: SQLFORM generating duplicate ids in HTML

2010-05-12 Thread Rohan
Any update on this? I am using auth.login and auth.register forms on a
single page and it is resulting in duplicate ids for email and
password rows.

Original thread - 
http://groups.google.com/group/web2py/browse_thread/thread/e43c1203d8749630?tvc=2


[web2py] Question about implementation of document storage

2010-05-12 Thread Sverre
I have an upload field with the attribute autodelete=true. But what
will happen to a document fiel if I upload a new document instead of
delete the old one and then uploading a new document?


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

2010-05-12 Thread cjrh
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.



[web2py] Re: Using LOAD from a controller?

2010-05-12 Thread selecta
Typo, it should be
cursor:pointer;
use this css style rather and href="#" so the page will not jump when
you click the "link"


On May 12, 10:42 am, selecta  wrote:
> or you could do
> 
>  onclick="web2py_component('{{=URL(request.application,'todo','todo_form')}}­­',
> 'mytarget');">New form
> 
>
> On May 12, 10:38 am, selecta  wrote:
>
>
>
> >  > onclick="web2py_component('{{=URL(request.application,'todo','todo_form')}}­­',
> > 'mytarget');">New todo
> > 
>
> > no need for def new():
>
> > On May 11, 10:16 pm, Keith Edmunds  wrote:
>
> > > I was to display a form using Ajax in response to a click on a link on the
> > > page. I have tried putting this in the view:
>
> > > New todo
> > > 
>
> > > with this in the controller:
>
> > > def new():
>
> > >     return = LOAD('todo','todo_form',ajax=True)
>
> > > def todo_form():
> > >     form = SQLFORM(db.tasks,fields=['priority','subject','duedate'])
> > >     if form.accepts(request.vars,session):
> > >         session.flash = 'record inserted'
> > >         redirect(URL(request.application,'default','index'))
> > >     return form
>
> > > ...but that doesn't work.
>
> > > I don't think I've fully understood how LOAD works - can someone point me
> > > in the right direction, please?


[web2py] Re: Using LOAD from a controller?

2010-05-12 Thread selecta
or you could do

New form


On May 12, 10:38 am, selecta  wrote:
>  onclick="web2py_component('{{=URL(request.application,'todo','todo_form')}}­',
> 'mytarget');">New todo
> 
>
> no need for def new():
>
> On May 11, 10:16 pm, Keith Edmunds  wrote:
>
>
>
> > I was to display a form using Ajax in response to a click on a link on the
> > page. I have tried putting this in the view:
>
> > New todo
> > 
>
> > with this in the controller:
>
> > def new():
>
> >     return = LOAD('todo','todo_form',ajax=True)
>
> > def todo_form():
> >     form = SQLFORM(db.tasks,fields=['priority','subject','duedate'])
> >     if form.accepts(request.vars,session):
> >         session.flash = 'record inserted'
> >         redirect(URL(request.application,'default','index'))
> >     return form
>
> > ...but that doesn't work.
>
> > I don't think I've fully understood how LOAD works - can someone point me
> > in the right direction, please?


[web2py] Re: Using LOAD from a controller?

2010-05-12 Thread selecta
New todo


no need for def new():

On May 11, 10:16 pm, Keith Edmunds  wrote:
> I was to display a form using Ajax in response to a click on a link on the
> page. I have tried putting this in the view:
>
> New todo
> 
>
> with this in the controller:
>
> def new():
>
>     return = LOAD('todo','todo_form',ajax=True)
>
> def todo_form():
>     form = SQLFORM(db.tasks,fields=['priority','subject','duedate'])
>     if form.accepts(request.vars,session):
>         session.flash = 'record inserted'
>         redirect(URL(request.application,'default','index'))
>     return form
>
> ...but that doesn't work.
>
> I don't think I've fully understood how LOAD works - can someone point me
> in the right direction, please?


[web2py] session configuration

2010-05-12 Thread Śląski
Hi,
  Is it possible to configure session in some clear way? Different
than changing some hard coded values.
I just want to customize sessions for different users (for example
user A has 5 min session expiration time, use B 30 min, user C has no
session).

The only solution I see now is to add a function, which is evaluated
on each request and manually check the session time, and after that
call session.forget().
Is there better solution?
Something like in Django session managment:
  Browser-Length Sessions vs. Persistent Sessions, set_expiry(value),
get_expiry_age(), get_expiry_date() ...
   on http://www.djangobook.com/en/2.0/chapter14/