[web2py] Re: Bug or break with backwards compatibility?

2010-10-24 Thread mdipierro
If this worked was a bug. You cannot extend two views.

You can do this:

layout.html
htmlhead/headbody{{include}}/body/html

main.html
{{extend 'layout.html'}} div my body stuff here /div

Or you can do this:

header.html
htmlhead/headbody

footer.html
/body/html

main.html
{{include 'header.html'}} div my body stuff here /div{{include
'footer.html'}}


You can have various combination of the two but not the one you used.
As explained in the manual the view hierarchy is a try. Extend points
to a parent. A node in a tree cannot have two parents.


On Oct 24, 12:37 am, b00m_chef r...@devshell.org wrote:
 I noticed my app from a few releases back stopped working with regard
 to the view. I had a file that extended 2 files (a header.html, and a
 footer.html), it then included (in-between the 2 extends) a body.

 Only the last extend will execute in the below main.html file in the
 current release (1.87.3), however, in previous versions (a few months
 ago) this would work as expected:

 header.html
 htmlhead/headbody{{include}}

 footer.html
 {{include}}/body/html

 main.html
 {{extend 'header.html'}} div my body stuff here /div{{extend
 'footer.html'}}


[web2py] Re: Bug or break with backwards compatibility?

2010-10-24 Thread b00m_chef
My desired result was achieved...Thanks to your explanation above. I
wanted to have 1 html file linking the two header.html and footer.html
files. This example would be good to have in the book as it really
shows how the extend  includes work...at least it explained it better
for me (the book's example is too simple). I wanted to have 1 extend
at the top of the body.html file...here is what I did:

header.html
htmlhead/headbody

footer.html
/body/html

main.html
{{include 'header.html'}} div my body stuff here /div{{include
'footer.html'}}

body.html
{{extend 'main.html'}}div my body stuff here!/div





On Oct 23, 11:02 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 If this worked was a bug. You cannot extend two views.

 You can do this:

 layout.html
 htmlhead/headbody{{include}}/body/html

 main.html
 {{extend 'layout.html'}} div my body stuff here /div

 Or you can do this:

 header.html
 htmlhead/headbody

 footer.html
 /body/html

 main.html
 {{include 'header.html'}} div my body stuff here /div{{include
 'footer.html'}}

 You can have various combination of the two but not the one you used.
 As explained in the manual the view hierarchy is a try. Extend points
 to a parent. A node in a tree cannot have two parents.

 On Oct 24, 12:37 am, b00m_chef r...@devshell.org wrote:



  I noticed my app from a few releases back stopped working with regard
  to the view. I had a file that extended 2 files (a header.html, and a
  footer.html), it then included (in-between the 2 extends) a body.

  Only the last extend will execute in the below main.html file in the
  current release (1.87.3), however, in previous versions (a few months
  ago) this would work as expected:

  header.html
  htmlhead/headbody{{include}}

  footer.html
  {{include}}/body/html

  main.html
  {{extend 'header.html'}} div my body stuff here /div{{extend
  'footer.html'}}


[web2py] Re: Bug or break with backwards compatibility?

2010-10-24 Thread mdipierro
Why keep them in separate files? You may also want to check the new
{{block name}}..{{end}} feature. It is described in the book.

On Oct 24, 1:10 am, b00m_chef r...@devshell.org wrote:
 My desired result was achieved...Thanks to your explanation above. I
 wanted to have 1 html file linking the two header.html and footer.html
 files. This example would be good to have in the book as it really
 shows how the extend  includes work...at least it explained it better
 for me (the book's example is too simple). I wanted to have 1 extend
 at the top of the body.html file...here is what I did:

 header.html
 htmlhead/headbody

 footer.html
 /body/html

 main.html
 {{include 'header.html'}} div my body stuff here /div{{include
 'footer.html'}}

 body.html
 {{extend 'main.html'}}div my body stuff here!/div

 On Oct 23, 11:02 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  If this worked was a bug. You cannot extend two views.

  You can do this:

  layout.html
  htmlhead/headbody{{include}}/body/html

  main.html
  {{extend 'layout.html'}} div my body stuff here /div

  Or you can do this:

  header.html
  htmlhead/headbody

  footer.html
  /body/html

  main.html
  {{include 'header.html'}} div my body stuff here /div{{include
  'footer.html'}}

  You can have various combination of the two but not the one you used.
  As explained in the manual the view hierarchy is a try. Extend points
  to a parent. A node in a tree cannot have two parents.

  On Oct 24, 12:37 am, b00m_chef r...@devshell.org wrote:

   I noticed my app from a few releases back stopped working with regard
   to the view. I had a file that extended 2 files (a header.html, and a
   footer.html), it then included (in-between the 2 extends) a body.

   Only the last extend will execute in the below main.html file in the
   current release (1.87.3), however, in previous versions (a few months
   ago) this would work as expected:

   header.html
   htmlhead/headbody{{include}}

   footer.html
   {{include}}/body/html

   main.html
   {{extend 'header.html'}} div my body stuff here /div{{extend
   'footer.html'}}




Re: [web2py] AWS Free Tier

2010-10-24 Thread Luis Díaz
cuales serian los a favor  y los contras en comparación a Google app engine?

what would be the pros and cons compared to Google App Engine?


2010/10/22 glimmung phil.kil...@gmail.com

 Hi All,

 For anyone looking for hosting, Amazon's recent announcement of the
 AWS Free Tier may be of interest: -

 http://aws.amazon.com/free/

 HTH

 --

 Cheers,

 PhilK




-- 
Díaz Luis
TSU Analisis de Sistemas
Universidad de Carabobo

http://web2pyfacil.blogspot.com/
Facultad de 
Odontologíahttp://www.odontologia.uc.edu.ve/index.php?option=com_contentview=articleid=102Itemid=85


[web2py] Should forms be defined in the controller or the view?

2010-10-24 Thread Luther Goh Lu Feng
I am wondering what are the issues to be considered when deciding where to 
generate a form. Is it better to do so in the controller or in the view? Or is 
it just a matter of personal preference?

An example code snippet is show below. Given that first() and second() actions 
generates identical forms, is it better to generate the form in some_view.html, 
instead of in the controller, considering efficiency and DRY?

===
# some_view.html

{{=some_form}}

# first.html
{{ extend some_view.html }}

# second.html
{{ extend some_view.html }}

#default.py
def first():
...
some_form = #SQLFORM code
...
return {'some_form':some_form}

def second():
...
some_form = #SQLFORM code  
...
return {'some_form':some_form}

=


  


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 2:20 am, Branko Vukelic bg.bra...@gmail.com wrote:
 How is the data 'associated' with the link?

Say I have a table of 10 items.   In each row, there is a link to the
same URL.  However, I want to access row-specific data in the target
controller function, without supplying that data through the URL
itself.

This suggests to me use the session object, but the problem is that
I don't know how to store something in the session when a link is
clicked.

Alternatively, I guess I could use a separate FORM on each row of the
table, and use a form button instead of a link (then I could access
request.vars).

Is my question clear?  I am new to web programming so I don't know
have all the domain jargon correct yet.


[web2py] $.ajax() call uses different session

2010-10-24 Thread cjrh
As a side-issue from another post I made recently, it seems to be the
case that when javascript $.ajax() method is executed, and it points
to a controller function, a different session is used in that target
controller function than the original one.  This could be because the
session cookie is not being submitted in the ajax call itself.  Has
anyone else seen this?  Is there a way to get fix it?


[web2py] Re: Should forms be defined in the controller or the view?

2010-10-24 Thread cjrh
On Oct 24, 10:32 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
 I am wondering what are the issues to be considered when deciding where to
 generate a form. Is it better to do so in the controller or in the view?

I am a beginner at web apps, but my feeling is that since forms are
concerned with specific variable names, and these names are likely
required to be known in the controller functions, it seems better to
define the forms in the controller functions.


[web2py] Re: $.ajax() call uses different session

2010-10-24 Thread cjrh
On Oct 24, 11:13 am, cjrh caleb.hatti...@gmail.com wrote:
 As a side-issue from another post I made recently, it seems to be the
 case that when javascript $.ajax() method is executed, and it points
 to a controller function, a different session is used in that target
 controller function than the original one.  This could be because the
 session cookie is not being submitted in the ajax call itself.  Has
 anyone else seen this?  Is there a way to get fix it?

Ok, I was wrong about pretty much everything:

1) $.ajax() DOES send all the cookies back

2) The session variable IS the same session variable, and it does
update correctly

3) My problem was a race condition.  The function changing the session
as a result of the $.ajax call was being triggered slightly later than
the page refresh itself (I was calling an ajax function in the onclick
event of an A() tag.)   I solved my issue by doing the ajax session
update synchronously, IOW the link redirect had to wait.

So, nothing to see here, move along :)


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 1:56 am, cjrh caleb.hatti...@gmail.com wrote:
 Would I have to use javascript?

 My tests below doesn't seem to permanently update the session object
 inside setnum(), even though request.args does contain the number sent
 by ajax.  Inside showme(), the session value is default once again,
 making me thing the cookies are somehow required in the ajax call.

Ok, I was wrong.  Everything does work as expected, provided you do
the following:

A(
'Click Me',
_href=URL(f='showme'),
_onclick=XML($.ajax({url: 'setnum/ + str(i) + ', async:
false}))
)

The trick there is the async: false.  My problem was a race between
the ajax session update (inside controller function setnum) versus the
page display of session status in controller function showme().

It all now works as expected, however, I remain unsure about this as a
viable strategy anyway.  I would love to hear about best practice here.


[web2py] How to use steaky

2010-10-24 Thread dbb
There is a very good feature of web2py called steaky, I need
documentation that includes tutorial. I want to use it.Debebe


[web2py] support for Daytona database

2010-10-24 Thread dbb
Out there, there is  a database called daytona, it uses C, and on top
of C there is  Cymbl that takes SQL and translate that to Cymbl, then
Cymbl gets translated to C for the database to understand the request.
This is a very complicated powerful database.

My question is : since web2py is a powerful simple framework, can it
simplify daytona? I have no more information about daytona, they said
the firm that developed it has placed it as an open source, but not
sure. Daytona is a very powerful database that can store billions of
rows of data; they said: you stop using daytona when you ran out of
space ( hardware), or when you do not have any more data to store. For
web2py supporting daytona will give it a high visibility. Debebe


Re: [web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread Branko Vukelic
On Sun, Oct 24, 2010 at 4:16 PM, cjrh caleb.hatti...@gmail.com wrote:
 I want to know if there is a way to get data to go from a page to a
 controller function via an HTTP link, rather than using a form, and
 without showing that data on the URL.

AFAIK, you only get to use two HTTP methods (regardless of whether
AJAX is involved or not): GET and POST. GET uses query params to pass
around values (in the URL as you say), and POST sends them inside the
request. There are no other options.

At any length, web is stateless. It means that the server-side doesn't
have to know what the user was doing on the previous page when
processing a request. This implies that everything you have to know
when server is processing a request, has to be made available to the
server at the time request is made. Fighting that is time-consuming,
and usually not a very good idea.

In your case, the best way is actually number 1: use GET. This results
in a single request, and that's how HTTP is supposed to work. Since
you say the data is already in the table on the page, there's no point
in trying to hide it, especially since POST isn't really hiding
anything if someone really wants to get ahold of request data.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Re: Function that does not require a view

2010-10-24 Thread Jason Brower
I personally put them in a special section of the file I am using.  It's
easier to me.  If you need to restrict access to it you can use the same
decorators you normally use too.

On Sun, 2010-10-24 at 07:11 -0700, mdipierro wrote: 

 If a function returns a string it does not require a view.
 
 On Oct 24, 7:18 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
  If I have a function that I intend to call from different controllers, but I
  have no need for the function to have a view, where should this function be
  defined? eg. a function that simply calculates the outcome of a math 
  formula,
  and several controllers will call this function to display the result.
 
  Should it be defined within a controller, or elsewhere?




[web2py] Re: Should forms be defined in the controller or the view?

2010-10-24 Thread Luther Goh Lu Feng
So this will be considered an acceptable violation of DRY?

On Oct 24, 10:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 In the controllers. For sure. If you put forms in view you will be
 forced to put other logic in view and soon you end up with something
 non-maintainable like PHP code.

 form processing determines redirect therefore workflow. They belong to
 controllers.

 On Oct 24, 4:18 am, cjrh caleb.hatti...@gmail.com wrote:







  On Oct 24, 10:32 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

   I am wondering what are the issues to be considered when deciding where to
   generate a form. Is it better to do so in the controller or in the view?

  I am a beginner at web apps, but my feeling is that since forms are
  concerned with specific variable names, and these names are likely
  required to be known in the controller functions, it seems better to
  define the forms in the controller functions.


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 4:29 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 Since
 you say the data is already in the table on the page, there's no point
 in trying to hide it, especially since POST isn't really hiding
 anything if someone really wants to get ahold of request data.

The datum in my case is a room rate that a client must pay.
Recalculation is somewhat complicated, and I had hoped to avoid a
recalculation and just pass the already-calculated value to the
confirmation page.  I cannot let that be part of the URL for obvious
reasons, and I suspect having it appear in postdata will also be
problematic.  One the first page, the user select one of many rates.
In the following page, I ask for confirmation.   How to get the
previously-calculated rate over to the confirmation page?

Probably the safest is for me to calculate it again, I guess.

FWIW I solved my state problem with a form post, as you suggested:

def testajax2():
rows=[]
for i in range(10):
rows.append(
TR(
'A cottage on the river','','','',
 INPUT(_name='b'+str(i), _value='Book Now!',
_type='submit', _onclick=XML(
   $('#choice').val(' + str(i) + '); $
('#disposition').val(' + str(i*10) + '); $('#weaponry').val(' +
str(i*100) + ')))
 )
)
return dict(form=FORM(
  INPUT(_name='choice', _id='choice', _type='hidden',
value='0'),
  INPUT(_name='disposition', _id='disposition',
_type='hidden', value='0'),
  INPUT(_name='weaponry', _id='weaponry',
_type='hidden', value='0'),
  TABLE(rows),
  _action=URL(f=showme)
  )
   )

There are a bunch of submit buttons in one form which contains a table
with many rows.  The onclick event of the submit button sets the
values of three hidden input fields in the form.  My previous
javascript attempts would be no safer anyway, because the setter URL
would still have been visible in the page source.

So as I said, looks like the safest is for me to simply calculate the
rate again.


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 4:43 pm, cjrh caleb.hatti...@gmail.com wrote:

 So as I said, looks like the safest is for me to simply calculate the
 rate again.

On the server-side, I mean.  Dunno if that was clear.


[web2py] Re: Should forms be defined in the controller or the view?

2010-10-24 Thread cjrh
On Oct 24, 4:43 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:
 So this will be considered an acceptable violation of DRY?

There is no DRY violation.


Re: [web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread Branko Vukelic
On Sun, Oct 24, 2010 at 4:43 PM, cjrh caleb.hatti...@gmail.com wrote:
 The datum in my case is a room rate that a client must pay.
 Recalculation is somewhat complicated, and I had hoped to avoid a
 recalculation and just pass the already-calculated value to the
 confirmation page.  I cannot let that be part of the URL for obvious
 reasons, and I suspect having it appear in postdata will also be
 problematic.  One the first page, the user select one of many rates.
 In the following page, I ask for confirmation.   How to get the
 previously-calculated rate over to the confirmation page?

Here's how I'd do it.

# PAGE 1
* Users enters the desired options

# SERVER-SIDE
* Values are calculated and fed into a template

# PAGE 2
* Calculated values are shown, and a form with hidden fields and a
submit button labeled 'Confirm' is shown

# SERVER-SIDE
* The submitted values are entered in a database and fed into the
thank-you page template

# PAGE 3
* Thank you message with calculated data again and optional Nah, I
was jist kiddin' button.


-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Re: How to use steaky

2010-10-24 Thread dbb
OK, Massimo, how can I use rocket, is there documentation? Debebe

On Oct 24, 10:09 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Sorry I do not understand. Do you refer to the old sneaky web
 server? That was experimental and has been replaced with rocket (gluon/
 rocket.py)

 On Oct 24, 5:22 am, dbb asefa.deb...@gmail.com wrote:

  There is a very good feature of web2py called steaky, I need
  documentation that includes tutorial. I want to use it.Debebe




[web2py] Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread Luther Goh Lu Feng
I have created a dropdown list, using SQLFORM.factory which will autosubmitted 
using ajax when there is a change in selection.

However the form generated has a submit button, which I would like to hide. I 
would like to ask for tips regarding this.


  


Re: [web2py] Re: How to use steaky

2010-10-24 Thread Branko Vukelic
On Sun, Oct 24, 2010 at 5:16 PM, dbb asefa.deb...@gmail.com wrote:
 OK, Massimo, how can I use rocket, is there documentation? Debebe

Massimo pointed this thread out to me:

http://groups.google.com/group/web2py/browse_thread/thread/f0ac5c1d34480565

It's a good start.


-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread mr.freeze
This is how I do it. There may be a better way.

def myform():
form = SQLFORM.factory(Field('test'))
submit = form.element('input',_type='submit')
submit['_style'] = 'display:none;'
return dict(form=form)

You could always just use a CSS rule too


On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
 I have created a dropdown list, using SQLFORM.factory which will autosubmitted
 using ajax when there is a change in selection.

 However the form generated has a submit button, which I would like to hide. I
 would like to ask for tips regarding this.


[web2py] Re: Generically accessing the results of select

2010-10-24 Thread BigBaaadBob


On Oct 23, 10:52 pm, ron_m ron.mco...@gmail.com wrote:
 The rows is a dict so if you apply the keys() function you get a list
 of keys or values returns a list of values under the keys.

 rows = big_hairy_select_with_joins

 for row in rows:
   for table in row.values()
     for field in table.values()

Yes, it is a dict of dicts.   But the above doesn't return the vals in
the order they were queried.  If you are generating, say, JSON for
jqGrid, you need to know the order of the data.

Massimo's comment does what I want to do (and what I was already
doing), but I somehow felt that going to the second level the
[internal dicts] was relying on an internal implementation detail of
Row.

I was naively thinking that since Rows has colnames in the format
'table.column' that Row would know how to r['table.column'].
Actually, I still do.   ;-)

 rows_list = (big_hairy_select_with_joins).select().as_list()

 So now the query result is processed generically with no prior
 knowledge of the table or column names?

Again, that doesn't return them in the order queried.


[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread Luther Goh Lu Feng
I see. How do I filter the specific form that has id='myform'?

On Oct 24, 11:30 pm, mr.freeze nat...@freezable.com wrote:
 This is how I do it. There may be a better way.

 def myform():
     form = SQLFORM.factory(Field('test'))
     submit = form.element('input',_type='submit')
     submit['_style'] = 'display:none;'
     return dict(form=form)

 You could always just use a CSS rule too

 On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:







  I have created a dropdown list, using SQLFORM.factory which will 
  autosubmitted
  using ajax when there is a change in selection.

  However the form generated has a submit button, which I would like to hide. 
  I
  would like to ask for tips regarding this.


[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread mr.freeze
How are you creating the form? Can you show the code?

On Oct 24, 10:45 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
 I see. How do I filter the specific form that has id='myform'?

 On Oct 24, 11:30 pm, mr.freeze nat...@freezable.com wrote:

  This is how I do it. There may be a better way.

  def myform():
      form = SQLFORM.factory(Field('test'))
      submit = form.element('input',_type='submit')
      submit['_style'] = 'display:none;'
      return dict(form=form)

  You could always just use a CSS rule too

  On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

   I have created a dropdown list, using SQLFORM.factory which will 
   autosubmitted
   using ajax when there is a change in selection.

   However the form generated has a submit button, which I would like to 
   hide. I
   would like to ask for tips regarding this.




[web2py] confused about services and authorization

2010-10-24 Thread david.waldrop
I have spent the bulk of last evening and this morning trying to test
web2py services and authorization.  In addition to setting
auth.settings.allow_basic_login = True I have deleted the call
function in the default controller, created a seperate controller
mmservices,and and populated with the following code:

@auth.requires_login()
def call():

exposes services. for example:
http:///[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv

session.forget()
return service()


@service.xmlrpc
def getmeetings():
if auth.is_logged_in():
return 'you are logged in!'
else:
return 'NO DICE'


@service.xmlrpc
def test(insink):
if auth.is_logged_in():
return 'test: you are logged in!'
else:
return 'test: NO DICE'


My questions are:

1) what is the purpose of the call function?  I see that it is part
of the proxy when invoking, but am not sure where it gets invoked or
what it does.  Does there need to be a separate call for each web-
service function (as I saw in a forum post)?

2) when i enter http://www.meetingmonkey.net/init/mmservices/getmeetings
without logging in I get no dice. I suspect this is due to the fact
that I am accessing the function because it is in a controller.  This
is not the desired behavior as I want to ensure the user has logged in
before getting access to the function.  Is there a complete example of
the best practice for implementing web-services including where to put
various parts of code?

3) when I enter 
http://www.meetingmonkey.net/init/mmservices/call/xmlrpc/getmeetings
without logging 8in I am redirected to the login page.  I would rather
just return an unauthorized error, but do not know how to do?


[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread Luther Goh Lu Feng

conversation_dropdown = SQLFORM.factory(
Field('text', label='Select a conversation',
 requires=IS_IN_DB(db,
'question.id','question.text')),
   _id='conversation_dropdown')

On Oct 24, 11:47 pm, mr.freeze nat...@freezable.com wrote:
 How are you creating the form? Can you show the code?

 On Oct 24, 10:45 am, Luther Goh Lu Feng elf...@yahoo.com wrote:







  I see. How do I filter the specific form that has id='myform'?

  On Oct 24, 11:30 pm, mr.freeze nat...@freezable.com wrote:

   This is how I do it. There may be a better way.

   def myform():
       form = SQLFORM.factory(Field('test'))
       submit = form.element('input',_type='submit')
       submit['_style'] = 'display:none;'
       return dict(form=form)

   You could always just use a CSS rule too

   On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

I have created a dropdown list, using SQLFORM.factory which will 
autosubmitted
using ajax when there is a change in selection.

However the form generated has a submit button, which I would like to 
hide. I
would like to ask for tips regarding this.


[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread mr.freeze
submit = conversion_form.element('input',_type='submit')
submit['_style'] = 'display:none;'

or with CSS

form#conversion_dropdown input[type=submit] {
  display:none;
}

On Oct 24, 11:36 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
 conversation_dropdown = SQLFORM.factory(
                 Field('text', label='Select a conversation',
                  requires=IS_IN_DB(db,
 'question.id','question.text')),
                _id='conversation_dropdown')

 On Oct 24, 11:47 pm, mr.freeze nat...@freezable.com wrote:

  How are you creating the form? Can you show the code?

  On Oct 24, 10:45 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

   I see. How do I filter the specific form that has id='myform'?

   On Oct 24, 11:30 pm, mr.freeze nat...@freezable.com wrote:

This is how I do it. There may be a better way.

def myform():
    form = SQLFORM.factory(Field('test'))
    submit = form.element('input',_type='submit')
    submit['_style'] = 'display:none;'
    return dict(form=form)

You could always just use a CSS rule too

On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

 I have created a dropdown list, using SQLFORM.factory which will 
 autosubmitted
 using ajax when there is a change in selection.

 However the form generated has a submit button, which I would like to 
 hide. I
 would like to ask for tips regarding this.




[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread Luther Goh Lu Feng
I see. I am enlightened. Thank you so much!

On Oct 25, 12:48 am, mr.freeze nat...@freezable.com wrote:
 submit = conversion_form.element('input',_type='submit')
 submit['_style'] = 'display:none;'

 or with CSS

 form#conversion_dropdown input[type=submit] {
   display:none;

 }

 On Oct 24, 11:36 am, Luther Goh Lu Feng elf...@yahoo.com wrote:







  conversation_dropdown = SQLFORM.factory(
                  Field('text', label='Select a conversation',
                   requires=IS_IN_DB(db,
  'question.id','question.text')),
                 _id='conversation_dropdown')

  On Oct 24, 11:47 pm, mr.freeze nat...@freezable.com wrote:

   How are you creating the form? Can you show the code?

   On Oct 24, 10:45 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

I see. How do I filter the specific form that has id='myform'?

On Oct 24, 11:30 pm, mr.freeze nat...@freezable.com wrote:

 This is how I do it. There may be a better way.

 def myform():
     form = SQLFORM.factory(Field('test'))
     submit = form.element('input',_type='submit')
     submit['_style'] = 'display:none;'
     return dict(form=form)

 You could always just use a CSS rule too

 On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

  I have created a dropdown list, using SQLFORM.factory which will 
  autosubmitted
  using ajax when there is a change in selection.

  However the form generated has a submit button, which I would like 
  to hide. I
  would like to ask for tips regarding this.


[web2py] Ajax example demo broken?

2010-10-24 Thread Luther Goh Lu Feng
I am trying out example 44 at

http://web2py.com/examples/default/examples


This is the demo http://web2py.com/examples/default/examples

Nothing happens when I click the submit button. The webpage stays the
same. Is the demo broken?


[web2py] Re: Hiding the submit button of an form generated by SQLFORM.factory

2010-10-24 Thread Luther Goh Lu Feng
Correcting a small typo for the benefit of others who may stumble upon
the thread :)

submit = conversion_dropdown.element('input',_type='submit')

On Oct 25, 12:53 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
 I see. I am enlightened. Thank you so much!

 On Oct 25, 12:48 am, mr.freeze nat...@freezable.com wrote:







  submit = conversion_form.element('input',_type='submit')
  submit['_style'] = 'display:none;'

  or with CSS

  form#conversion_dropdown input[type=submit] {
    display:none;

  }

  On Oct 24, 11:36 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

   conversation_dropdown = SQLFORM.factory(
                   Field('text', label='Select a conversation',
                    requires=IS_IN_DB(db,
   'question.id','question.text')),
                  _id='conversation_dropdown')

   On Oct 24, 11:47 pm, mr.freeze nat...@freezable.com wrote:

How are you creating the form? Can you show the code?

On Oct 24, 10:45 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

 I see. How do I filter the specific form that has id='myform'?

 On Oct 24, 11:30 pm, mr.freeze nat...@freezable.com wrote:

  This is how I do it. There may be a better way.

  def myform():
      form = SQLFORM.factory(Field('test'))
      submit = form.element('input',_type='submit')
      submit['_style'] = 'display:none;'
      return dict(form=form)

  You could always just use a CSS rule too

  On Oct 24, 10:21 am, Luther Goh Lu Feng elf...@yahoo.com wrote:

   I have created a dropdown list, using SQLFORM.factory which will 
   autosubmitted
   using ajax when there is a change in selection.

   However the form generated has a submit button, which I would 
   like to hide. I
   would like to ask for tips regarding this.


[web2py] Re: Ajax example demo broken?

2010-10-24 Thread mr.freeze
The ajax request is completing successfully but it is only returning
an empty table. There must not be anything in session.m .

On Oct 24, 12:00 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:
 I am trying out example 44 at

 http://web2py.com/examples/default/examples

 This is the demohttp://web2py.com/examples/default/examples

 Nothing happens when I click the submit button. The webpage stays the
 same. Is the demo broken?


[web2py] Grouping fields

2010-10-24 Thread Massimiliano
Hello,

is there a simple way to group fields?

I have a big table with about 70 fields and I want to group them in the view
in some tabs.

How can I group them?

What I thought is to use table inheritance, so that I have my groups already
formed in virtual table defs and the db def is also more readable.

After that I will create containers directly in view via js/jquery.

Is there a better way?

Would be nice if we can add something in field defs so that SQLFORM can
group them directly :D

Thank you
-- 
Massimiliano


[web2py] Re: Function that does not require a view

2010-10-24 Thread JimK
You can leave the function in the controller file but pre-pend __ to
the name.  This is the Python way to create private functions and it
appears to be supported well in Web2Py.

An example would be:

def __privateFunc():



On Oct 24, 5:18 am, Luther Goh Lu Feng elf...@yahoo.com wrote:
 If I have a function that I intend to call from different controllers, but I
 have no need for the function to have a view, where should this function be
 defined? eg. a function that simply calculates the outcome of a math formula,
 and several controllers will call this function to display the result.

 Should it be defined within a controller, or elsewhere?


[web2py] Re: Ajax example demo broken?

2010-10-24 Thread Luther Goh Lu Feng
Any idea why the value in input id=q / is not captured in
session.m?

On Oct 25, 1:09 am, mr.freeze nat...@freezable.com wrote:
 The ajax request is completing successfully but it is only returning
 an empty table. There must not be anything in session.m .

 On Oct 24, 12:00 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:







  I am trying out example 44 at

 http://web2py.com/examples/default/examples

  This is the demohttp://web2py.com/examples/default/examples

  Nothing happens when I click the submit button. The webpage stays the
  same. Is the demo broken?


[web2py] Re: Function that does not require a view

2010-10-24 Thread Luther Goh Lu Feng
Tks for the helpful replies.

On Oct 25, 1:21 am, JimK jkel...@gmail.com wrote:
 You can leave the function in the controller file but pre-pend __ to
 the name.  This is the Python way to create private functions and it
 appears to be supported well in Web2Py.

 An example would be:

 def __privateFunc():

 On Oct 24, 5:18 am, Luther Goh Lu Feng elf...@yahoo.com wrote:







  If I have a function that I intend to call from different controllers, but I
  have no need for the function to have a view, where should this function be
  defined? eg. a function that simply calculates the outcome of a math 
  formula,
  and several controllers will call this function to display the result.

  Should it be defined within a controller, or elsewhere?


[web2py] Re: How to use steaky

2010-10-24 Thread mdipierro
When you starts web2py (I think you use windows)

web2py.exe

it starts the rocket web server. There is not much you need to know
except:

Use IP 0.0.0.0 to serve pages publicly.

User web2py.exe -h for more options. Only two options concern rocket (-
c, -k).

Massimo



On Oct 24, 10:16 am, dbb asefa.deb...@gmail.com wrote:
 OK, Massimo, how can I use rocket, is there documentation? Debebe

 On Oct 24, 10:09 am, mdipierro mdipie...@cs.depaul.edu wrote:

  Sorry I do not understand. Do you refer to the old sneaky web
  server? That was experimental and has been replaced with rocket (gluon/
  rocket.py)

  On Oct 24, 5:22 am, dbb asefa.deb...@gmail.com wrote:

   There is a very good feature of web2py called steaky, I need
   documentation that includes tutorial. I want to use it.Debebe




[web2py] Re: confused about services and authorization

2010-10-24 Thread mdipierro
I am not sure you should register services in controller, unless you
also want to expose them as actions. I normally put them in a model.
Anyway...

@service.xmlrpc
@service.jsonrpc
@service.whetever

register a function as a service

def call(): return service()

simply exposes all services.

You can do

@auth.requires(auth.user)
def call(): return service()

and you will get an unauthorized error


On Oct 24, 11:19 am, david.waldrop david.wald...@gmail.com wrote:
 I have spent the bulk of last evening and this morning trying to test
 web2py services and authorization.  In addition to setting
 auth.settings.allow_basic_login = True I have deleted the call
 function in the default controller, created a seperate controller
 mmservices,and and populated with the following code:

 @auth.requires_login()
 def call():
     
     exposes services. for example:
    http:///[app]/default/call/jsonrpc
     decorate with @services.jsonrpc the functions to expose
     supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
     
     session.forget()
     return service()

 @service.xmlrpc
 def getmeetings():
     if auth.is_logged_in():
         return 'you are logged in!'
     else:
         return 'NO DICE'

 @service.xmlrpc
 def test(insink):
     if auth.is_logged_in():
         return 'test: you are logged in!'
     else:
         return 'test: NO DICE'

 My questions are:

 1) what is the purpose of the call function?  I see that it is part
 of the proxy when invoking, but am not sure where it gets invoked or
 what it does.  Does there need to be a separate call for each web-
 service function (as I saw in a forum post)?

 2) when i enterhttp://www.meetingmonkey.net/init/mmservices/getmeetings
 without logging in I get no dice. I suspect this is due to the fact
 that I am accessing the function because it is in a controller.  This
 is not the desired behavior as I want to ensure the user has logged in
 before getting access to the function.  Is there a complete example of
 the best practice for implementing web-services including where to put
 various parts of code?

 3) when I 
 enterhttp://www.meetingmonkey.net/init/mmservices/call/xmlrpc/getmeetings
 without logging 8in I am redirected to the login page.  I would rather
 just return an unauthorized error, but do not know how to do?


[web2py] Re: Grouping fields

2010-10-24 Thread mdipierro
You should use a custom form {{=form.custom.begin}}...
{{=form.custom.end}}

On Oct 24, 12:18 pm, Massimiliano mbelle...@gmail.com wrote:
 Hello,

 is there a simple way to group fields?

 I have a big table with about 70 fields and I want to group them in the view
 in some tabs.

 How can I group them?

 What I thought is to use table inheritance, so that I have my groups already
 formed in virtual table defs and the db def is also more readable.

 After that I will create containers directly in view via js/jquery.

 Is there a better way?

 Would be nice if we can add something in field defs so that SQLFORM can
 group them directly :D

 Thank you
 --
 Massimiliano


[web2py] Re: Ajax example demo broken?

2010-10-24 Thread mdipierro
I think the new examples app is , by mistake, not saving the session.
Will fix it soon. The code is correct.

On Oct 24, 12:09 pm, mr.freeze nat...@freezable.com wrote:
 The ajax request is completing successfully but it is only returning
 an empty table. There must not be anything in session.m .

 On Oct 24, 12:00 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:

  I am trying out example 44 at

 http://web2py.com/examples/default/examples

  This is the demohttp://web2py.com/examples/default/examples

  Nothing happens when I click the submit button. The webpage stays the
  same. Is the demo broken?




[web2py] Re: Ajax example demo broken?

2010-10-24 Thread Luther Goh Lu Feng
I see. I think the indentation of def data(): is also one level too
deep.

On Oct 25, 1:43 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I think the new examples app is , by mistake, not saving the session.
 Will fix it soon. The code is correct.

 On Oct 24, 12:09 pm, mr.freeze nat...@freezable.com wrote:







  The ajax request is completing successfully but it is only returning
  an empty table. There must not be anything in session.m .

  On Oct 24, 12:00 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:

   I am trying out example 44 at

  http://web2py.com/examples/default/examples

   This is the demohttp://web2py.com/examples/default/examples

   Nothing happens when I click the submit button. The webpage stays the
   same. Is the demo broken?


RE: [web2py] Re: confused about services and authorization

2010-10-24 Thread David Waldrop
Massimo, moving the function out of the controller enabled me to
successfully invoke the function via xmlrpc on my development machine, but
not on the production version.  In the forum I see that this (303)
supposedly indicates invalid authorization, but the testing credentials are
valid on both sites.  I did so by issuing the following at the python
console:

Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
on
win32
Type help, copyright, credits or license for more information.

 import xmlrpclib

 server =
xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetingmon
key.net/init/default/call/xmlrpc)

 server2 =
xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:800
0/mm_beta_1/default/call/xmlrpc)

 server.getmeetings()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
return self.__send(self.__name, args)
  File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
verbose=self.__verbose
  File C:\Python26\lib\xmlrpclib.py, line 1243, in request
headers
xmlrpclib.ProtocolError: ProtocolError for
david.wald...@gmail.com:x...@www.meet
ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER

 server2.getmeetings()
'you are logged in!'

Do I need to enables something special in the environment other than
auth.settings.allow_basic_login = True, which is already set.  Alos, is this
a recommended way of passing credentials to a web2py services, it seems as
if they may be exposed in the clear during transport???

/david


-Original Message-
From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of
mdipierro
Sent: Sunday, October 24, 2010 1:38 PM
To: web2py-users
Subject: [web2py] Re: confused about services and authorization

I am not sure you should register services in controller, unless you also
want to expose them as actions. I normally put them in a model.
Anyway...

@service.xmlrpc
@service.jsonrpc
@service.whetever

register a function as a service

def call(): return service()

simply exposes all services.

You can do

@auth.requires(auth.user)
def call(): return service()

and you will get an unauthorized error


On Oct 24, 11:19 am, david.waldrop david.wald...@gmail.com wrote:
 I have spent the bulk of last evening and this morning trying to test 
 web2py services and authorization.  In addition to setting 
 auth.settings.allow_basic_login = True I have deleted the call 
 function in the default controller, created a seperate controller 
 mmservices,and and populated with the following code:

 @auth.requires_login()
 def call():
     
     exposes services. for example:
    http:///[app]/default/call/jsonrpc
     decorate with @services.jsonrpc the functions to expose
     supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
     
     session.forget()
     return service()

 @service.xmlrpc
 def getmeetings():
     if auth.is_logged_in():
         return 'you are logged in!'
     else:
         return 'NO DICE'

 @service.xmlrpc
 def test(insink):
     if auth.is_logged_in():
         return 'test: you are logged in!'
     else:
         return 'test: NO DICE'

 My questions are:

 1) what is the purpose of the call function?  I see that it is part 
 of the proxy when invoking, but am not sure where it gets invoked or 
 what it does.  Does there need to be a separate call for each web- 
 service function (as I saw in a forum post)?

 2) when i 
 enterhttp://www.meetingmonkey.net/init/mmservices/getmeetings
 without logging in I get no dice. I suspect this is due to the fact 
 that I am accessing the function because it is in a controller.  This 
 is not the desired behavior as I want to ensure the user has logged in 
 before getting access to the function.  Is there a complete example of 
 the best practice for implementing web-services including where to put 
 various parts of code?

 3) when I 
 enterhttp://www.meetingmonkey.net/init/mmservices/call/xmlrpc/getmeeti
 ngs without logging 8in I am redirected to the login page.  I would 
 rather just return an unauthorized error, but do not know how to do?



[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread VP
Can Massimo or someone clarify if this tip will result in web2py
serving static files or Apache serving static files?

Is this a production (high-performance) set up?  The assumption one
domain per app appears to suggest that this is a production set up.
Yet, Massimo mentioned in an early tip similar to this that web2py
would be serving static files, and is thus not meant for production.


Can someone clarify please?


Thank you.


On Oct 17, 9:03 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Replace your web2py/routes.py with this:

 - begin routes.py---
 try: config=open('routes.conf','r').read()
 except: config=''
 def auto_in(apps):
     routes=[
         ('/robots.txt','/welcome/static/robots.txt'),
         ('/favicon.ico','/welcome/static/favicon.ico'),
         ('/admin$a','/admin$a'),
         ]
     for a,b in [x.strip().split() for x in apps.split('\n') \
         if x.strip() and not x.strip().startswith('#')]:
         if not b.startswith('/'): b='/'+b
         if b.endswith('/'): b=b[:-1]
         app = b.split('/')[1]
         routes+=[
             ('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
             ('.*:https?://(.*\.)?%s:$method /static/$a' % a,'%s/static/
 $a' % app),
             ('.*:https?://(.*\.)?%s:$method /appadmin/$a' % a,'%s/
 appadmin/$a' % app),
             ('.*:https?://(.*\.)?%s:$method /$a' % a,'%s/$a' % b),
             ]
     return routes

 def auto_out(apps):
     routes=[]
     for a,b in [x.strip().split() for x in apps.split('\n') \
         if x.strip() and not x.strip().startswith('#')]:
         if not b.startswith('/'): b='/'+b
         if b.endswith('/'): b=b[:-1]
         app = b.split('/')[1]
         routes+=[
             ('%s/static/$a' % app,'static/$a'),
             ('%s/appadmin/$a' % app, '/appadmin/$a'),
             ('%s/$a' % b, '/$a'),
             ]
     return routes

 routes_in=auto_in(config)
 routes_out=auto_out(config)
 --- END ---

 what does it do? It writes routes for you based on a simpler routing
 configuration file called routes.conf. here is an example:

 - BEGIN routes.conf---
 127.0.0.1       /examples/default
 domain1.com /app1/default
 domain2.com /app2/default
 domain3.com /app3/default
 - END --

 It maps a domain (the left had side) into an app and it shortens the
 URLs for the app, by removing the listed path prefix. That means

 http://domain1.com/indexwill be mapped into  
 /app1/default/indexhttp://domain2.com/indexwill be mapped into  
 /app2/default/index

 It is safe in that it preserves admin, appadmin, static files,
 favicon.ico and robots.txt.

 http://domain1.com/favicon.icohttp://domain1.com/robots.txthttp://domain1.com/admin/...
    /admin/...http://domain1.com/appadmin/...  
 /app1/appadmin/...http://domain1.com/static/...  /app1/static/...

 and vice-versa.

 It does assume one app per domain.

 I think something like this should be default since lots of people
 find routes.py hard to work with.
 Comments? Suggestions?

 Massimo


[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread mdipierro
This assumes web2py is serving static files. But it does not prevent
you to use a apache for it.
In this case you would need the virtual hosts for the different apps.


On Oct 24, 1:18 pm, VP vtp2...@gmail.com wrote:
 Can Massimo or someone clarify if this tip will result in web2py
 serving static files or Apache serving static files?

 Is this a production (high-performance) set up?  The assumption one
 domain per app appears to suggest that this is a production set up.
 Yet, Massimo mentioned in an early tip similar to this that web2py
 would be serving static files, and is thus not meant for production.

 Can someone clarify please?

 Thank you.

 On Oct 17, 9:03 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Replace your web2py/routes.py with this:

  - begin routes.py---
  try: config=open('routes.conf','r').read()
  except: config=''
  def auto_in(apps):
      routes=[
          ('/robots.txt','/welcome/static/robots.txt'),
          ('/favicon.ico','/welcome/static/favicon.ico'),
          ('/admin$a','/admin$a'),
          ]
      for a,b in [x.strip().split() for x in apps.split('\n') \
          if x.strip() and not x.strip().startswith('#')]:
          if not b.startswith('/'): b='/'+b
          if b.endswith('/'): b=b[:-1]
          app = b.split('/')[1]
          routes+=[
              ('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
              ('.*:https?://(.*\.)?%s:$method /static/$a' % a,'%s/static/
  $a' % app),
              ('.*:https?://(.*\.)?%s:$method /appadmin/$a' % a,'%s/
  appadmin/$a' % app),
              ('.*:https?://(.*\.)?%s:$method /$a' % a,'%s/$a' % b),
              ]
      return routes

  def auto_out(apps):
      routes=[]
      for a,b in [x.strip().split() for x in apps.split('\n') \
          if x.strip() and not x.strip().startswith('#')]:
          if not b.startswith('/'): b='/'+b
          if b.endswith('/'): b=b[:-1]
          app = b.split('/')[1]
          routes+=[
              ('%s/static/$a' % app,'static/$a'),
              ('%s/appadmin/$a' % app, '/appadmin/$a'),
              ('%s/$a' % b, '/$a'),
              ]
      return routes

  routes_in=auto_in(config)
  routes_out=auto_out(config)
  --- END ---

  what does it do? It writes routes for you based on a simpler routing
  configuration file called routes.conf. here is an example:

  - BEGIN routes.conf---
  127.0.0.1       /examples/default
  domain1.com /app1/default
  domain2.com /app2/default
  domain3.com /app3/default
  - END --

  It maps a domain (the left had side) into an app and it shortens the
  URLs for the app, by removing the listed path prefix. That means

 http://domain1.com/indexwillbe mapped into  
 /app1/default/indexhttp://domain2.com/indexwillbe mapped into  
 /app2/default/index

  It is safe in that it preserves admin, appadmin, static files,
  favicon.ico and robots.txt.

 http://domain1.com/favicon.icohttp://domain1.com/robots.txthttp://dom..  
  /admin/...http://domain1.com/appadmin/...  
 /app1/appadmin/...http://domain1.com/static/...  /app1/static/...

  and vice-versa.

  It does assume one app per domain.

  I think something like this should be default since lots of people
  find routes.py hard to work with.
  Comments? Suggestions?

  Massimo




[web2py] Re: Ajax example demo broken?

2010-10-24 Thread mdipierro
Turns out there was a bug. The INPUT fiels was missing the name
attribute.
I also fund another problem with examples (models/db.py) was missing
and this breaks also the db examples.
It is fixed in trunk and will post a new web2by version so that it
gets fixed on the web page as well.

massimo


On Oct 24, 12:00 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:
 I am trying out example 44 at

 http://web2py.com/examples/default/examples

 This is the demohttp://web2py.com/examples/default/examples

 Nothing happens when I click the submit button. The webpage stays the
 same. Is the demo broken?


[web2py] Integrating PyJamas-pages in an IFrame

2010-10-24 Thread Stef Mientki
hello,

I've been experimenting with using of my existing PyJamas webpages into web2py,
and after a tip from the PyJamas group,
to use an Iframe,
it works like a charm.

I've integrated PyJamas in Web2PY_CC and made a small movie
http://www.student.tue.nl/W/r.mientki/web2py_cc_pyjamas_css.html
(1200*800, 16 MB, 5 minutes)

I've to cleanup a few things and hope to release a new version of Web2PY_CC in 
about a week
(probably I can even generate an executable)

cheers,
Stef


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 5:03 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 * Calculated values are shown, and a form with hidden fields and a
 submit button labeled 'Confirm' is shown

The hidden fields still show in the page source though.  A smart user
could submit his own set of data if he can see what field id's are
being expected.  That's what I want to avoid.   There must be no way a
user can change the charge amount at any stage of the process.

I had another idea a short while ago: I'll cache charge amount for all
the rows (in the server-side session object), and send through (as
form post data) the identity of the selected row.  That way, the next
controller function will be able to retrieve the appropriate
calculation result for the selected row, and the user will have no way
to edit the calculation amount.

What do you think?


[web2py] Re: confused about services and authorization

2010-10-24 Thread david.waldrop
Cancel that it DOES NOT work on local either.  In the previous post it
worked I believe because I still had the old controller.  Now that I
have deleted the controller puttilng the call function back in the
default controller, and moving the getmeeting function to a model
file, i am not able to access in the dev server or the productiontion
server.  I am 100% sure the credentials are correct, but cannot figure
out why the authentication is not happening.

On Oct 24, 2:13 pm, David Waldrop david.wald...@gmail.com wrote:
 Massimo, moving the function out of the controller enabled me to
 successfully invoke the function via xmlrpc on my development machine, but
 not on the production version.  In the forum I see that this (303)
 supposedly indicates invalid authorization, but the testing credentials are
 valid on both sites.  I did so by issuing the following at the python
 console:

 Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
 on
 win32
 Type help, copyright, credits or license for more information.

  import xmlrpclib
  server =

 xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetingmon
 key.net/init/default/call/xmlrpc)

  server2 =

 xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:800
 0/mm_beta_1/default/call/xmlrpc)

  server.getmeetings()

 Traceback (most recent call last):
   File stdin, line 1, in module
   File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
     return self.__send(self.__name, args)
   File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
     verbose=self.__verbose
   File C:\Python26\lib\xmlrpclib.py, line 1243, in request
     headers
 xmlrpclib.ProtocolError: ProtocolError for
 david.wald...@gmail.com:x...@www.meet
 ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER

  server2.getmeetings()

 'you are logged in!'

 Do I need to enables something special in the environment other than
 auth.settings.allow_basic_login = True, which is already set.  Alos, is this
 a recommended way of passing credentials to a web2py services, it seems as
 if they may be exposed in the clear during transport???

 /david



 -Original Message-
 From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of

 mdipierro
 Sent: Sunday, October 24, 2010 1:38 PM
 To: web2py-users
 Subject: [web2py] Re: confused about services and authorization

 I am not sure you should register services in controller, unless you also
 want to expose them as actions. I normally put them in a model.
 Anyway...

 @service.xmlrpc
 @service.jsonrpc
 @service.whetever

 register a function as a service

 def call(): return service()

 simply exposes all services.

 You can do

 @auth.requires(auth.user)
 def call(): return service()

 and you will get an unauthorized error

 On Oct 24, 11:19 am, david.waldrop david.wald...@gmail.com wrote:
  I have spent the bulk of last evening and this morning trying to test
  web2py services and authorization.  In addition to setting
  auth.settings.allow_basic_login = True I have deleted the call
  function in the default controller, created a seperate controller
  mmservices,and and populated with the following code:

  @auth.requires_login()
  def call():
      
      exposes services. for example:
     http:///[app]/default/call/jsonrpc
      decorate with @services.jsonrpc the functions to expose
      supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
      
      session.forget()
      return service()

  @service.xmlrpc
  def getmeetings():
      if auth.is_logged_in():
          return 'you are logged in!'
      else:
          return 'NO DICE'

  @service.xmlrpc
  def test(insink):
      if auth.is_logged_in():
          return 'test: you are logged in!'
      else:
          return 'test: NO DICE'

  My questions are:

  1) what is the purpose of the call function?  I see that it is part
  of the proxy when invoking, but am not sure where it gets invoked or
  what it does.  Does there need to be a separate call for each web-
  service function (as I saw in a forum post)?

  2) when i
  enterhttp://www.meetingmonkey.net/init/mmservices/getmeetings
  without logging in I get no dice. I suspect this is due to the fact
  that I am accessing the function because it is in a controller.  This
  is not the desired behavior as I want to ensure the user has logged in
  before getting access to the function.  Is there a complete example of
  the best practice for implementing web-services including where to put
  various parts of code?

  3) when I
  enterhttp://www.meetingmonkey.net/init/mmservices/call/xmlrpc/getmeeti
  ngs without logging 8in I am redirected to the login page.  I would
  rather just return an unauthorized error, but do not know how to do?


[web2py] Re: Function that does not require a view

2010-10-24 Thread Anthony
From http://web2py.com/book/default/chapter/04#Dispatching :

Functions that take arguments or start with a double underscore are
not publicly exposed and can only be called by other functions.

So, as long as a function takes at least one argument, it will be
private, even without the double underscore. E.g.,

def private_function(any_argument):


On Oct 24, 1:21 pm, JimK jkel...@gmail.com wrote:
 You can leave the function in the controller file but pre-pend __ to
 the name.  This is the Python way to create private functions and it
 appears to be supported well in Web2Py.

 An example would be:

 def __privateFunc():

 On Oct 24, 5:18 am, Luther Goh Lu Feng elf...@yahoo.com wrote:



  If I have a function that I intend to call from different controllers, but I
  have no need for the function to have a view, where should this function be
  defined? eg. a function that simply calculates the outcome of a math 
  formula,
  and several controllers will call this function to display the result.

  Should it be defined within a controller, or elsewhere?- Hide quoted text -

 - Show quoted text -


[web2py] Setting the default user id derived from a custom auth table in a record

2010-10-24 Thread Luther Goh Lu Feng
The snippet below defines a table that stores comments that are
created. The 1st field `user` records the user id of the user who
created the record. I am trying to set the default value to the
current authenticated user, using auth.user_id as suggested in
Chapter 13 of the web2py book.

Although the transaction is successful, the value recorded is None.
I have also used auth.user.id but this leads to AttributeError:
'NoneType' object has no attribute 'id

Would anyone please kindly explain to me why auth.user.id and
auth.user_id are failing as described?


db.define_table('comment',
Field('user', custom_auth_table, default=auth.user_id,
writable=False, notnull=True),
Field('question', 'reference question', writable=False,
notnull=True),
Field('text', 'text', length=512, required=True,
requires=IS_NOT_EMPTY()),
Field('created', 'datetime', default=request.now, writable=False,
readable=False, notnull=False),
format='%(user)s on %(question)s'
)


Re: [web2py] Re: confused about services and authorization

2010-10-24 Thread David Waldrop
Even more confusion.  I can get it to work on dev environment by reverting
to the original decorator on call

#...@auth.requires(auth.user)
@auth.requires_login()
def call():

exposes services. for example:
http:///[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv

session.forget()
return service()


This works!!!  I cannot get it to work on the production system.  Identical
code so it must be something in the environmental setup.  Any ideas?

On Sun, Oct 24, 2010 at 2:57 PM, david.waldrop david.wald...@gmail.comwrote:

 Cancel that it DOES NOT work on local either.  In the previous post it
 worked I believe because I still had the old controller.  Now that I
 have deleted the controller puttilng the call function back in the
 default controller, and moving the getmeeting function to a model
 file, i am not able to access in the dev server or the productiontion
 server.  I am 100% sure the credentials are correct, but cannot figure
 out why the authentication is not happening.

 On Oct 24, 2:13 pm, David Waldrop david.wald...@gmail.com wrote:
  Massimo, moving the function out of the controller enabled me to
  successfully invoke the function via xmlrpc on my development machine,
 but
  not on the production version.  In the forum I see that this (303)
  supposedly indicates invalid authorization, but the testing credentials
 are
  valid on both sites.  I did so by issuing the following at the python
  console:
 
  Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
 (Intel)]
  on
  win32
  Type help, copyright, credits or license for more information.
 
   import xmlrpclib
   server =
 
  xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetingmon
  key.net/init/default/call/xmlrpc)
 
   server2 =
 
  xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:800
  0/mm_beta_1/default/call/xmlrpc)
 
   server.getmeetings()
 
  Traceback (most recent call last):
File stdin, line 1, in module
File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
  return self.__send(self.__name, args)
File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
  verbose=self.__verbose
File C:\Python26\lib\xmlrpclib.py, line 1243, in request
  headers
  xmlrpclib.ProtocolError: ProtocolError for
  david.wald...@gmail.com:x...@www.meet
  ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER
 
   server2.getmeetings()
 
  'you are logged in!'
 
  Do I need to enables something special in the environment other than
  auth.settings.allow_basic_login = True, which is already set.  Alos, is
 this
  a recommended way of passing credentials to a web2py services, it seems
 as
  if they may be exposed in the clear during transport???
 
  /david
 
 
 
  -Original Message-
  From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf
 Of
 
  mdipierro
  Sent: Sunday, October 24, 2010 1:38 PM
  To: web2py-users
  Subject: [web2py] Re: confused about services and authorization
 
  I am not sure you should register services in controller, unless you also
  want to expose them as actions. I normally put them in a model.
  Anyway...
 
  @service.xmlrpc
  @service.jsonrpc
  @service.whetever
 
  register a function as a service
 
  def call(): return service()
 
  simply exposes all services.
 
  You can do
 
  @auth.requires(auth.user)
  def call(): return service()
 
  and you will get an unauthorized error
 
  On Oct 24, 11:19 am, david.waldrop david.wald...@gmail.com wrote:
   I have spent the bulk of last evening and this morning trying to test
   web2py services and authorization.  In addition to setting
   auth.settings.allow_basic_login = True I have deleted the call
   function in the default controller, created a seperate controller
   mmservices,and and populated with the following code:
 
   @auth.requires_login()
   def call():
   
   exposes services. for example:
  http:///[app]/default/call/jsonrpc
   decorate with @services.jsonrpc the functions to expose
   supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
   
   session.forget()
   return service()
 
   @service.xmlrpc
   def getmeetings():
   if auth.is_logged_in():
   return 'you are logged in!'
   else:
   return 'NO DICE'
 
   @service.xmlrpc
   def test(insink):
   if auth.is_logged_in():
   return 'test: you are logged in!'
   else:
   return 'test: NO DICE'
 
   My questions are:
 
   1) what is the purpose of the call function?  I see that it is part
   of the proxy when invoking, but am not sure where it gets invoked or
   what it does.  Does there need to be a separate call for each web-
   service function (as I saw in a forum post)?
 
   2) when i
   enterhttp://www.meetingmonkey.net/init/mmservices/getmeetings
   without logging in I get no dice. I suspect this is due to the 

Re: [web2py] Re: confused about services and authorization

2010-10-24 Thread David Waldrop
Even more confusion.  I can get it to work on dev environment by reverting
to the original decorator on call

#...http://groups.google.com/groups/unlock?_done=/group/web2py/browse_thread/thread/fea1decf09348144/63e0a69197d87f60msg=08956f3893e1109d
@auth.requires(auth.user)
@auth.requires_login()
def call():

exposes services. for example:

http:///http://www.google.com/url?sa=Dq=http:///usg=AFQjCNHTjjhgMOeO9jlDZUrYwzrfE3YtZg
[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv

session.forget()
return service()

This works on the local/dev machine.  By work I meant i get the expected
result when valid credentials are passed, and a 303 when invalid is
passed!!!  I cannot get it to work on the production system.  If I comment
out the authorization decorator all together the service is invoked thereby
isolating the problem to the way the credentials are passed/handled.   The
code is Identical so it must be something in the environmental setup. Any
ideas?

On Sun, Oct 24, 2010 at 2:57 PM, david.waldrop david.wald...@gmail.comwrote:

 Cancel that it DOES NOT work on local either.  In the previous post it
 worked I believe because I still had the old controller.  Now that I
 have deleted the controller puttilng the call function back in the
 default controller, and moving the getmeeting function to a model
 file, i am not able to access in the dev server or the productiontion
 server.  I am 100% sure the credentials are correct, but cannot figure
 out why the authentication is not happening.

 On Oct 24, 2:13 pm, David Waldrop david.wald...@gmail.com wrote:
  Massimo, moving the function out of the controller enabled me to
  successfully invoke the function via xmlrpc on my development machine,
 but
  not on the production version.  In the forum I see that this (303)
  supposedly indicates invalid authorization, but the testing credentials
 are
  valid on both sites.  I did so by issuing the following at the python
  console:
 
  Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
 (Intel)]
  on
  win32
  Type help, copyright, credits or license for more information.
 
   import xmlrpclib
   server =
 
  xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetingmon
  key.net/init/default/call/xmlrpc)
 
   server2 =
 
  xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:800
  0/mm_beta_1/default/call/xmlrpc)
 
   server.getmeetings()
 
  Traceback (most recent call last):
File stdin, line 1, in module
File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
  return self.__send(self.__name, args)
File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
  verbose=self.__verbose
File C:\Python26\lib\xmlrpclib.py, line 1243, in request
  headers
  xmlrpclib.ProtocolError: ProtocolError for
  david.wald...@gmail.com:x...@www.meet
  ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER
 
   server2.getmeetings()
 
  'you are logged in!'
 
  Do I need to enables something special in the environment other than
  auth.settings.allow_basic_login = True, which is already set.  Alos, is
 this
  a recommended way of passing credentials to a web2py services, it seems
 as
  if they may be exposed in the clear during transport???
 
  /david
 
 
 
  -Original Message-
  From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf
 Of
 
  mdipierro
  Sent: Sunday, October 24, 2010 1:38 PM
  To: web2py-users
  Subject: [web2py] Re: confused about services and authorization
 
  I am not sure you should register services in controller, unless you also
  want to expose them as actions. I normally put them in a model.
  Anyway...
 
  @service.xmlrpc
  @service.jsonrpc
  @service.whetever
 
  register a function as a service
 
  def call(): return service()
 
  simply exposes all services.
 
  You can do
 
  @auth.requires(auth.user)
  def call(): return service()
 
  and you will get an unauthorized error
 
  On Oct 24, 11:19 am, david.waldrop david.wald...@gmail.com wrote:
   I have spent the bulk of last evening and this morning trying to test
   web2py services and authorization.  In addition to setting
   auth.settings.allow_basic_login = True I have deleted the call
   function in the default controller, created a seperate controller
   mmservices,and and populated with the following code:
 
   @auth.requires_login()
   def call():
   
   exposes services. for example:
  http:///[app]/default/call/jsonrpc
   decorate with @services.jsonrpc the functions to expose
   supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
   
   session.forget()
   return service()
 
   @service.xmlrpc
   def getmeetings():
   if auth.is_logged_in():
   return 'you are logged in!'
   else:
   return 'NO DICE'
 
   @service.xmlrpc
   def test(insink):
   if auth.is_logged_in():

Re: [web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread Branko Vukelic
On Sun, Oct 24, 2010 at 8:41 PM, cjrh caleb.hatti...@gmail.com wrote:
 On Oct 24, 5:03 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 * Calculated values are shown, and a form with hidden fields and a
 submit button labeled 'Confirm' is shown

 The hidden fields still show in the page source though.  A smart user
 could submit his own set of data if he can see what field id's are
 being expected.  That's what I want to avoid.   There must be no way a
 user can change the charge amount at any stage of the process.

Oh, so ok, I get what you're trying to do now. Don't pass charge
amount around. Charge amount should be one-way. You NEVER, under ANY
circumstances, using ANY technology, expect that amount to come from
client side. There is nothing you can do to prevent a skilled hacker
from manipulating the data. The ajax thing you used is readily
readable using any javascript debugger.

If there is a definite correlation between the rates and the final
amount you either

a. get the amount of service and return the total cost, or
b. get the total cost and return the amount of service

You can't receive both, and hope it's correct. Period.

The best way to do this it probably use a table for unconfirmed
offerings. And move them into confirmed table once confirmation is
done. Either that or make a confirmation flag in the database, and add
expiry date to it so it automatically expires in, say, 24 hours if
user doesn't confirm.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread Brian M
How about include all the calculated values in your form and add in an
additional field that's a HMAC keyed hash of the others using a key
that only you know? When the user submits, make sure the rest of the
field values still combine  hash the same way and then you'll know
the user hasn't messed with the form.  For that matter you could
probably safely just put it all in the URL's query string since if the
user messes with any part of it you'll know.

http://docs.python.org/library/hmac.html

You may even just be able to use web2py's CRYPT() validator.

On Oct 24, 1:41 pm, cjrh caleb.hatti...@gmail.com wrote:
 On Oct 24, 5:03 pm, Branko Vukelic bg.bra...@gmail.com wrote:

  * Calculated values are shown, and a form with hidden fields and a
  submit button labeled 'Confirm' is shown

 The hidden fields still show in the page source though.  A smart user
 could submit his own set of data if he can see what field id's are
 being expected.  That's what I want to avoid.   There must be no way a
 user can change the charge amount at any stage of the process.

 I had another idea a short while ago: I'll cache charge amount for all
 the rows (in the server-side session object), and send through (as
 form post data) the identity of the selected row.  That way, the next
 controller function will be able to retrieve the appropriate
 calculation result for the selected row, and the user will have no way
 to edit the calculation amount.

 What do you think?


[web2py] Re: bug or backward incompatibility for datetime fields

2010-10-24 Thread Marco Prosperi

I use Firefox 3.6.3 on a Vista machine and Strumenti/Opzioni/Contenuti/
Lingue has [it_it] as first choice.
Web2py 1.87.3 complains about the dates' format while web2py 1.67.0 on
the same machine works correctly


On 24 Ott, 01:48, Michele Comitini michele.comit...@gmail.com wrote:


[web2py] Re: bug or backward incompatibility for datetime fields

2010-10-24 Thread mdipierro
Odd. I do not think there is a language file for it_it. There is it-it
and it but not it_it.

On Oct 24, 3:11 pm, Marco Prosperi marcoprosperi...@gmail.com wrote:
 I use Firefox 3.6.3 on a Vista machine and Strumenti/Opzioni/Contenuti/
 Lingue has [it_it] as first choice.
 Web2py 1.87.3 complains about the dates' format while web2py 1.67.0 on
 the same machine works correctly

 On 24 Ott, 01:48, Michele Comitini michele.comit...@gmail.com wrote:


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread mdipierro
This could be a default feature Let me give it some thought..

On Oct 24, 2:48 pm, Brian M bmere...@gmail.com wrote:
 How about include all the calculated values in your form and add in an
 additional field that's a HMAC keyed hash of the others using a key
 that only you know? When the user submits, make sure the rest of the
 field values still combine  hash the same way and then you'll know
 the user hasn't messed with the form.  For that matter you could
 probably safely just put it all in the URL's query string since if the
 user messes with any part of it you'll know.

 http://docs.python.org/library/hmac.html

 You may even just be able to use web2py's CRYPT() validator.

 On Oct 24, 1:41 pm, cjrh caleb.hatti...@gmail.com wrote:

  On Oct 24, 5:03 pm, Branko Vukelic bg.bra...@gmail.com wrote:

   * Calculated values are shown, and a form with hidden fields and a
   submit button labeled 'Confirm' is shown

  The hidden fields still show in the page source though.  A smart user
  could submit his own set of data if he can see what field id's are
  being expected.  That's what I want to avoid.   There must be no way a
  user can change the charge amount at any stage of the process.

  I had another idea a short while ago: I'll cache charge amount for all
  the rows (in the server-side session object), and send through (as
  form post data) the identity of the selected row.  That way, the next
  controller function will be able to retrieve the appropriate
  calculation result for the selected row, and the user will have no way
  to edit the calculation amount.

  What do you think?




[web2py] Re: confused about services and authorization

2010-10-24 Thread mdipierro
please email me a minimalist program to reproduce the problem and I
will debug it.

On Oct 24, 2:32 pm, David Waldrop david.wald...@gmail.com wrote:
 Even more confusion.  I can get it to work on dev environment by reverting
 to the original decorator on call

 #...http://groups.google.com/groups/unlock?_done=/group/web2py/browse_thr...
 @auth.requires(auth.user)
 @auth.requires_login()
 def call():
     
     exposes services. for example:
    
 http:///http://www.google.com/url?sa=Dq=http:///usg=AFQjCNHTjjhgMOeO9jl...
 [app]/default/call/jsonrpc
     decorate with @services.jsonrpc the functions to expose
     supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
     
     session.forget()
     return service()

 This works on the local/dev machine.  By work I meant i get the expected
 result when valid credentials are passed, and a 303 when invalid is
 passed!!!  I cannot get it to work on the production system.  If I comment
 out the authorization decorator all together the service is invoked thereby
 isolating the problem to the way the credentials are passed/handled.   The
 code is Identical so it must be something in the environmental setup. Any
 ideas?

 On Sun, Oct 24, 2010 at 2:57 PM, david.waldrop david.wald...@gmail.comwrote:



  Cancel that it DOES NOT work on local either.  In the previous post it
  worked I believe because I still had the old controller.  Now that I
  have deleted the controller puttilng the call function back in the
  default controller, and moving the getmeeting function to a model
  file, i am not able to access in the dev server or the productiontion
  server.  I am 100% sure the credentials are correct, but cannot figure
  out why the authentication is not happening.

  On Oct 24, 2:13 pm, David Waldrop david.wald...@gmail.com wrote:
   Massimo, moving the function out of the controller enabled me to
   successfully invoke the function via xmlrpc on my development machine,
  but
   not on the production version.  In the forum I see that this (303)
   supposedly indicates invalid authorization, but the testing credentials
  are
   valid on both sites.  I did so by issuing the following at the python
   console:

   Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
  (Intel)]
   on
   win32
   Type help, copyright, credits or license for more information.

import xmlrpclib
server =

   xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetingmon
   key.net/init/default/call/xmlrpc)

server2 =

   xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:800
   0/mm_beta_1/default/call/xmlrpc)

server.getmeetings()

   Traceback (most recent call last):
     File stdin, line 1, in module
     File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
       return self.__send(self.__name, args)
     File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
       verbose=self.__verbose
     File C:\Python26\lib\xmlrpclib.py, line 1243, in request
       headers
   xmlrpclib.ProtocolError: ProtocolError for
   david.wald...@gmail.com:x...@www.meet
   ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER

server2.getmeetings()

   'you are logged in!'

   Do I need to enables something special in the environment other than
   auth.settings.allow_basic_login = True, which is already set.  Alos, is
  this
   a recommended way of passing credentials to a web2py services, it seems
  as
   if they may be exposed in the clear during transport???

   /david

   -Original Message-
   From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf
  Of

   mdipierro
   Sent: Sunday, October 24, 2010 1:38 PM
   To: web2py-users
   Subject: [web2py] Re: confused about services and authorization

   I am not sure you should register services in controller, unless you also
   want to expose them as actions. I normally put them in a model.
   Anyway...

   @service.xmlrpc
   @service.jsonrpc
   @service.whetever

   register a function as a service

   def call(): return service()

   simply exposes all services.

   You can do

   @auth.requires(auth.user)
   def call(): return service()

   and you will get an unauthorized error

   On Oct 24, 11:19 am, david.waldrop david.wald...@gmail.com wrote:
I have spent the bulk of last evening and this morning trying to test
web2py services and authorization.  In addition to setting
auth.settings.allow_basic_login = True I have deleted the call
function in the default controller, created a seperate controller
mmservices,and and populated with the following code:

@auth.requires_login()
def call():
    
    exposes services. for example:
   http:///[app]/default/call/jsonrpc
    decorate with @services.jsonrpc the functions to expose
    supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
    
    session.forget()
    return service()

@service.xmlrpc
def getmeetings():
    if 

[web2py] Re: Bug or break with backwards compatibility?

2010-10-24 Thread b00m_chef
By keeping the footer separate from the header I can make my app more
modular, and more segregated. It is more common in django than web2py
I guess...but I find it is a good habit.

The blocks are a great addition, I have no need yet, as the method I
mentioned above works exactly as I need it to. There are LOTS of uses
for blocks though, so I am very happy they are included now. I will
definitely make much use of them.

Thanks!



On Oct 23, 11:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Why keep them in separate files? You may also want to check the new
 {{block name}}..{{end}} feature. It is described in the book.

 On Oct 24, 1:10 am, b00m_chef r...@devshell.org wrote:







  My desired result was achieved...Thanks to your explanation above. I
  wanted to have 1 html file linking the two header.html and footer.html
  files. This example would be good to have in the book as it really
  shows how the extend  includes work...at least it explained it better
  for me (the book's example is too simple). I wanted to have 1 extend
  at the top of the body.html file...here is what I did:

  header.html
  htmlhead/headbody

  footer.html
  /body/html

  main.html
  {{include 'header.html'}} div my body stuff here /div{{include
  'footer.html'}}

  body.html
  {{extend 'main.html'}}div my body stuff here!/div

  On Oct 23, 11:02 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   If this worked was a bug. You cannot extend two views.

   You can do this:

   layout.html
   htmlhead/headbody{{include}}/body/html

   main.html
   {{extend 'layout.html'}} div my body stuff here /div

   Or you can do this:

   header.html
   htmlhead/headbody

   footer.html
   /body/html

   main.html
   {{include 'header.html'}} div my body stuff here /div{{include
   'footer.html'}}

   You can have various combination of the two but not the one you used.
   As explained in the manual the view hierarchy is a try. Extend points
   to a parent. A node in a tree cannot have two parents.

   On Oct 24, 12:37 am, b00m_chef r...@devshell.org wrote:

I noticed my app from a few releases back stopped working with regard
to the view. I had a file that extended 2 files (a header.html, and a
footer.html), it then included (in-between the 2 extends) a body.

Only the last extend will execute in the below main.html file in the
current release (1.87.3), however, in previous versions (a few months
ago) this would work as expected:

header.html
htmlhead/headbody{{include}}

footer.html
{{include}}/body/html

main.html
{{extend 'header.html'}} div my body stuff here /div{{extend
'footer.html'}}


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 9:41 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 Oh, so ok, I get what you're trying to do now. Don't pass charge
 amount around. Charge amount should be one-way. You NEVER, under ANY
 circumstances, using ANY technology, expect that amount to come from
 client side.

Yes, I guess that should have been obvious to me from the start!

 The ajax thing you used is readily
 readable using any javascript debugger.

Yeah, I agree. Through our discussion, it slowly dawned on me during
the course of this thread.

 If there is a definite correlation between the rates and the final
 amount you either

 a. get the amount of service and return the total cost, or

Yeah, this is the one.

 The best way to do this it probably use a table for unconfirmed
 offerings. And move them into confirmed table once confirmation is
 done.

Ok, that's something I'll think about.  However, having also thought
about it more myself, I reckon I am going to go with the idea of
storing all rows' data in the server-side session before showing the
selection page that displays all rows, and passing (from the client)
only the user-selected row index to the subsequent controller
function, via a form submit.  Then, in that controller, I'll look up
the other data for the selected row again on the server side using the
server-side session, and show the confirmation page with the
calculated data again.  The quantity of data is going to be small
enough that size is no issue (say 30 selectable rows), and this scheme
is very simple, hence low likelihood of bugs, and other unforeseen
situations.

Thanks very much for your help.  It is amazing how much an intelligent
sounding board helps to clarify thought.


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread cjrh
On Oct 24, 9:48 pm, Brian M bmere...@gmail.com wrote:
 How about include all the calculated values in your form and add in an
 additional field that's a HMAC keyed hash of the others using a key
 that only you know? When the user submits, make sure the rest of the
 field values still combine  hash the same way and then you'll know
 the user hasn't messed with the form.  

Thanks for the comment.  It's very clever, but too much work.  I am
rather going to keep my calculated values in the server-side session,
and always fetch them from there.  The client will only every submit
an index into that server-side hash.  I am fairly sure now that this
is the way to go here.


[web2py] Re: bug or backward incompatibility for datetime fields

2010-10-24 Thread Marco Prosperi

Sorry, I mistyped: there is [it-it] and not [it_it] in my Firefox

On 24 Ott, 22:14, mdipierro mdipie...@cs.depaul.edu wrote:


[web2py] Re: confused about services and authorization

2010-10-24 Thread mdipierro
Can you also tell us more about the production server? What web
server? Os?

On Oct 24, 3:52 pm, David Waldrop david.wald...@gmail.com wrote:
 Massimo,  Thanks. This is absolutely maddening.  Attached is simple app.  It
 exposes 1 service getmeetings located in the mm_services model.  The db.py
 file includes the statement:

 auth.settings.allow_basic_login = True

 and the default/call function is decorated to require login.

 The app behaves correctly when running on my local machine, but always
 returns 303 when invoked on the production server.

 -Original Message-
 From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of

 mdipierro
 Sent: Sunday, October 24, 2010 4:17 PM
 To: web2py-users
 Subject: [web2py] Re: confused about services and authorization

 please email me a minimalist program to reproduce the problem and I will
 debug it.

 On Oct 24, 2:32 pm, David Waldrop david.wald...@gmail.com wrote:
  Even more confusion.  I can get it to work on dev environment by
  reverting to the original decorator on call

  #...http://groups.google.com/groups/unlock?_done=/group/web2py/browse
  _thr...
  @auth.requires(auth.user)
  @auth.requires_login()
  def call():
      
      exposes services. for example:
     
 http:///http://www.google.com/url?sa=Dq=http:///usg=AFQjCNH
  TjjhgMOeO9jl...
  [app]/default/call/jsonrpc
      decorate with @services.jsonrpc the functions to expose
      supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
      
      session.forget()
      return service()

  This works on the local/dev machine.  By work I meant i get the
  expected result when valid credentials are passed, and a 303 when
  invalid is passed!!!  I cannot get it to work on the production
  system.  If I comment out the authorization decorator all together the
  service is invoked thereby isolating the problem to the way the
  credentials are passed/handled.   The code is Identical so it must be
  something in the environmental setup. Any ideas?

  On Sun, Oct 24, 2010 at 2:57 PM, david.waldrop
 david.wald...@gmail.comwrote:

   Cancel that it DOES NOT work on local either.  In the previous post
   it worked I believe because I still had the old controller.  Now
   that I have deleted the controller puttilng the call function back
   in the default controller, and moving the getmeeting function to a
   model file, i am not able to access in the dev server or the
   productiontion server.  I am 100% sure the credentials are correct,
   but cannot figure out why the authentication is not happening.

   On Oct 24, 2:13 pm, David Waldrop david.wald...@gmail.com wrote:
Massimo, moving the function out of the controller enabled me to
successfully invoke the function via xmlrpc on my development
machine,
   but
not on the production version.  In the forum I see that this (303)
supposedly indicates invalid authorization, but the testing
credentials
   are
valid on both sites.  I did so by issuing the following at the
python
console:

Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32
bit
   (Intel)]
on
win32
Type help, copyright, credits or license for more information.

 import xmlrpclib
 server =

xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetingm
on
key.net/init/default/call/xmlrpc)

 server2 =

xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:80
0
0/mm_beta_1/default/call/xmlrpc)

 server.getmeetings()

Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
    return self.__send(self.__name, args)
  File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
    verbose=self.__verbose
  File C:\Python26\lib\xmlrpclib.py, line 1243, in request
    headers
xmlrpclib.ProtocolError: ProtocolError for
david.wald...@gmail.com:x...@www.meet
ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER

 server2.getmeetings()

'you are logged in!'

Do I need to enables something special in the environment other
than auth.settings.allow_basic_login = True, which is already set.  
Alos, is
   this
a recommended way of passing credentials to a web2py services, it
seems
   as
if they may be exposed in the clear during transport???

/david

-Original Message-
From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On
Behalf
   Of

mdipierro
Sent: Sunday, October 24, 2010 1:38 PM
To: web2py-users
Subject: [web2py] Re: confused about services and authorization

I am not sure you should register services in controller, unless
you also want to expose them as actions. I normally put them in a
 model.
Anyway...

@service.xmlrpc
@service.jsonrpc
@service.whetever

register a function as a service

def call(): return service()

simply 

RE: [web2py] Re: confused about services and authorization

2010-10-24 Thread David Waldrop
It’s the standard webfaction config, web2py and python installed using their
scripts.

-Original Message-
From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of
mdipierro
Sent: Sunday, October 24, 2010 5:15 PM
To: web2py-users
Subject: [web2py] Re: confused about services and authorization

Can you also tell us more about the production server? What web server? Os?

On Oct 24, 3:52 pm, David Waldrop david.wald...@gmail.com wrote:
 Massimo,  Thanks. This is absolutely maddening.  Attached is simple 
 app.  It exposes 1 service getmeetings located in the mm_services 
 model.  The db.py file includes the statement:

 auth.settings.allow_basic_login = True

 and the default/call function is decorated to require login.

 The app behaves correctly when running on my local machine, but always 
 returns 303 when invoked on the production server.

 -Original Message-
 From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On 
 Behalf Of

 mdipierro
 Sent: Sunday, October 24, 2010 4:17 PM
 To: web2py-users
 Subject: [web2py] Re: confused about services and authorization

 please email me a minimalist program to reproduce the problem and I 
 will debug it.

 On Oct 24, 2:32 pm, David Waldrop david.wald...@gmail.com wrote:
  Even more confusion.  I can get it to work on dev environment by 
  reverting to the original decorator on call

  #...http://groups.google.com/groups/unlock?_done=/group/web2py/brow
  se
  _thr...
  @auth.requires(auth.user)
  @auth.requires_login()
  def call():
      
      exposes services. for example:
     
 http:///http://www.google.com/url?sa=Dq=http:///usg=AFQjCN
 H
  TjjhgMOeO9jl...
  [app]/default/call/jsonrpc
      decorate with @services.jsonrpc the functions to expose
      supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
      
      session.forget()
      return service()

  This works on the local/dev machine.  By work I meant i get the 
  expected result when valid credentials are passed, and a 303 when 
  invalid is passed!!!  I cannot get it to work on the production 
  system.  If I comment out the authorization decorator all together 
  the service is invoked thereby isolating the problem to the way the 
  credentials are passed/handled.   The code is Identical so it must 
  be something in the environmental setup. Any ideas?

  On Sun, Oct 24, 2010 at 2:57 PM, david.waldrop
 david.wald...@gmail.comwrote:

   Cancel that it DOES NOT work on local either.  In the previous 
   post it worked I believe because I still had the old controller.  
   Now that I have deleted the controller puttilng the call function 
   back in the default controller, and moving the getmeeting function 
   to a model file, i am not able to access in the dev server or the 
   productiontion server.  I am 100% sure the credentials are 
   correct, but cannot figure out why the authentication is not
happening.

   On Oct 24, 2:13 pm, David Waldrop david.wald...@gmail.com wrote:
Massimo, moving the function out of the controller enabled me to 
successfully invoke the function via xmlrpc on my development 
machine,
   but
not on the production version.  In the forum I see that this 
(303) supposedly indicates invalid authorization, but the 
testing credentials
   are
valid on both sites.  I did so by issuing the following at the 
python
console:

Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 
bit
   (Intel)]
on
win32
Type help, copyright, credits or license for more
information.

 import xmlrpclib
 server =

xmlrpclib.Server(http://david.wald...@gmail.com:x...@www.meetin
gm
on
key.net/init/default/call/xmlrpc)

 server2 =

xmlrpclib.Server(http://david.wald...@gmail.com:x...@127.0.0.1:
80
0
0/mm_beta_1/default/call/xmlrpc)

 server.getmeetings()

Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python26\lib\xmlrpclib.py, line 1199, in __call__
    return self.__send(self.__name, args)
  File C:\Python26\lib\xmlrpclib.py, line 1489, in __request
    verbose=self.__verbose
  File C:\Python26\lib\xmlrpclib.py, line 1243, in request
    headers
xmlrpclib.ProtocolError: ProtocolError for 
david.wald...@gmail.com:x...@www.meet
ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER

 server2.getmeetings()

'you are logged in!'

Do I need to enables something special in the environment other 
than auth.settings.allow_basic_login = True, which is already set.
Alos, is
   this
a recommended way of passing credentials to a web2py services, 
it seems
   as
if they may be exposed in the clear during transport???

/david

-Original Message-
From: web2py@googlegroups.com [mailto:web...@googlegroups.com] 
On Behalf
   Of

mdipierro
Sent: Sunday, October 24, 2010 1:38 PM
To: web2py-users
Subject: 

[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread VP
Massimo,
Can you please show us more specifically how to do this?   (I think
someone also asked the same question in a previous topic).

Thanks.


On Oct 24, 1:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 This assumes web2py is serving static files. But it does not prevent
 you to use a apache for it.
 In this case you would need the virtual hosts for the different apps.

 On Oct 24, 1:18 pm, VP vtp2...@gmail.com wrote:

  Can Massimo or someone clarify if this tip will result in web2py
  serving static files or Apache serving static files?

  Is this a production (high-performance) set up?  The assumption one
  domain per app appears to suggest that this is a production set up.
  Yet, Massimo mentioned in an early tip similar to this that web2py
  would be serving static files, and is thus not meant for production.

  Can someone clarify please?

  Thank you.

  On Oct 17, 9:03 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Replace your web2py/routes.py with this:

   - begin routes.py---
   try: config=open('routes.conf','r').read()
   except: config=''
   def auto_in(apps):
       routes=[
           ('/robots.txt','/welcome/static/robots.txt'),
           ('/favicon.ico','/welcome/static/favicon.ico'),
           ('/admin$a','/admin$a'),
           ]
       for a,b in [x.strip().split() for x in apps.split('\n') \
           if x.strip() and not x.strip().startswith('#')]:
           if not b.startswith('/'): b='/'+b
           if b.endswith('/'): b=b[:-1]
           app = b.split('/')[1]
           routes+=[
               ('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
               ('.*:https?://(.*\.)?%s:$method /static/$a' % a,'%s/static/
   $a' % app),
               ('.*:https?://(.*\.)?%s:$method /appadmin/$a' % a,'%s/
   appadmin/$a' % app),
               ('.*:https?://(.*\.)?%s:$method /$a' % a,'%s/$a' % b),
               ]
       return routes

   def auto_out(apps):
       routes=[]
       for a,b in [x.strip().split() for x in apps.split('\n') \
           if x.strip() and not x.strip().startswith('#')]:
           if not b.startswith('/'): b='/'+b
           if b.endswith('/'): b=b[:-1]
           app = b.split('/')[1]
           routes+=[
               ('%s/static/$a' % app,'static/$a'),
               ('%s/appadmin/$a' % app, '/appadmin/$a'),
               ('%s/$a' % b, '/$a'),
               ]
       return routes

   routes_in=auto_in(config)
   routes_out=auto_out(config)
   --- END ---

   what does it do? It writes routes for you based on a simpler routing
   configuration file called routes.conf. here is an example:

   - BEGIN routes.conf---
   127.0.0.1       /examples/default
   domain1.com /app1/default
   domain2.com /app2/default
   domain3.com /app3/default
   - END --

   It maps a domain (the left had side) into an app and it shortens the
   URLs for the app, by removing the listed path prefix. That means

  http://domain1.com/indexwillbemapped into  
  /app1/default/indexhttp://domain2.com/indexwillbemapped into  
  /app2/default/index

   It is safe in that it preserves admin, appadmin, static files,
   favicon.ico and robots.txt.

  http://domain1.com/favicon.icohttp://domain1.com/robots.txthttp://dom..
     /admin/...http://domain1.com/appadmin/...  
  /app1/appadmin/...http://domain1.com/static/...  /app1/static/...

   and vice-versa.

   It does assume one app per domain.

   I think something like this should be default since lots of people
   find routes.py hard to work with.
   Comments? Suggestions?

   Massimo




[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread mdipierro
Assuming you have the routes described above and this in routes.conf

- BEGIN routes.conf---
domain1.com /app1/default
domain2.com /app2/default
- END --

you would need this in apache config file:

VirtualHost *.domain1.com:
80
  WSGIDaemonProcess web2py user=www-data group=www-
data
  WSGIProcessGroup
web2py
  WSGIScriptAlias / /home/www-data/web2py/
wsgihandler.py

  Directory /home/www-data/
web2py
AllowOverride
None
Order
Allow,Deny
Deny from
all
Files
wsgihandler.py
  Allow from
all
/
Files
  /
Directory

  AliasMatch ^/static/(.*)
\
   /home/www-data/web2py/applications/app1/static/
$1
  Directory /home/www-data/web2py/applications/app1/static/

Options -
Indexes
Order
Allow,Deny
Allow from
all
  /
Directory

  Location /
admin
  Deny from
all
  /
Location

  LocationMatch ^/
appadmin
  Deny from
all
  /
LocationMatch

  CustomLog /var/log/apache2/access.log
common
  ErrorLog /var/log/apache2/
error.log
/VirtualHost


VirtualHost *.domain2.com:
80
  WSGIDaemonProcess web2py user=www-data group=www-
data
  WSGIProcessGroup
web2py
  WSGIScriptAlias / /home/www-data/web2py/
wsgihandler.py

  Directory /home/www-data/
web2py
AllowOverride
None
Order
Allow,Deny
Deny from
all
Files
wsgihandler.py
  Allow from
all
/
Files
  /
Directory

  AliasMatch ^/static/(.*)
\
   /home/www-data/web2py/applications/app2/static/
$1
  Directory /home/www-data/web2py/applications/app2/static/

Options -
Indexes
Order
Allow,Deny
Allow from
all
  /
Directory

  Location /
admin
  Deny from
all
  /
Location

  LocationMatch ^/
appadmin
  Deny from
all
  /
LocationMatch

  CustomLog /var/log/apache2/access.log
common
  ErrorLog /var/log/apache2/
error.log
/VirtualHost


On Oct 24, 4:39 pm, VP vtp2...@gmail.com wrote:
 Massimo,
 Can you please show us more specifically how to do this?   (I think
 someone also asked the same question in a previous topic).

 Thanks.

 On Oct 24, 1:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  This assumes web2py is serving static files. But it does not prevent
  you to use a apache for it.
  In this case you would need the virtual hosts for the different apps.

  On Oct 24, 1:18 pm, VP vtp2...@gmail.com wrote:

   Can Massimo or someone clarify if this tip will result in web2py
   serving static files or Apache serving static files?

   Is this a production (high-performance) set up?  The assumption one
   domain per app appears to suggest that this is a production set up.
   Yet, Massimo mentioned in an early tip similar to this that web2py
   would be serving static files, and is thus not meant for production.

   Can someone clarify please?

   Thank you.

   On Oct 17, 9:03 pm, mdipierro mdipie...@cs.depaul.edu wrote:

Replace your web2py/routes.py with this:

- begin routes.py---
try: config=open('routes.conf','r').read()
except: config=''
def auto_in(apps):
    routes=[
        ('/robots.txt','/welcome/static/robots.txt'),
        ('/favicon.ico','/welcome/static/favicon.ico'),
        ('/admin$a','/admin$a'),
        ]
    for a,b in [x.strip().split() for x in apps.split('\n') \
        if x.strip() and not x.strip().startswith('#')]:
        if not b.startswith('/'): b='/'+b
        if b.endswith('/'): b=b[:-1]
        app = b.split('/')[1]
        routes+=[
            ('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
            ('.*:https?://(.*\.)?%s:$method /static/$a' % a,'%s/static/
$a' % app),
            ('.*:https?://(.*\.)?%s:$method /appadmin/$a' % a,'%s/
appadmin/$a' % app),
            ('.*:https?://(.*\.)?%s:$method /$a' % a,'%s/$a' % b),
            ]
    return routes

def auto_out(apps):
    routes=[]
    for a,b in [x.strip().split() for x in apps.split('\n') \
        if x.strip() and not x.strip().startswith('#')]:
        if not b.startswith('/'): b='/'+b
        if b.endswith('/'): b=b[:-1]
        app = b.split('/')[1]
        routes+=[
            ('%s/static/$a' % app,'static/$a'),
            ('%s/appadmin/$a' % app, '/appadmin/$a'),
            ('%s/$a' % b, '/$a'),
            ]
    return routes

routes_in=auto_in(config)
routes_out=auto_out(config)
--- END ---

what does it do? It writes routes for you based on a simpler routing
configuration file called routes.conf. here is an example:

- BEGIN routes.conf---
127.0.0.1       /examples/default
domain1.com /app1/default
domain2.com /app2/default
domain3.com /app3/default
- END --

It maps a domain (the left had side) into an app and it shortens the
URLs for the app, by removing the listed path prefix. That means

   http://domain1.com/indexwillbemappedinto  
   /app1/default/indexhttp://domain2.com/indexwillbemappedinto  
   

[web2py] traceback on wizard

2010-10-24 Thread Thadeus Burgess
running trunk, attempting to use wizard, dies on step6


Traceback (most recent call last):
  File /home/thadeusb/Applications/web2py/gluon/restricted.py, line
188, in restricted

exec ccode in environment
  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
line 527, in module

  File /home/thadeusb/Applications/web2py/gluon/globals.py, line 96,
in lambda

self._caller = lambda f: f()

  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
line 191, in step6

create(form.vars)
  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
line 510, in create

file.write(make_page(page,session.app.get('page_'+page,'')))

  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
line 382, in make_page

s+=query=f and db.t_%s[f]==v or None\n % (t,t)
TypeError: not all arguments converted during string formatting



--
Thadeus


[web2py] better mercurial integration

2010-10-24 Thread Massimo Di Pierro
Hello everybody,

I am working on improving the web2py web interface to mercurial. 

http://127.0.0.1:8000/admin/mercurial/commit

We can current create a repo, commit and get changelog but I cannot figure out 
how to do revert.
Here is the code I have:

   import os
   uio = ui.ui()
   uio.quiet = True
   if not os.environ.get('HGUSER') and not uio.config(ui, username):
   os.environ['HGUSER'] = 'web...@localhost'
   try:
   repo = hg.repository(ui=uio, path=path)
   except:
   repo = hg.repository(ui=uio, path=path, create=True)

given repo and a revision number from repo.changelog, how to I revert all files 
to that revision using the API?

Massimo

[web2py] Re: Powered by web2py

2010-10-24 Thread Anthony
A few more ideas for the Poweredby page:

- When entering the URL for a site, failure to include the http://;
results in the link simply not working. To avoid this problem, maybe
include the http://; in the URL text box by default (or automatically
prepend http://; to any URL submitted without http://;).

- I think we need a little more vertical space between the name of one
site and the thumbnail of the site below it. As is, once you're in the
middle of the page and can no longer see the top or bottom row for
reference, it's difficult to tell whether the name/link is associated
with the thumbnail above it or below it.

- Is there a reason the Poweredby page doesn't use the same layout as
the new web2py.com site?

- Would be great if we could have a handful of featured sites
displayed separately at the top -- there are a few real standouts that
are getting lost in the crowd.

- Of course, now that we've got a great Poweredby list, we need to
link to it from somewhere -- maybe add a link in the right sidebar of
web2py.com (maybe at the top of the list of links, or even as a
separate link just below the book).


Anthony

On Oct 22, 10:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 This was done by the wizard and it is already better than the previous
 one:

 http://web2py.com/poweredby

 Has thumbnails.

 On Oct 22, 8:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:



  OK. I have an account...

  On Oct 22, 6:19 pm, rochacbruno rochacbr...@gmail.com wrote:

   Thumbalizer has an API , REST and sample code for PHP but we can fork to 
   Python.

   Enviado via iPhone

   Em 22/10/2010, às 20:59, mdipierro mdipie...@cs.depaul.edu escreveu:

This thread contains lots of really nice sites. Others are listed
here:

   http://web2py.com/poweredby

If one of you had some spare time were to send me screenshots scaled
200x150 nameswww.domain.com.pngetcforall web2py powered sites, I
would use the template ofhttp://web2py.comandmakea nice showroom
with an ajax gallery.

Massimo

On Oct 22, 4:50 pm, Anthony av201...@yahoo.com wrote:
Very cool. Though it has some major display problems in IE7 (and some
minor problems with the home page in IE8). Also, you should probably
change the site's favicon -- it's actually using the new web2py
favicon.

Anthony

On Oct 22, 5:24 pm, Bruno Rocha rochacbr...@gmail.com wrote:

One more Brazilian site developed with WEB2PY

   http://campus.visie.com.br/default/index

This is the site where one of the most importants creative design 
agency of
São Paulo are giving online courses, they used web2py and Amazon with 
boto
library for video streaming.

This website was develop during an event with the help of all 
developers
attending, something like a Coding Dojo

2010/10/10 Bruno Rocha rochacbr...@gmail.com

A student of one of my classes of web2py training in Brazil, 
research the
web and made a list of websites powered by web2py.

he separates in categories: Populars, Great Ones, Good ones and 
which keeps
scaffold layout.

I found good designed websites in that list.

   http://www.elizabethscanvas.org/
   http://www.qakit.com/
   http://ru.ly/( an URL shortener)

Forwarded is the entire list, do you know someone else?

---
-- Forwarded message --
From: Rene Guerrero rene...@gmail.com
Date: 2010/10/10
Subject: Sites que utilizam web2py
To: rochacbr...@gmail.com

Bruno

Participei no seu curso de web2py básico na Tempo Real Eventos em 28 
de
agosto em São Paulo.
Desde aquela data até hoje tenho me dedicado a estudar o web2py.
Paralelamente fui na web procurar exemplos de sites desenvolvidos 
com o
web2py.
Encontrei vários, que classifiquei seguindo meu conceito de sites 
melhor
desenvolvidos, mais complexos ou mais bonitos.
Espero que sejam de alguma ajuda para você poder utilizar na sua 
tarefa
evangelizadora deste framework.
Para alguns deles não indico a página inicial, porque a mencionada me
pareceu mais esclarecedora.
Nem todos indicam inicialmente que foram feitos com web2py. Uns 
poucos só
indicam sua origem em algum lugar dentro dos respectivos blogs (da 
empresa
ou do autor).

Conhecidos:
   http://web2pyslices.com/main/default/index
   http://www.pyforum.org/
   http://www.qualitysystems.com/qs/
   http://www.tenthrow.com/home/
   http://radbox.me/
   https://us.pycon.org/2009/register/default/about
   https://us.pycon.org/2010/register/default/about

Bons:
   http://www.latnblack.com/
   http://auctionall.info/hausstand
   http://www.qakit.com/
   http://www.epysoft.com/
   http://www.healthscapes.org/welcome/default/index
   http://www.whitepeaksoftware.com/
   http://hipercenter.com/
   http://www.corraleslamagdalena.com.ar/lamagdalena/
   http://www.norterural.com.ar/norterural/default/noticias/2
   

[web2py] Re: Powered by web2py

2010-10-24 Thread mdipierro


On Oct 24, 5:26 pm, Anthony av201...@yahoo.com wrote:
 A few more ideas for the Poweredby page:

 - When entering the URL for a site, failure to include the http://;
 results in the link simply not working. To avoid this problem, maybe
 include the http://; in the URL text box by default (or automatically
 prepend http://; to any URL submitted without http://;).

done

 - I think we need a little more vertical space between the name of one
 site and the thumbnail of the site below it. As is, once you're in the
 middle of the page and can no longer see the top or bottom row for
 reference, it's difficult to tell whether the name/link is associated
 with the thumbnail above it or below it.

done

 - Is there a reason the Poweredby page doesn't use the same layout as
 the new web2py.com site?

I think it looks better on black background.

 - Would be great if we could have a handful of featured sites
 displayed separately at the top -- there are a few real standouts that
 are getting lost in the crowd.

done. Feel free to mark some as featured

 - Of course, now that we've got a great Poweredby list, we need to
 link to it from somewhere -- maybe add a link in the right sidebar of
 web2py.com (maybe at the top of the list of links, or even as a
 separate link just below the book).

I am very skeptical in our ability to keep it up to date.
If we can do that, I am happy to link from the main site.

 Anthony

 On Oct 22, 10:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  This was done by the wizard and it is already better than the previous
  one:

 http://web2py.com/poweredby

  Has thumbnails.

  On Oct 22, 8:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   OK. I have an account...

   On Oct 22, 6:19 pm, rochacbruno rochacbr...@gmail.com wrote:

Thumbalizer has an API , REST and sample code for PHP but we can fork 
to Python.

Enviado via iPhone

Em 22/10/2010, às 20:59, mdipierro mdipie...@cs.depaul.edu escreveu:

 This thread contains lots of really nice sites. Others are listed
 here:

http://web2py.com/poweredby

 If one of you had some spare time were to send me screenshots scaled
 200x150 nameswww.domain.com.pngetcforallweb2py powered sites, I
 would use the template ofhttp://web2py.comandmakeanice showroom
 with an ajax gallery.

 Massimo

 On Oct 22, 4:50 pm, Anthony av201...@yahoo.com wrote:
 Very cool. Though it has some major display problems in IE7 (and some
 minor problems with the home page in IE8). Also, you should probably
 change the site's favicon -- it's actually using the new web2py
 favicon.

 Anthony

 On Oct 22, 5:24 pm, Bruno Rocha rochacbr...@gmail.com wrote:

 One more Brazilian site developed with WEB2PY

http://campus.visie.com.br/default/index

 This is the site where one of the most importants creative design 
 agency of
 São Paulo are giving online courses, they used web2py and Amazon 
 with boto
 library for video streaming.

 This website was develop during an event with the help of all 
 developers
 attending, something like a Coding Dojo

 2010/10/10 Bruno Rocha rochacbr...@gmail.com

 A student of one of my classes of web2py training in Brazil, 
 research the
 web and made a list of websites powered by web2py.

 he separates in categories: Populars, Great Ones, Good ones and 
 which keeps
 scaffold layout.

 I found good designed websites in that list.

http://www.elizabethscanvas.org/
http://www.qakit.com/
http://ru.ly/( an URL shortener)

 Forwarded is the entire list, do you know someone else?

 ---
 -- Forwarded message --
 From: Rene Guerrero rene...@gmail.com
 Date: 2010/10/10
 Subject: Sites que utilizam web2py
 To: rochacbr...@gmail.com

 Bruno

 Participei no seu curso de web2py básico na Tempo Real Eventos em 
 28 de
 agosto em São Paulo.
 Desde aquela data até hoje tenho me dedicado a estudar o web2py.
 Paralelamente fui na web procurar exemplos de sites desenvolvidos 
 com o
 web2py.
 Encontrei vários, que classifiquei seguindo meu conceito de sites 
 melhor
 desenvolvidos, mais complexos ou mais bonitos.
 Espero que sejam de alguma ajuda para você poder utilizar na sua 
 tarefa
 evangelizadora deste framework.
 Para alguns deles não indico a página inicial, porque a mencionada 
 me
 pareceu mais esclarecedora.
 Nem todos indicam inicialmente que foram feitos com web2py. Uns 
 poucos só
 indicam sua origem em algum lugar dentro dos respectivos blogs (da 
 empresa
 ou do autor).

 Conhecidos:
http://web2pyslices.com/main/default/index
http://www.pyforum.org/
http://www.qualitysystems.com/qs/
http://www.tenthrow.com/home/
http://radbox.me/
https://us.pycon.org/2009/register/default/about

[web2py] Request for a logo - PluginCentral

2010-10-24 Thread Thadeus Burgess
I am working on plugin central, finally have some free time to devote to the
project. However I am a horrible artist, and wonder if anyone would like to
help me with designing a logo?

This is my color scheme

White - body content
#5E99E7 - Links  main color (a light blue)
#F5F4EF - Grey, page background

I would like to use the new Ubuntu font since it is open source.

--
Thadeus


[web2py] run-away threads

2010-10-24 Thread ae
Every so often, I have to restart web2py because no threads will
respond.

I guess that some set of conditions in one of my controllers leads to
an infinite loop?

Is there a way to set a timeout on controller functions?

Can you suggest any way to troubleshoot?

Thanks.


[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread VP
Thank you Massimo.  Your script as is didn't work for me (I use debian
lenny).  Apache complained about not recognizing virtual hosts and
that there was a duplicate of the wgsi deamon (I suppose only one
deamon should be named web2py).  I had to modify it to make it work.
(But still not desirable, more on this later).   In case, this might
be helpful to others, here's my Apache's configuration:

(Note, I run the daemon process using myaccount not as www-data; this
deviates from the official web2py suggestion)

VirtualHost *:80
  WSGIDaemonProcess web2py user=myaccount group=myaccount \
   display-name=%{GROUP}
  WSGIProcessGroup web2py
  WSGIScriptAlias / /home/myaccount/web2py/wsgihandler.py

  Directory /home/myaccount/web2py
AllowOverride None
Order Allow,Deny
Deny from all
Files wsgihandler.py
  Allow from all
/Files
  /Directory

  Location /admin
  Deny from all
  /Location

  LocationMatch ^/appadmin
  Deny from all
  /LocationMatch

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log
/VirtualHost


Now for each app and domain name, I have one of these:

VirtualHost *:80
  ServerName *.mydomain.com
  ServerAlias *.mydomain.com

  AliasMatch ^/static/(.*) \
   /home/myaccount/web2py/applications/app/static/$1

  Directory /home/myaccount/web2py/applications/app/static/
Options -Indexes
Order Allow,Deny
Allow from all
  /Directory
/VirtualHost



This seems to work for me.  One caveat is that I can access the other
apps from any of the domains.





[web2py] Re: run-away threads

2010-10-24 Thread cjrh
On Oct 25, 1:42 am, ae ae88...@gmail.com wrote:
 Every so often, I have to restart web2py because no threads will
 respond.

Are you working on Windows?   Do you send debugging output to the cmd
shell window, and then restore that window to inspect your output?
It could be that that shell window is locking your app, because you
clicked somewhere inside it.   Just hit enter with the focus on the
shell window, and the lock should be gone.  I do this fairly often.
I don't know why the shell window locks.



[web2py] Re: better mercurial integration

2010-10-24 Thread mdipierro
Actually I just did this with some help from Boris from the mercurial
mailing list.

Now if you run web2py from source ad you have mercurial installed
(easy_install mercurial) you can use the web2py admin to:

- create a repository (this is done automatically and it also makes
a .hgignore)
- commit file
- see log changes
- see list of files for each committed revision
- revert to past revision

(all by just clicking)

One important missing feature is the ability to get a diff vs a given
revision.
Another feature I would like to have is the ability to push from a web
repository or revert to it.



On Oct 24, 8:09 pm, mart msenecal...@gmail.com wrote:
 Hi Massimo,

 Ok, now I feel bad...  I have not had the time to finish the
 integration app I promised... Much is done, but not yet complete...  I
 still do intend on completing though... hopefully soon...

 Until then, what is your intent here? are you looking to restore a
 fileset (or entire tree) to a specific version from repo  (without
 changing meta data), are you looking to drop all meta changes, revert
 you local code line to known state?

 are you looking for a quick and dirty recipe like with combination of
 cmds to delete local changesets and revert to a speciic version (or
 #head revision) of the remote depot? like:
 delete local repo, then:
 hg init -- create new
 hg pull -- get a version
 hg update  -- well, just update...

 Although, by reading your commit script, I'd say you're pretty handy
 with mercurial API as it is.

 anyways, depends what you are looking to do... I can give you some
 quick and dirty recipes if you like, if it helps.

 Mart :)

 On Oct 24, 6:23 pm, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:

  Hello everybody,

  I am working on improving the web2py web interface to mercurial.

 http://127.0.0.1:8000/admin/mercurial/commit

  We can current create a repo, commit and get changelog but I cannot figure 
  out how to do revert.
  Here is the code I have:

     import os
     uio = ui.ui()
     uio.quiet = True
     if not os.environ.get('HGUSER') and not uio.config(ui, username):
         os.environ['HGUSER'] = 'web...@localhost'
     try:
         repo = hg.repository(ui=uio, path=path)
     except:
         repo = hg.repository(ui=uio, path=path, create=True)

  given repo and a revision number from repo.changelog, how to I revert all 
  files to that revision using the API?

  Massimo




[web2py] Re: Request for a logo - PluginCentral

2010-10-24 Thread mdipierro
Do you have a site up and running?

On Oct 24, 6:09 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 I am working on plugin central, finally have some free time to devote to the
 project. However I am a horrible artist, and wonder if anyone would like to
 help me with designing a logo?

 This is my color scheme

 White - body content
 #5E99E7 - Links  main color (a light blue)
 #F5F4EF - Grey, page background

 I would like to use the new Ubuntu font since it is open source.

 --
 Thadeus


[web2py] Re: Powered by web2py

2010-10-24 Thread Anthony
That was fast. Looks great.

If you want to link it from the main site, I'll volunteer to keep it
up to date. I think prospective users really like to see some
examples, so we should make them easy to find.

Anthony

On Oct 24, 7:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 On Oct 24, 5:26 pm, Anthony av201...@yahoo.com wrote:

  A few more ideas for the Poweredby page:

  - When entering the URL for a site, failure to include the http://;
  results in the link simply not working. To avoid this problem, maybe
  include the http://; in the URL text box by default (or automatically
  prepend http://; to any URL submitted without http://;).

 done

  - I think we need a little more vertical space between the name of one
  site and the thumbnail of the site below it. As is, once you're in the
  middle of the page and can no longer see the top or bottom row for
  reference, it's difficult to tell whether the name/link is associated
  with the thumbnail above it or below it.

 done

  - Is there a reason the Poweredby page doesn't use the same layout as
  the new web2py.com site?

 I think it looks better on black background.

  - Would be great if we could have a handful of featured sites
  displayed separately at the top -- there are a few real standouts that
  are getting lost in the crowd.

 done. Feel free to mark some as featured

  - Of course, now that we've got a great Poweredby list, we need to
  link to it from somewhere -- maybe add a link in the right sidebar of
  web2py.com (maybe at the top of the list of links, or even as a
  separate link just below the book).

 I am very skeptical in our ability to keep it up to date.
 If we can do that, I am happy to link from the main site.



  Anthony

  On Oct 22, 10:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   This was done by the wizard and it is already better than the previous
   one:

  http://web2py.com/poweredby

   Has thumbnails.

   On Oct 22, 8:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

OK. I have an account...

On Oct 22, 6:19 pm, rochacbruno rochacbr...@gmail.com wrote:

 Thumbalizer has an API , REST and sample code for PHP but we can fork 
 to Python.

 Enviado via iPhone

 Em 22/10/2010, às 20:59, mdipierro mdipie...@cs.depaul.edu escreveu:

  This thread contains lots of really nice sites. Others are listed
  here:

 http://web2py.com/poweredby

  If one of you had some spare time were to send me screenshots scaled
  200x150 nameswww.domain.com.pngetcforallweb2pypowered sites, I
  would use the template ofhttp://web2py.comandmakeaniceshowroom
  with an ajax gallery.

  Massimo

  On Oct 22, 4:50 pm, Anthony av201...@yahoo.com wrote:
  Very cool. Though it has some major display problems in IE7 (and 
  some
  minor problems with the home page in IE8). Also, you should 
  probably
  change the site's favicon -- it's actually using the new web2py
  favicon.

  Anthony

  On Oct 22, 5:24 pm, Bruno Rocha rochacbr...@gmail.com wrote:

  One more Brazilian site developed with WEB2PY

 http://campus.visie.com.br/default/index

  This is the site where one of the most importants creative design 
  agency of
  São Paulo are giving online courses, they used web2py and Amazon 
  with boto
  library for video streaming.

  This website was develop during an event with the help of all 
  developers
  attending, something like a Coding Dojo

  2010/10/10 Bruno Rocha rochacbr...@gmail.com

  A student of one of my classes of web2py training in Brazil, 
  research the
  web and made a list of websites powered by web2py.

  he separates in categories: Populars, Great Ones, Good ones and 
  which keeps
  scaffold layout.

  I found good designed websites in that list.

 http://www.elizabethscanvas.org/
 http://www.qakit.com/
 http://ru.ly/( an URL shortener)

  Forwarded is the entire list, do you know someone else?

  ---
  -- Forwarded message --
  From: Rene Guerrero rene...@gmail.com
  Date: 2010/10/10
  Subject: Sites que utilizam web2py
  To: rochacbr...@gmail.com

  Bruno

  Participei no seu curso de web2py básico na Tempo Real Eventos 
  em 28 de
  agosto em São Paulo.
  Desde aquela data até hoje tenho me dedicado a estudar o web2py.
  Paralelamente fui na web procurar exemplos de sites 
  desenvolvidos com o
  web2py.
  Encontrei vários, que classifiquei seguindo meu conceito de 
  sites melhor
  desenvolvidos, mais complexos ou mais bonitos.
  Espero que sejam de alguma ajuda para você poder utilizar na sua 
  tarefa
  evangelizadora deste framework.
  Para alguns deles não indico a página inicial, porque a 
  mencionada me
  pareceu mais esclarecedora.
  Nem todos indicam inicialmente que foram feitos com web2py. Uns 
  poucos só

[web2py] help with testing....

2010-10-24 Thread mdipierro
One may problem is holding on a new web2py version. Something *may*
have broken cron. If you use cron can you help us with testing cron in
trunk?

Massimo


[web2py] Re: Powered by web2py

2010-10-24 Thread mdipierro
If you do, I'll link it. ;-)

On Oct 24, 8:34 pm, Anthony av201...@yahoo.com wrote:
 That was fast. Looks great.

 If you want to link it from the main site, I'll volunteer to keep it
 up to date. I think prospective users really like to see some
 examples, so we should make them easy to find.

 Anthony

 On Oct 24, 7:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  On Oct 24, 5:26 pm, Anthony av201...@yahoo.com wrote:

   A few more ideas for the Poweredby page:

   - When entering the URL for a site, failure to include the http://;
   results in the link simply not working. To avoid this problem, maybe
   include the http://; in the URL text box by default (or automatically
   prepend http://; to any URL submitted without http://;).

  done

   - I think we need a little more vertical space between the name of one
   site and the thumbnail of the site below it. As is, once you're in the
   middle of the page and can no longer see the top or bottom row for
   reference, it's difficult to tell whether the name/link is associated
   with the thumbnail above it or below it.

  done

   - Is there a reason the Poweredby page doesn't use the same layout as
   the new web2py.com site?

  I think it looks better on black background.

   - Would be great if we could have a handful of featured sites
   displayed separately at the top -- there are a few real standouts that
   are getting lost in the crowd.

  done. Feel free to mark some as featured

   - Of course, now that we've got a great Poweredby list, we need to
   link to it from somewhere -- maybe add a link in the right sidebar of
   web2py.com (maybe at the top of the list of links, or even as a
   separate link just below the book).

  I am very skeptical in our ability to keep it up to date.
  If we can do that, I am happy to link from the main site.

   Anthony

   On Oct 22, 10:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:

This was done by the wizard and it is already better than the previous
one:

   http://web2py.com/poweredby

Has thumbnails.

On Oct 22, 8:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 OK. I have an account...

 On Oct 22, 6:19 pm, rochacbruno rochacbr...@gmail.com wrote:

  Thumbalizer has an API , REST and sample code for PHP but we can 
  fork to Python.

  Enviado via iPhone

  Em 22/10/2010, às 20:59, mdipierro mdipie...@cs.depaul.edu 
  escreveu:

   This thread contains lots of really nice sites. Others are listed
   here:

  http://web2py.com/poweredby

   If one of you had some spare time were to send me screenshots 
   scaled
   200x150 nameswww.domain.com.pngetcforallweb2pypoweredsites, I
   would use the template ofhttp://web2py.comandmakeaniceshowroom
   with an ajax gallery.

   Massimo

   On Oct 22, 4:50 pm, Anthony av201...@yahoo.com wrote:
   Very cool. Though it has some major display problems in IE7 (and 
   some
   minor problems with the home page in IE8). Also, you should 
   probably
   change the site's favicon -- it's actually using the new web2py
   favicon.

   Anthony

   On Oct 22, 5:24 pm, Bruno Rocha rochacbr...@gmail.com wrote:

   One more Brazilian site developed with WEB2PY

  http://campus.visie.com.br/default/index

   This is the site where one of the most importants creative 
   design agency of
   São Paulo are giving online courses, they used web2py and 
   Amazon with boto
   library for video streaming.

   This website was develop during an event with the help of all 
   developers
   attending, something like a Coding Dojo

   2010/10/10 Bruno Rocha rochacbr...@gmail.com

   A student of one of my classes of web2py training in Brazil, 
   research the
   web and made a list of websites powered by web2py.

   he separates in categories: Populars, Great Ones, Good ones 
   and which keeps
   scaffold layout.

   I found good designed websites in that list.

  http://www.elizabethscanvas.org/
  http://www.qakit.com/
  http://ru.ly/( an URL shortener)

   Forwarded is the entire list, do you know someone else?

   ---
   -- Forwarded message --
   From: Rene Guerrero rene...@gmail.com
   Date: 2010/10/10
   Subject: Sites que utilizam web2py
   To: rochacbr...@gmail.com

   Bruno

   Participei no seu curso de web2py básico na Tempo Real Eventos 
   em 28 de
   agosto em São Paulo.
   Desde aquela data até hoje tenho me dedicado a estudar o 
   web2py.
   Paralelamente fui na web procurar exemplos de sites 
   desenvolvidos com o
   web2py.
   Encontrei vários, que classifiquei seguindo meu conceito de 
   sites melhor
   desenvolvidos, mais complexos ou mais bonitos.
   Espero que sejam de alguma ajuda para você poder utilizar na 
   sua tarefa
   evangelizadora deste 

[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread VP
What works is that http://domain1.com will map to app1 as intended.

What doesn't work is that app1/default/f/a/b is not mapped to f/a/b or
vice versa.  This is ugly.

Can you show me how to get rid of app1/default?

Thanks.


[web2py] Re: Link-pass data to new view via session not on URL

2010-10-24 Thread Brian M
If you're looking up off of a session variable, be sure to take into
account what might happen if a user happens to have your site open in
multiple windows/tabs.  What if you've got a client looking for room
rates in different tabs for two different dates or rooms trying to do
some comparison shopping? They have tab A open with rates for date A
and tab B open for rates for date B.  They decide that they like offer
#5 on tab A and click the link/submit the form.  However, the contents
of the session have changed since tab A was originally rendered and
you now you actually look up offer #5 from tab B and the client gets
something completely different than what they wanted.  It may not be a
concern for your app, but it is something to consider.

On Oct 24, 3:35 pm, cjrh caleb.hatti...@gmail.com wrote:
 On Oct 24, 9:48 pm, Brian M bmere...@gmail.com wrote:

  How about include all the calculated values in your form and add in an
  additional field that's a HMAC keyed hash of the others using a key
  that only you know? When the user submits, make sure the rest of the
  field values still combine  hash the same way and then you'll know
  the user hasn't messed with the form.  

 Thanks for the comment.  It's very clever, but too much work.  I am
 rather going to keep my calculated values in the server-side session,
 and always fetch them from there.  The client will only every submit
 an index into that server-side hash.  I am fairly sure now that this
 is the way to go here.


[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread mdipierro
The messages that starts the thread explains that. I tried and it
works.

On Oct 24, 9:02 pm, VP vtp2...@gmail.com wrote:
 What works is thathttp://domain1.comwill map to app1 as intended.

 What doesn't work is that app1/default/f/a/b is not mapped to f/a/b or
 vice versa.  This is ugly.

 Can you show me how to get rid of app1/default?

 Thanks.


[web2py] Re: better mercurial integration

2010-10-24 Thread mart
K, good stuff! I'll use what you and Boris came up with and integrate
to mine (will help speed things up) the other project :) and for the
other thing, great idea (i think).  what do you mean by web
repository? do you mean reproduce from the code behind a live web2py
server instance? which would be a grand idea! if that's what you mean.
I would doable if a well kept manifest (generated through automation
on pull) describing in xml format file names (path) and rev # be
installed long with web2py. then a simple xmlrpc meg over https should
get you a nice xml file wich can be used to resolve the variables used
in a hg pull cmd. (at least that's what I'd do to start) - I do
something like that to get build automation to talk to the bug
tracking system (keeps QA happy with reports like build X contains
THIS list of bug fixes as described in THIS list of changelist
description, which contains THIS list of affected files, which was
checked in by THIS user, and reviewd by etc

But, please let me know if I got the requirement all wrong, and I'll
be happy to suggest another approach.



For the diff requirement: I would definitely start fro the bottom up.
This is what I do currently do with Perforce (logic should be
similar).

1) I generate an XML representation of a directory structure (where I
need to be able to specify any folder within my dir structure as the
root folder (the starting point), and need to be able to exclude
files and/folders as params to the function call.

2) once I have my xml object (I like a well structured Element Tree
for this type of thing), I will simply pass the elements (in a loop)
to a function that will have the know-how to return a correct mapping
between repository and workspace (i think Mercurial calls this the
Working Directory).

3) diff the file, capture the diff (if any) store it (keeping the the
return strings in order is important, so I keep each return values as
a dictionary within warm brackets of a collection that respects order
(like a deque()).

once done and have gone through the the complete fileset, then it just
depends on how fancy we want to be (color, special indentation, format
to 2 pages, etc..._) or the complete returned values can be formatted
and handed to araxis (or something like that)...

in the .hg word, its a little more convoluted in that I believe
another repository needs to be created and changes pulled from the
from the revision you are interested in (can be any revision or
latest but it does need to be specified. Would look something like
this:


mkdir myTempDir
cd myTempDir
hg init
hg pull myTempDir
hg update -r N

then do that recursive diff as discussed above

is this what you were looking for?

Mart :)

connect to app admin through script:
On Oct 24, 9:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Actually I just did this with some help from Boris from the mercurial
 mailing list.

 Now if you run web2py from source ad you have mercurial installed
 (easy_install mercurial) you can use the web2py admin to:

 - create a repository (this is done automatically and it also makes
 a .hgignore)
 - commit file
 - see log changes
 - see list of files for each committed revision
 - revert to past revision

 (all by just clicking)

 One important missing feature is the ability to get a diff vs a given
 revision.
 Another feature I would like to have is the ability to push from a web
 repository or revert to it.

 On Oct 24, 8:09 pm, mart msenecal...@gmail.com wrote:

  Hi Massimo,

  Ok, now I feel bad...  I have not had the time to finish the
  integration app I promised... Much is done, but not yet complete...  I
  still do intend on completing though... hopefully soon...

  Until then, what is your intent here? are you looking to restore a
  fileset (or entire tree) to a specific version from repo  (without
  changing meta data), are you looking to drop all meta changes, revert
  you local code line to known state?

  are you looking for a quick and dirty recipe like with combination of
  cmds to delete local changesets and revert to a speciic version (or
  #head revision) of the remote depot? like:
  delete local repo, then:
  hg init -- create new
  hg pull -- get a version
  hg update  -- well, just update...

  Although, by reading your commit script, I'd say you're pretty handy
  with mercurial API as it is.

  anyways, depends what you are looking to do... I can give you some
  quick and dirty recipes if you like, if it helps.

  Mart :)

  On Oct 24, 6:23 pm, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:

   Hello everybody,

   I am working on improving the web2py web interface to mercurial.

  http://127.0.0.1:8000/admin/mercurial/commit

   We can current create a repo, commit and get changelog but I cannot 
   figure out how to do revert.
   Here is the code I have:

      import os
      uio = ui.ui()
      uio.quiet = True
      if not os.environ.get('HGUSER') and not uio.config(ui, username):
          os.environ['HGUSER'] = 

[web2py] Re: better mercurial integration

2010-10-24 Thread mdipierro
I would be happier with much less...

1) a button in the /admin/mercurial/revision/n page that says [diff]
and provides a text output with a diff between the revision and the
current code

2) a few more fields in the /admin/mercurial/commit page that say

changelog: write something here
repository: https://.googlecode.com/hg/
push: yes/[no] (if yes code is pushed in googlecode)
pop: yes/[no] (if yes, current code is cloned from googlecode and
overwritten)

I think of [merge] as a third order approximation and it is difficult
to get it right.

Massimo


On Oct 24, 10:16 pm, mart msenecal...@gmail.com wrote:
 K, good stuff! I'll use what you and Boris came up with and integrate
 to mine (will help speed things up) the other project :) and for the
 other thing, great idea (i think).  what do you mean by web
 repository? do you mean reproduce from the code behind a live web2py
 server instance? which would be a grand idea! if that's what you mean.
 I would doable if a well kept manifest (generated through automation
 on pull) describing in xml format file names (path) and rev # be
 installed long with web2py. then a simple xmlrpc meg over https should
 get you a nice xml file wich can be used to resolve the variables used
 in a hg pull cmd. (at least that's what I'd do to start) - I do
 something like that to get build automation to talk to the bug
 tracking system (keeps QA happy with reports like build X contains
 THIS list of bug fixes as described in THIS list of changelist
 description, which contains THIS list of affected files, which was
 checked in by THIS user, and reviewd by etc

 But, please let me know if I got the requirement all wrong, and I'll
 be happy to suggest another approach.

 For the diff requirement: I would definitely start fro the bottom up.
 This is what I do currently do with Perforce (logic should be
 similar).

 1) I generate an XML representation of a directory structure (where I
 need to be able to specify any folder within my dir structure as the
 root folder (the starting point), and need to be able to exclude
 files and/folders as params to the function call.

 2) once I have my xml object (I like a well structured Element Tree
 for this type of thing), I will simply pass the elements (in a loop)
 to a function that will have the know-how to return a correct mapping
 between repository and workspace (i think Mercurial calls this the
 Working Directory).

 3) diff the file, capture the diff (if any) store it (keeping the the
 return strings in order is important, so I keep each return values as
 a dictionary within warm brackets of a collection that respects order
 (like a deque()).

 once done and have gone through the the complete fileset, then it just
 depends on how fancy we want to be (color, special indentation, format
 to 2 pages, etc..._) or the complete returned values can be formatted
 and handed to araxis (or something like that)...

 in the .hg word, its a little more convoluted in that I believe
 another repository needs to be created and changes pulled from the
 from the revision you are interested in (can be any revision or
 latest but it does need to be specified. Would look something like
 this:

 mkdir myTempDir
 cd myTempDir
 hg init
 hg pull myTempDir
 hg update -r N

 then do that recursive diff as discussed above

 is this what you were looking for?

 Mart :)

 connect to app admin through script:
 On Oct 24, 9:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:





  Actually I just did this with some help from Boris from the mercurial
  mailing list.

  Now if you run web2py from source ad you have mercurial installed
  (easy_install mercurial) you can use the web2py admin to:

  - create a repository (this is done automatically and it also makes
  a .hgignore)
  - commit file
  - see log changes
  - see list of files for each committed revision
  - revert to past revision

  (all by just clicking)

  One important missing feature is the ability to get a diff vs a given
  revision.
  Another feature I would like to have is the ability to push from a web
  repository or revert to it.

  On Oct 24, 8:09 pm, mart msenecal...@gmail.com wrote:

   Hi Massimo,

   Ok, now I feel bad...  I have not had the time to finish the
   integration app I promised... Much is done, but not yet complete...  I
   still do intend on completing though... hopefully soon...

   Until then, what is your intent here? are you looking to restore a
   fileset (or entire tree) to a specific version from repo  (without
   changing meta data), are you looking to drop all meta changes, revert
   you local code line to known state?

   are you looking for a quick and dirty recipe like with combination of
   cmds to delete local changesets and revert to a speciic version (or
   #head revision) of the remote depot? like:
   delete local repo, then:
   hg init -- create new
   hg pull -- get a version
   hg update  -- well, just update...

   Although, by reading your commit script, 

[web2py] Re: traceback on wizard

2010-10-24 Thread mdipierro
This is patched. Thanks for your patch.

On Oct 24, 5:22 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 running trunk, attempting to use wizard, dies on step6

 Traceback (most recent call last):
   File /home/thadeusb/Applications/web2py/gluon/restricted.py, line
 188, in restricted

     exec ccode in environment
   File 
 /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
 http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
 line 527, in module

   File /home/thadeusb/Applications/web2py/gluon/globals.py, line 96,
 in lambda

     self._caller = lambda f: f()

   File 
 /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
 http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
 line 191, in step6

     create(form.vars)
   File 
 /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
 http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
 line 510, in create

     file.write(make_page(page,session.app.get('page_'+page,'')))

   File 
 /home/thadeusb/Applications/web2py/applications/admin/controllers/wizard.py
 http://127.0.0.1:8000/admin/default/edit/admin/controllers/wizard.py,
 line 382, in make_page

     s+=    query=f and db.t_%s[f]==v or None\n % (t,t)
 TypeError: not all arguments converted during string formatting

 --
 Thadeus


[web2py] list:string thoughts

2010-10-24 Thread rick
I'm getting frustrated with the list:string field type.

I store products, each product has keywords that describe the
product.
db.define_table('products',
   Field('keywords', 'list:string'))
I don't know what the keywords will be, so I can't use IS_IN_SET()

It seems to stores the keywords fine, as long as (I'm using Crud)
I separate the keywords like this: green|blue|red

But when I make this call
rows = db(db.products.keywords.contains(keyword)).select()
I don't get all the products back that I should! In fact, it seems
that I need to do an update on the product (again using Crud,
and any sort of update) before the product's keywords will be
picked up.

Is this a problem with using Crud?
In all honesty, I'd be more comfortable not using list:string, and
having a separate table keywords that linked (many-to-one)
to the products table, but I really don't know how I would even
begin to do that in web2py..

Thanks for reading!
- rick


[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread VP
Update:

if the function has no arguments, it works.  I.e.  
http://domain.com/app/default/f
gets mapped correctly to http://domain.com/f

But if the function has arguments, it did not work for me.   I.e
http://domain.com/app/default/g/a/b does not get mapped to 
http://domain.com/g/a/b

PS:
I got the script from here: 
http://web2py.googlecode.com/hg/scripts/autoroutes.py
as far as I can tell, it's the same as the one in this this thread.


[web2py] Re: list:string thoughts

2010-10-24 Thread mdipierro
The list:string is not an alternative to using a tag table and
tag_link many-to-many (an example of which is provided by
plugin_tagging).

Yet you should not have the problem you experience. With recent
versions of web2py, Field('keywords', 'list:string') should be
rendered by a new widget that takes one keyword per line and adds new
lines when yo press enter. You should not be using '|' to separate
keywords. If you do all keywords will be interpreted as one long
keyword containing the '|'s.

Massimo


On Oct 24, 10:35 pm, rick ricon...@gmail.com wrote:
 I'm getting frustrated with the list:string field type.

 I store products, each product has keywords that describe the
 product.
 db.define_table('products',
    Field('keywords', 'list:string'))
 I don't know what the keywords will be, so I can't use IS_IN_SET()

 It seems to stores the keywords fine, as long as (I'm using Crud)
 I separate the keywords like this: green|blue|red

 But when I make this call
 rows = db(db.products.keywords.contains(keyword)).select()
 I don't get all the products back that I should! In fact, it seems
 that I need to do an update on the product (again using Crud,
 and any sort of update) before the product's keywords will be
 picked up.

 Is this a problem with using Crud?
 In all honesty, I'd be more comfortable not using list:string, and
 having a separate table keywords that linked (many-to-one)
 to the products table, but I really don't know how I would even
 begin to do that in web2py..

 Thanks for reading!
 - rick


[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread mdipierro
Aha! My mistake. $a should have been $anything everywhere in the
code.

I fixed is and re-posted in trunk now under scripts/autoroutes.py

Massimo


On Oct 24, 10:51 pm, VP vtp2...@gmail.com wrote:
 Update:

 if the function has no arguments, it works.  I.e.  
 http://domain.com/app/default/f
 gets mapped correctly tohttp://domain.com/f

 But if the function has arguments, it did not work for me.   
 I.ehttp://domain.com/app/default/g/a/bdoes not get mapped 
 tohttp://domain.com/g/a/b

 PS:
 I got the script from 
 here:http://web2py.googlecode.com/hg/scripts/autoroutes.py
 as far as I can tell, it's the same as the one in this this thread.


[web2py] Re: better mercurial integration

2010-10-24 Thread mart
k, items 1 and 2 should be simple enough  item 3, that is a
different story, but ok, sure. I think merging outside of the
mercurial context is best though, then simply update the remote
repository with the merged file (and include good notes describing
both source files and capturing the diffs of the merge is best).

I will be under the gun at work for the next few days, but after that
will be able to have something for you - by end of week is a good
buffer.

1 question: how large of added disk space usage would you is
acceptable - I have an idea that I will look into. (I always favor
having less network IO, and more disk IO when possible).

Let me know if end of week is good for you.

Mart

On Oct 24, 11:26 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I would be happier with much less...

 1) a button in the /admin/mercurial/revision/n page that says [diff]
 and provides a text output with a diff between the revision and the
 current code

 2) a few more fields in the /admin/mercurial/commit page that say

 changelog: write something here
 repository: https://.googlecode.com/hg/
 push: yes/[no] (if yes code is pushed in googlecode)
 pop: yes/[no] (if yes, current code is cloned from googlecode and
 overwritten)

 I think of [merge] as a third order approximation and it is difficult
 to get it right.

 Massimo

 On Oct 24, 10:16 pm, mart msenecal...@gmail.com wrote:

  K, good stuff! I'll use what you and Boris came up with and integrate
  to mine (will help speed things up) the other project :) and for the
  other thing, great idea (i think).  what do you mean by web
  repository? do you mean reproduce from the code behind a live web2py
  server instance? which would be a grand idea! if that's what you mean.
  I would doable if a well kept manifest (generated through automation
  on pull) describing in xml format file names (path) and rev # be
  installed long with web2py. then a simple xmlrpc meg over https should
  get you a nice xml file wich can be used to resolve the variables used
  in a hg pull cmd. (at least that's what I'd do to start) - I do
  something like that to get build automation to talk to the bug
  tracking system (keeps QA happy with reports like build X contains
  THIS list of bug fixes as described in THIS list of changelist
  description, which contains THIS list of affected files, which was
  checked in by THIS user, and reviewd by etc

  But, please let me know if I got the requirement all wrong, and I'll
  be happy to suggest another approach.

  For the diff requirement: I would definitely start fro the bottom up.
  This is what I do currently do with Perforce (logic should be
  similar).

  1) I generate an XML representation of a directory structure (where I
  need to be able to specify any folder within my dir structure as the
  root folder (the starting point), and need to be able to exclude
  files and/folders as params to the function call.

  2) once I have my xml object (I like a well structured Element Tree
  for this type of thing), I will simply pass the elements (in a loop)
  to a function that will have the know-how to return a correct mapping
  between repository and workspace (i think Mercurial calls this the
  Working Directory).

  3) diff the file, capture the diff (if any) store it (keeping the the
  return strings in order is important, so I keep each return values as
  a dictionary within warm brackets of a collection that respects order
  (like a deque()).

  once done and have gone through the the complete fileset, then it just
  depends on how fancy we want to be (color, special indentation, format
  to 2 pages, etc..._) or the complete returned values can be formatted
  and handed to araxis (or something like that)...

  in the .hg word, its a little more convoluted in that I believe
  another repository needs to be created and changes pulled from the
  from the revision you are interested in (can be any revision or
  latest but it does need to be specified. Would look something like
  this:

  mkdir myTempDir
  cd myTempDir
  hg init
  hg pull myTempDir
  hg update -r N

  then do that recursive diff as discussed above

  is this what you were looking for?

  Mart :)

  connect to app admin through script:
  On Oct 24, 9:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Actually I just did this with some help from Boris from the mercurial
   mailing list.

   Now if you run web2py from source ad you have mercurial installed
   (easy_install mercurial) you can use the web2py admin to:

   - create a repository (this is done automatically and it also makes
   a .hgignore)
   - commit file
   - see log changes
   - see list of files for each committed revision
   - revert to past revision

   (all by just clicking)

   One important missing feature is the ability to get a diff vs a given
   revision.
   Another feature I would like to have is the ability to push from a web
   repository or revert to it.

   On Oct 24, 8:09 pm, mart 

[web2py] Re: tip of the day. The power of routes

2010-10-24 Thread VP
Great. It appears to be working as intended now.  Thanks.


[web2py] Hidden form fields not accepted by form.accept()?

2010-10-24 Thread Ruiwen Chua
Hi all,

I have created a manual HTML form (not FORM() or SQLFORM()) that has a
few hidden fields (ie. input type=hidden..)

When this form posts back to the controller, form.accepts() returns
True, but only the non-hidden field (there is only one, the rest are
hidden) is saved to the database. The other fields all get saved as
NULL.

Is there something I'm missing?

Thanks


[web2py] Re: Hidden form fields not accepted by form.accept()?

2010-10-24 Thread mdipierro
if you use

form.accepts()

what is form if you do not use FORM or SQLFORM?

On Oct 24, 11:27 pm, Ruiwen Chua rwc...@gmail.com wrote:
 Hi all,

 I have created a manual HTML form (not FORM() or SQLFORM()) that has a
 few hidden fields (ie. input type=hidden..)

 When this form posts back to the controller, form.accepts() returns
 True, but only the non-hidden field (there is only one, the rest are
 hidden) is saved to the database. The other fields all get saved as
 NULL.

 Is there something I'm missing?

 Thanks


[web2py] Re: Hidden form fields not accepted by form.accept()?

2010-10-24 Thread Ruiwen Chua
Apologies, I wasn't clear. I meant that the form in the view is static
HTML and not generated by SQLFORM.

However, in the action that receives the POST, I instantiate a new
SQLFORM for that model and pass request.post_vars to it.

On Oct 25, 12:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 if you use

 form.accepts()

 what is form if you do not use FORM or SQLFORM?

 On Oct 24, 11:27 pm, Ruiwen Chua rwc...@gmail.com wrote:







  Hi all,

  I have created a manual HTML form (not FORM() or SQLFORM()) that has a
  few hidden fields (ie. input type=hidden..)

  When this form posts back to the controller, form.accepts() returns
  True, but only the non-hidden field (there is only one, the rest are
  hidden) is saved to the database. The other fields all get saved as
  NULL.

  Is there something I'm missing?

  Thanks


[web2py] Re: better mercurial integration

2010-10-24 Thread mdipierro
I am flying to a conference so there is no hurry. Anything you can get
done within the next 8 days will be great.

On Oct 24, 11:15 pm, mart msenecal...@gmail.com wrote:
 k, items 1 and 2 should be simple enough  item 3, that is a
 different story, but ok, sure. I think merging outside of the
 mercurial context is best though, then simply update the remote
 repository with the merged file (and include good notes describing
 both source files and capturing the diffs of the merge is best).

 I will be under the gun at work for the next few days, but after that
 will be able to have something for you - by end of week is a good
 buffer.

 1 question: how large of added disk space usage would you is
 acceptable - I have an idea that I will look into. (I always favor
 having less network IO, and more disk IO when possible).

 Let me know if end of week is good for you.

 Mart

 On Oct 24, 11:26 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I would be happier with much less...

  1) a button in the /admin/mercurial/revision/n page that says [diff]
  and provides a text output with a diff between the revision and the
  current code

  2) a few more fields in the /admin/mercurial/commit page that say

  changelog: write something here
  repository: https://.googlecode.com/hg/
  push: yes/[no] (if yes code is pushed in googlecode)
  pop: yes/[no] (if yes, current code is cloned from googlecode and
  overwritten)

  I think of [merge] as a third order approximation and it is difficult
  to get it right.

  Massimo

  On Oct 24, 10:16 pm, mart msenecal...@gmail.com wrote:

   K, good stuff! I'll use what you and Boris came up with and integrate
   to mine (will help speed things up) the other project :) and for the
   other thing, great idea (i think).  what do you mean by web
   repository? do you mean reproduce from the code behind a live web2py
   server instance? which would be a grand idea! if that's what you mean.
   I would doable if a well kept manifest (generated through automation
   on pull) describing in xml format file names (path) and rev # be
   installed long with web2py. then a simple xmlrpc meg over https should
   get you a nice xml file wich can be used to resolve the variables used
   in a hg pull cmd. (at least that's what I'd do to start) - I do
   something like that to get build automation to talk to the bug
   tracking system (keeps QA happy with reports like build X contains
   THIS list of bug fixes as described in THIS list of changelist
   description, which contains THIS list of affected files, which was
   checked in by THIS user, and reviewd by etc

   But, please let me know if I got the requirement all wrong, and I'll
   be happy to suggest another approach.

   For the diff requirement: I would definitely start fro the bottom up.
   This is what I do currently do with Perforce (logic should be
   similar).

   1) I generate an XML representation of a directory structure (where I
   need to be able to specify any folder within my dir structure as the
   root folder (the starting point), and need to be able to exclude
   files and/folders as params to the function call.

   2) once I have my xml object (I like a well structured Element Tree
   for this type of thing), I will simply pass the elements (in a loop)
   to a function that will have the know-how to return a correct mapping
   between repository and workspace (i think Mercurial calls this the
   Working Directory).

   3) diff the file, capture the diff (if any) store it (keeping the the
   return strings in order is important, so I keep each return values as
   a dictionary within warm brackets of a collection that respects order
   (like a deque()).

   once done and have gone through the the complete fileset, then it just
   depends on how fancy we want to be (color, special indentation, format
   to 2 pages, etc..._) or the complete returned values can be formatted
   and handed to araxis (or something like that)...

   in the .hg word, its a little more convoluted in that I believe
   another repository needs to be created and changes pulled from the
   from the revision you are interested in (can be any revision or
   latest but it does need to be specified. Would look something like
   this:

   mkdir myTempDir
   cd myTempDir
   hg init
   hg pull myTempDir
   hg update -r N

   then do that recursive diff as discussed above

   is this what you were looking for?

   Mart :)

   connect to app admin through script:
   On Oct 24, 9:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:

Actually I just did this with some help from Boris from the mercurial
mailing list.

Now if you run web2py from source ad you have mercurial installed
(easy_install mercurial) you can use the web2py admin to:

- create a repository (this is done automatically and it also makes
a .hgignore)
- commit file
- see log changes
- see list of files for each committed revision
- revert to past 

[web2py] Re: Hidden form fields not accepted by form.accept()?

2010-10-24 Thread mdipierro
The hidden fields will be in request.vars but not in form.vars because
accepts does not know they are supposed to be there and protects you
from injection attacks.

You can also try use this:

form=SQLFORM(,hidden=dict(key='value'))

Massimo


On Oct 24, 11:39 pm, Ruiwen Chua rwc...@gmail.com wrote:
 Apologies, I wasn't clear. I meant that the form in the view is static
 HTML and not generated by SQLFORM.

 However, in the action that receives the POST, I instantiate a new
 SQLFORM for that model and pass request.post_vars to it.

 On Oct 25, 12:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  if you use

  form.accepts()

  what is form if you do not use FORM or SQLFORM?

  On Oct 24, 11:27 pm, Ruiwen Chua rwc...@gmail.com wrote:

   Hi all,

   I have created a manual HTML form (not FORM() or SQLFORM()) that has a
   few hidden fields (ie. input type=hidden..)

   When this form posts back to the controller, form.accepts() returns
   True, but only the non-hidden field (there is only one, the rest are
   hidden) is saved to the database. The other fields all get saved as
   NULL.

   Is there something I'm missing?

   Thanks




[web2py] Re: tip of the day. The power of routes [CLOSED]

2010-10-24 Thread mdipierro
:-)

On Oct 24, 11:19 pm, VP vtp2...@gmail.com wrote:
 Great. It appears to be working as intended now.  Thanks.


[web2py] Re: Hidden form fields not accepted by form.accept()?

2010-10-24 Thread Ruiwen Chua
Yes, the hidden input values do seem to appear in request.post_vars.

I call form.accepts(), like so: form.accepts(request.post_vars,
formname=None)

And even so, only the non-hidden field is saved to the database.


On Oct 25, 12:43 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 The hidden fields will be in request.vars but not in form.vars because
 accepts does not know they are supposed to be there and protects you
 from injection attacks.

 You can also try use this:

 form=SQLFORM(,hidden=dict(key='value'))

 Massimo

 On Oct 24, 11:39 pm, Ruiwen Chua rwc...@gmail.com wrote:







  Apologies, I wasn't clear. I meant that the form in the view is static
  HTML and not generated by SQLFORM.

  However, in the action that receives the POST, I instantiate a new
  SQLFORM for that model and pass request.post_vars to it.

  On Oct 25, 12:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   if you use

   form.accepts()

   what is form if you do not use FORM or SQLFORM?

   On Oct 24, 11:27 pm, Ruiwen Chua rwc...@gmail.com wrote:

Hi all,

I have created a manual HTML form (not FORM() or SQLFORM()) that has a
few hidden fields (ie. input type=hidden..)

When this form posts back to the controller, form.accepts() returns
True, but only the non-hidden field (there is only one, the rest are
hidden) is saved to the database. The other fields all get saved as
NULL.

Is there something I'm missing?

Thanks


[web2py] Re: Hidden form fields not accepted by form.accept()?

2010-10-24 Thread mdipierro
I understand. That is intended. That is a security mechanism.
You must use SQLFORM(...,hidden=...)


On Oct 24, 11:46 pm, Ruiwen Chua rwc...@gmail.com wrote:
 Yes, the hidden input values do seem to appear in request.post_vars.

 I call form.accepts(), like so: form.accepts(request.post_vars,
 formname=None)

 And even so, only the non-hidden field is saved to the database.

 On Oct 25, 12:43 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  The hidden fields will be in request.vars but not in form.vars because
  accepts does not know they are supposed to be there and protects you
  from injection attacks.

  You can also try use this:

  form=SQLFORM(,hidden=dict(key='value'))

  Massimo

  On Oct 24, 11:39 pm, Ruiwen Chua rwc...@gmail.com wrote:

   Apologies, I wasn't clear. I meant that the form in the view is static
   HTML and not generated by SQLFORM.

   However, in the action that receives the POST, I instantiate a new
   SQLFORM for that model and pass request.post_vars to it.

   On Oct 25, 12:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

if you use

form.accepts()

what is form if you do not use FORM or SQLFORM?

On Oct 24, 11:27 pm, Ruiwen Chua rwc...@gmail.com wrote:

 Hi all,

 I have created a manual HTML form (not FORM() or SQLFORM()) that has a
 few hidden fields (ie. input type=hidden..)

 When this form posts back to the controller, form.accepts() returns
 True, but only the non-hidden field (there is only one, the rest are
 hidden) is saved to the database. The other fields all get saved as
 NULL.

 Is there something I'm missing?

 Thanks




  1   2   >