[web2py] removing admin vs cron

2010-03-18 Thread Jonathan Lundell
When I completely remove admin, cron crashes:

   File /opt/vtc/vpepmanage/web2py/web2py.py, line 20, in module
 gluon.widget.start(cron=True)
   File /opt/vtc/vpepmanage/web2py/gluon/widget.py, line 732, in start
 cron = contrib.cron.hardcron()
   File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 44, in 
  __init__
 self.launch()
   File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 48, in 
  launch
 crondance(self.path, 'hard', startup = self.startup)
   File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 240, 
  in crondance
 token = Token(cron_path)
   File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 88, in 
  __init__
 open(self.path,'wb').close()
  IOError: [Errno 2] No such file or directory: 
  '/opt/vtc/vpepmanage/web2py/applications/admin/cron/cron.master'

Is it enough to simply create the empty directories?

At any rate, I don't think that cron should depend on admin (or its directory 
structure); maybe there should be a cron directory at the web2py root?

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



[web2py] administratively adding a user

2010-03-18 Thread Jonathan Lundell
I have an app in which a (prepopulated) administrative user adds other users, 
and assigned them one of three predefined roles.

So is the right thing to do to bypass SQLFORM, use my own Form, and call Auth 
to do the housekeeping?

Likewise updating a user (name/email/password changes, role change).

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



Re: [web2py] Re: web2py beautification

2010-03-19 Thread Jonathan Lundell
On Mar 19, 2010, at 7:27 AM, Thadeus Burgess wrote:

 CSS does not suck, your just doing it wrong!
 
 Massimo, I have done this layout that you want many many times in css,
 without a framework, ez-css makes this even easier.

The author of ez-css is refreshingly candid, at least by implication, about the 
suckiness of CSS for layout. One reason all his layouts work as well as they do 
is that all the columns have the same background (white in his examples). 
You'll notice if you look at the actual dimensions of his divs on the actual 
pages on the site that the column divs are not in fact the same height; you 
just don't see it because they're the same color background.

It may be that one's best course is to design around the limitations and 
idiosyncrasies of CSS; I do that, pretty much. My complaint is that its box 
model from the beginning was unsuited to what designers normally do, and the 
result is the proliferation of CSS frameworks that exist mainly to work around 
its limitations.

I *ought* to be able to say: put a full-width header and footer on the page. 
Give me n columns in any reasonable combination of widths that I care to 
specify, and make them all the size of the tallest, with single-pixel borders 
all around. And I ought to be able to say it simply. But I can't. 

I *can* say that trivially with a table. Tables have their own limitations, and 
CSS corrects some of them. But it seems to me that CSS shouldn't have made the 
layouts we can get trivially with tables difficult or impossible with CSS.


 
 And the way you describe it, ez-css does exactly what you want? Look
 at their layout 2. So the blue number 1 (1 comes first physically in
 the html) must have a size declared (your menu, 200px). The number 2
 (content) comes second, and flows the full width of the container
 object.
 
 To take a quote from their site that is easy to miss. The numbers
 in the modules and layouts above show the source order (the HTML
 flow). Blue numbers correspond to columns for which a width needs to
 be set (which are all columns in a module but the last one in the
 flow).
 
 -Thadeus
 
 
 
 
 
 On Fri, Mar 19, 2010 at 3:05 AM, Abd Shomad abd.sho...@gmail.com wrote:
 Dear Massimo,
 
 This is my first post to web2py :)
 
 I proposed to have a look at Fluid 960 Grid System [1] example.
 
 [1] http://www.designinfluences.com/fluid960gs/
 
 What you want to accomplish is (almost) doable, except for the static part.
 If you resize the browser, the static area (left section menu) will
 not fluid nicely like the other area. If we can forget about
 static area, and just let Fluid 960 Grid System do the magic, we can
 resize the browser and yet still have a proportional display for each
 area.  Please try using the above link and resize your browser, you
 will see that the [Section Menu] will fluid nicely alongside the
 other.
 
 As a web framework, web2py developer will deals with lots of form
 elements, and I think that Fluid 960 Grid System [1] will be a good
 alternative to beautify web2py layout, because it contains almost all
 form elements in a very nice design.
 From the basic tutorial [2], I believe everybody here can master the
 grid system in no more than 5 minutes :)
 
 [2] http://divitodesign.com/css/960-css-framework-learn-basics/
 
 Using Fluid 960 Grid System, what you want to do can be accomplished
 like below:
 
 html
div class=container_16
  div class=grid_16web2py brand, 16 grids = 16 * 60 px/div
  div class=clear/div
  div class=grid_4
Left Menu, 4 grids = 4 * 60 px
  /div
  div class=grid_6
Column 1, 6 grids = 6 * 60 px
  /div
  div class=grid_6
Column 2, 6 grids = 6 * 60 px
  /div
  div class=clear/div
  div class=grid_16web2py footer, 16 grids = 16 * 60 px/div
  div class=clear/div
/div
 /html
 
 Please check.
 
 Side note:
 Some interesting statistic about css framework on delicious:
 -
 No. Title Bookmark Count
 -
  1. 960 Grid System: 17,962
  2. Blueprint CSS Framework: 8,690
  3. Yahoo! UI Library: Grids CSS: 4,651
  4. Fluid 960 Grid System: 3,219 -- based on 960 Grid System (1)
  4. BlutTrip: 1,394
  5. oocss: 1,265
  6. the-golden-grid: 1,259
  7. SenCSs: 604
  8. ez-css: 445
 
 
 
 
 Abd Shomad
 
 2010/3/19 mdipierro mdipie...@cs.depaul.edu:
 I played with ez-css (which I like) but yet it reminded why I used
 tables. Here is my problem and I am sure it is just me being dumb. Say
 I want a header, a footer and two columns in between. I want the left
 column of fixed with (a menu, 200px) and a right column to foll the
 rest of the space (content). Because of the way it works (and most of
 these frameworks work the same way), the columns float to right
 therefore I must specifycontent before the menu. Hence I cannot find a
 way to 

Re: [web2py] Re: web2py beautification

2010-03-19 Thread Jonathan Lundell
On Mar 19, 2010, at 8:46 AM, Thadeus Burgess wrote:

 Its really not hard, and the box model is not that bad, its just
 confusing and most don't know how to use it properly.

That's not a good sign.

 
 http://www.stubbornella.org/content/2009/02/12/css-doesn%E2%80%99t-suck-you%E2%80%99re-just-doing-it-wrong/
 
 Here are perfect examples of the box model working correctly.
 
 http://matthewjamestaylor.com/blog/perfect-3-column.htm
 http://www.alistapart.com/articles/holygrail

I agree that MJT's example is especially nice. But it also makes my point. His 
simple 3-column layout has 160 lines of CSS, not all of them for layout, but 
the lion's share. And that doesn't count the html that makes it go.

Compare that to the same thing with a table.

And I'm not arguing for tables, particularly, just that CSS should have made 
our job easier, not harder.

Example: I should be able to say, for that kind of layout:

Give me a box for the page.

Nest three boxes inside it, on top of each other, each the full width of the 
enclosing box.

In the middle of those boxes, nest three more, but left to right.

Let me give each box a name.

Let me constrain each box's horizontal and vertical extent based on any 
combination of content, container, percentages and pixels that isn't 
self-contradictory. Let the model understand the word center in both 
dimensions.

(Now, if on top of that model I want to define more boxes that float around, 
etc, fine, no objection. But it needn't be part of my base layout.)

And now let me, separate from that description, pour my content into named 
boxes.

When I first heard of CSS, way back whenever, that's kind of what I imagined 
it'd be like, from the early glowing descriptions. Boy, was I surprised.

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



Re: [web2py] Re: web2py beautification

2010-03-19 Thread Jonathan Lundell
On Mar 19, 2010, at 11:18 AM, Thadeus Burgess wrote:

 Maybe the next version of CSS... but as long as IE is around, growth
 of web standards will always be stunted.

Not CSS3, anyway. 

I'm doubtful anyway, since CSS is so heavily embedded in browsers. I think 
we're stuck with the basic model.

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



[web2py] usern...@localhost

2010-03-19 Thread Jonathan Lundell
I think IS_EMAIL should permit @localhost. Anybody disagree?

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



Re: [web2py] Re: usern...@localhost

2010-03-19 Thread Jonathan Lundell
On Mar 19, 2010, at 4:30 PM, Yarko Tymciurak wrote:

 On Mar 19, 6:02 pm, Jonathan Lundell jlund...@pobox.com wrote:
 I think IS_EMAIL should permit @localhost. Anybody disagree?
 
 I can see your motivation (development), but do you need that?
 Would you also allow u...@127.0.0.1?   or u...@69.45.126.113 (I have
 no idea what that is)?

It's a Level3 address.

 
 At first blush, it feels like you're opening a can of worms...

It's a fairly common convention for delivering mail to users on the local 
machine; you'll see eg 'r...@localhost' and the like. sendmail knows that it's 
for local delivery. (.localhost is also a legal tld, but that's another story.)

IP addresses generally, no.

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



Re: [web2py] Re: benchmarking: rocket vs pound with four rockets

2010-03-20 Thread Jonathan Lundell
On Mar 20, 2010, at 9:58 AM, Timothy Farrell wrote:

 Vasile Ermicioi, put in a vote for Rocket to be included in web2py because 
 I'm in the web2py community and there is still plenty of room for Rocket to 
 be optimized (which I noted).

I like the idea of built-in servers as plugins (not formally, but the general 
idea of supporting more than one in a simply configured way). The downside is 
that we won't have as focused testing of any one server, but it's compensated 
for by how much easier it would be to include a new server in the release 
without running the risk of breaking existing installations.

As I've said, I don't think that ultimate performance need be a high priority 
for the built-in server; rather, ease of use and rock-solid stability are the 
priorities. And I think I like relying on the SSL package.

My inclination: enable easy server switching. Keep CherryPy the default for at 
least one more release, but make Rocket and sneaky easy to ask for from at 
startup. That'll give those of us who are interested easy access to Rocket in a 
low-risk way. And then at some point, possibly very soon, switch the default to 
Rocket, retaining an easy option for the others as a fallback.

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



Re: [web2py] Re: benchmarking: rocket vs pound with four rockets

2010-03-22 Thread Jonathan Lundell
On Mar 22, 2010, at 5:55 AM, Timothy Farrell wrote:

 web2py could support both but the benefits get lost quickly.  web2py is 
 designed to be simple, asking the user to pick which bundled web server they 
 would like to use is too much in my opinion.

No need to ask; there'd be a silent default.

I'm thinking mainly of an overlapped transition.

 
 Short or Tall?
 Caf or Decaf?
 Sugar?
 Milk? (steamed?)
 Cinnamon?
 For here or To-go?
 
 How would you like your web2py today?
 
 
 On 3/20/2010 12:39 PM, Jonathan Lundell wrote:
 On Mar 20, 2010, at 9:58 AM, Timothy Farrell wrote:
 
   
 Vasile Ermicioi, put in a vote for Rocket to be included in web2py because 
 I'm in the web2py community and there is still plenty of room for Rocket to 
 be optimized (which I noted).
 
 I like the idea of built-in servers as plugins (not formally, but the 
 general idea of supporting more than one in a simply configured way). The 
 downside is that we won't have as focused testing of any one server, but 
 it's compensated for by how much easier it would be to include a new server 
 in the release without running the risk of breaking existing installations.
 
 As I've said, I don't think that ultimate performance need be a high 
 priority for the built-in server; rather, ease of use and rock-solid 
 stability are the priorities. And I think I like relying on the SSL package.
 
 My inclination: enable easy server switching. Keep CherryPy the default for 
 at least one more release, but make Rocket and sneaky easy to ask for from 
 at startup. That'll give those of us who are interested easy access to 
 Rocket in a low-risk way. And then at some point, possibly very soon, switch 
 the default to Rocket, retaining an easy option for the others as a fallback.
 
   
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: removing admin vs cron

2010-03-22 Thread Jonathan Lundell
On Mar 18, 2010, at 3:40 PM, mdipierro wrote:

 It is a bug.

What's the fix?

 
 Massimo
 
 On Mar 18, 3:07 pm, Jonathan Lundell jlund...@pobox.com wrote:
 When I completely remove admin, cron crashes:
 
  File /opt/vtc/vpepmanage/web2py/web2py.py, line 20, in module
gluon.widget.start(cron=True)
  File /opt/vtc/vpepmanage/web2py/gluon/widget.py, line 732, in 
 start
cron = contrib.cron.hardcron()
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 44, 
 in __init__
self.launch()
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 48, 
 in launch
crondance(self.path, 'hard', startup = self.startup)
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 240, 
 in crondance
token = Token(cron_path)
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 88, 
 in __init__
open(self.path,'wb').close()
 IOError: [Errno 2] No such file or directory: 
 '/opt/vtc/vpepmanage/web2py/applications/admin/cron/cron.master'
 
 Is it enough to simply create the empty directories?
 
 At any rate, I don't think that cron should depend on admin (or its 
 directory structure); maybe there should be a cron directory at the web2py 
 root?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: removing admin vs cron

2010-03-22 Thread Jonathan Lundell
On Mar 22, 2010, at 7:39 AM, mdipierro wrote:

 I think this was fixed some time ago. gluon/contrib/cron.py is no
 longer used in web2py 1.76.5.

OK; that system was running 1.76.3. I'll try again.

 
 Massimo
 
 On Mar 22, 9:30 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Mar 18, 2010, at 3:40 PM, mdipierro wrote:
 
 It is a bug.
 
 What's the fix?
 
 
 
 Massimo
 
 On Mar 18, 3:07 pm, Jonathan Lundell jlund...@pobox.com wrote:
 When I completely remove admin, cron crashes:
 
  File /opt/vtc/vpepmanage/web2py/web2py.py, line 20, in module
gluon.widget.start(cron=True)
  File /opt/vtc/vpepmanage/web2py/gluon/widget.py, line 732, in 
 start
cron = contrib.cron.hardcron()
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 44, 
 in __init__
self.launch()
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 48, 
 in launch
crondance(self.path, 'hard', startup = self.startup)
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 
 240, in crondance
token = Token(cron_path)
  File /opt/vtc/vpepmanage/web2py/gluon/contrib/cron.py, line 88, 
 in __init__
open(self.path,'wb').close()
 IOError: [Errno 2] No such file or directory: 
 '/opt/vtc/vpepmanage/web2py/applications/admin/cron/cron.master'
 
 Is it enough to simply create the empty directories?
 
 At any rate, I don't think that cron should depend on admin (or its 
 directory structure); maybe there should be a cron directory at the web2py 
 root?
 



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



[web2py] proposal: change SQLFORM delete checkbox handling

2010-03-22 Thread Jonathan Lundell
At the moment, there's a delete-confirmation checkbox that's turned on when an 
SQLFORM is 'deletable'. It's a simple checkbox with class='delete', along with 
this bit of code in web2py_ajax.html:

  
jQuery(input[type='checkbox'].delete).each(function(){jQuery(this).click(function()
 { if(this.checked) if(!confirm({{=T('Sure you want to delete this 
object?')}})) this.checked=false; });});

It presents the user with a dialog, and if the use doesn't OK the dialog, the 
box isn't checked and no delete occurs on submit.

This logic serves at least two purposes. One, it's a workaround for the problem 
that having multiple submit buttons is problematical with IE. Two, it forces 
the user to take three actions to delete a record: check the box, confirm the 
deletion, and click submit.

I have to alternative suggestions.

One is to move the above jQuery logic into a simple 'onclick' attached to the 
checkbox by SQLFORM. This gets rid of the jQuery requirement (with no loss of 
functionality), but more important it allows us to have an option to 
SQLFORM.__init__() to override the text associated with the confirmation. 'Sure 
you want to delete this object?' is somewhat idiosyncratic English to begin 
with, but the main problem is that usually we'd like to be more specific than 
this object. Depending on the record, we might say this item or this item 
in your cart or this user or any number of things. 

I see no downside to this. It's compatible, and the default action is identical 
to the current mechanism.


Alternative: change the delete checkbox to a 'button' element labeled 'Delete'. 
Use onclick to attach a confirmation dialog to the button. If the user 
confirms, do a submit of the form, but set a hidden variable in the form to 
communicate the delete action to accepts. This avoids the IE problem (there's 
only one submit button).

Downsides: the UI changes a checkbox to a Delete button, and JavaScript is 
required to do a delete at all.

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



[web2py] proposal: admin-less ticket support

2010-03-22 Thread Jonathan Lundell
If I get rid of the admin application, there's no UI for tickets. They're 
available in the file system, but that's it.

It's not too hard to access tickets through an application, but it requires a 
little reverse engineering of admin's logic.

My proposal is to provide a couple of helper routines to make it easier to 
build a ticket-access page. The helpers would:

1. retrieve a list of ticket names

2. display a ticket (as now, but without the edit links)

3. delete a ticket

4. delete all tickets

5. download a gzip of all the tickets

This would decouple the application from the ticket implementation, and allow 
full ticket access without admin. An application would ordinarily restrict the 
ticket-access functionality to a sysadmin role.

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



Re: [web2py] Re: Survey: Functionality of the Drop Boxes widget

2010-03-22 Thread Jonathan Lundell
On Mar 22, 2010, at 10:16 PM, Thadeus Burgess wrote:

 Just an update:
 
 The current functionality is set at zero= for web2py. This survey
 will only serve as a consulting referendum, it does not mean that the
 end result will be the same.
 
 Current Number of responses: 5 (we really need more! everyone who uses
 web2py can take apart of this!)

(I think you meant: a lot.)

I didn't answer because my answer wasn't an option: I don't care what the 
default is because I always specify zero=.

 
 -Thadeus
 
 
 
 
 
 On Sun, Mar 21, 2010 at 10:06 PM, Thadeus Burgess thade...@thadeusb.com 
 wrote:
 There is current on-going discussion of the default functionality of
 the drop boxes widget. This is an attempt to gather information from
 the community on this discussion. The results of this survey will
 determine what this default functionality will be.
 
 Here is the comparison of the two options currently being considered.
 
 zero=
 
 This is when a drop box is rendered, there is an empty OPTION tag
 rendered in the first that is selected.
 
 zero=None
 
 This is when only the options in the list are rendered. The first
 option in the list is selected.
 
 https://spreadsheets.google.com/viewform?formkey=dE9jS1VHSWdyd08xX2x6NU0yaEs1cnc6MA
 
 Thank You,
 
 -Thadeus
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] href not being rendered

2010-03-23 Thread Jonathan Lundell
On Mar 23, 2010, at 1:32 AM, annet wrote:

 In a send_mail.html view I have a link which reads like:
 
 pHaving trouble viewing this email? a
 href={{=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijf])}}
 target=_blankView it in your browser/a/p
 
 When I send the mail and open it this link reads like:
 
 pHaving trouble viewing this email? aView it in your browser/a/
 p
 
 Does one of you know why the href isn't being rendered?

It needs to be _href= (and _target=).

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



Re: [web2py] Re: proposal: admin-less ticket support

2010-03-23 Thread Jonathan Lundell
On Mar 23, 2010, at 6:00 AM, selecta wrote:

 I wrote an issue tracker plugin that can do some of the things (except
 for deleting all tickets and downloading)
 also tickets are displayed a little different, sorted by number of
 error appearance and stacktrace only
 if you are interested I could post the plugin, it has still some
 issues but you could improve them
 my idea was to attach error tickets to issues to improve the
 development of an application

I'd like to take a look. Issue tracking is a good idea, too.

To clarify, though, I have a working solution. It wasn't that hard to do, 
following the example of admin, but I think it would be easier (and more 
portable) going forward if parts of it were pushed into gluon.restricted in the 
form of helpers.

My motivation is that the application will not be deployed on the public web, 
but rather at customer sites, where for security reasons there will be no admin 
application, and likely no external access to the server. So I need a way for a 
local sysadmin to collect tickets to send back to the mother ship.

 
 
 On Mar 23, 6:07 am, Jonathan Lundell jlund...@pobox.com wrote:
 If I get rid of the admin application, there's no UI for tickets. They're 
 available in the file system, but that's it.
 
 It's not too hard to access tickets through an application, but it requires 
 a little reverse engineering of admin's logic.
 
 My proposal is to provide a couple of helper routines to make it easier to 
 build a ticket-access page. The helpers would:
 
 1. retrieve a list of ticket names
 
 2. display a ticket (as now, but without the edit links)
 
 3. delete a ticket
 
 4. delete all tickets
 
 5. download a gzip of all the tickets
 
 This would decouple the application from the ticket implementation, and 
 allow full ticket access without admin. An application would ordinarily 
 restrict the ticket-access functionality to a sysadmin role.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: href not being rendered

2010-03-23 Thread Jonathan Lundell
On Mar 23, 2010, at 7:40 AM, mdipierro wrote:

 I do not think this is the problem. He does not seem to be using the
 A(...) helper.

Good point; my confusion.

OK, then, how about this. If the link reads like text is literally true (that 
is, we're looking at the display text, not the source text), then it's being 
encoded.

 
 On Mar 23, 9:16 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Mar 23, 2010, at 1:32 AM, annet wrote:
 
 In a send_mail.html view I have a link which reads like:
 
 pHaving trouble viewing this email? a
 href={{=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijf])}}
 target=_blankView it in your browser/a/p
 
 When I send the mail and open it this link reads like:
 
 pHaving trouble viewing this email? aView it in your browser/a/
 p
 
 Does one of you know why the href isn't being rendered?
 
 It needs to be _href= (and _target=).


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



[web2py] using syslog from a web2py app

2010-03-23 Thread Jonathan Lundell
I'd like to use syslog http://docs.python.org/library/syslog.html from my 
app. However, it's a .so on my system, so I can't see what it is and how it 
works, exactly.

So my question is: If I open syslog and use it, and don't close it, will it get 
closed when my controller exits and the object is (presumably) destroyed?

A related question: is there a hook by which I can guarantee to get called at 
the end of a controller transaction? Or does that even make sense?

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



[web2py] mixing widgets and validators

2010-03-24 Thread Jonathan Lundell
I find myself a little confused on this issue.

How do I get a Field to display as a text field, but validate like IS_IN_SET? 
(I've got a set that's too big for a drop-down.)

And how does IS_IN_SET cause a field to become a drop-down box? By virtue of 
having an options method?

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



Re: [web2py] Re: Cleanup sessions

2010-03-27 Thread Jonathan Lundell
On Mar 27, 2010, at 9:15 PM, mdipierro wrote:

 If you install a new web2py app and, before you start web2py, you run
 your line below, then start web2py, welcome.w2p will package your cron
 task. All apps created after that will have it.

Though the way it's written, it depends on keeping applications/admin 
installed. It's not hard to edit for another app, but I wonder if the crontab 
line can be written in a non-appname-dependent way.

 
 Massimo
 
 On 27 Mar, 23:12, Iceberg iceb...@21cn.com wrote:
 On Mar27, 5:27pm, annet annet.verm...@gmail.com wrote:
 
 I have just moved my application from the development environment to a
 production environment. I read the web2py manual and some posts in the
 group on the subject of cleaning up sessions, but I am not sure which
 is the best way to proceed. I am running version 1.76.5 of web2py.
 
 Kind regards,
 
 Annet
 
 My approach is to use admin's expire_sessions.py feature, by this way:
 
 $ cp web2py/applications/admin/cron/crontab web2py/applications/myapp/
 cron
 
 By the way, I feel boring that I have to do this every time I create a
 new app, yet sometimes I forgot that. Don't know whether Massimo will
 think about adding that line by default when creating every new app.
 
 Sincerely,
 Iceberg
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: googling web2py

2010-03-28 Thread Jonathan Lundell
On Mar 28, 2010, at 10:51 AM, mdipierro wrote:

 It seems to be a two state system (~100K vs ~600K). I wonder what
 triggers one state vs the other. I do not see a pattern.

From the US, a search for web2py gives me 712,000 results, while +web2py or 
web2py gives 109,000.

Unfortunately, Google won't deliver more than the first 1,000 results, and I 
don't know now to figure out the difference between the two result sets.

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



Re: [web2py] Re: googling web2py

2010-03-28 Thread Jonathan Lundell
On Mar 28, 2010, at 11:28 AM, Jonathan Lundell wrote:

 On Mar 28, 2010, at 10:51 AM, mdipierro wrote:
 
 It seems to be a two state system (~100K vs ~600K). I wonder what
 triggers one state vs the other. I do not see a pattern.
 
 From the US, a search for web2py gives me 712,000 results, while +web2py or 
 web2py gives 109,000.
 
 Unfortunately, Google won't deliver more than the first 1,000 results, and I 
 don't know now to figure out the difference between the two result sets.

Speaking of Google  web2py:

http://www.google.com/search?q=web2pyhl=enlr=safe=offsa=Xtbo=1tbs=ww:1ei=6qWvS-DrDpCStgPejsH-Cwoi=toolresnum=2ct=tlinkved=0CC8QpwU

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



Re: [web2py] Re: googling web2py

2010-03-28 Thread Jonathan Lundell
On Mar 28, 2010, at 11:28 AM, Jonathan Lundell wrote:

 On Mar 28, 2010, at 10:51 AM, mdipierro wrote:
 
 It seems to be a two state system (~100K vs ~600K). I wonder what
 triggers one state vs the other. I do not see a pattern.
 
 From the US, a search for web2py gives me 712,000 results, while +web2py or 
 web2py gives 109,000.
 
 Unfortunately, Google won't deliver more than the first 1,000 results, and I 
 don't know now to figure out the difference between the two result sets.

Also, searching for any of those variations with SafeSearch on gives me 106,000 
hits. So those of you getting low counts might want to check that.

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



Re: [web2py] Re: where is this coming from?

2010-04-01 Thread Jonathan Lundell
On Apr 1, 2010, at 6:18 AM, mdipierro wrote:

 applications/admin/cron/crontab

The message itself, I mean. It's showing up on my console, and I can't find the 
source.

 
 On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote:
 Wed Mar 31 16:10:00 2010 hard CRON RUNNING 
 ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python',
  'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 
 'applications/admin/cron/expire_sessions.py']


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



[web2py] editarea plugin lacks OS X Intel support

2010-04-01 Thread Jonathan Lundell
...or so I gather from my console log:

3/31/10 10:42:41 PM mdworker[18101] (Warning) Import: 
/.../web2py/applications/admin/static/edit_area/edit_area_full_with_plugins.gz 
could not be imported; Only a PPC importer plug-in was found.

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



Re: [web2py] Re: where is this coming from?

2010-04-01 Thread Jonathan Lundell
On Apr 1, 2010, at 8:49 AM, Yarko Tymciurak wrote:

 my quick guess would be start at line 45, winservice.py --  it has
 ReportServiceStatus

This is OS X, so not winservice. Presumably.

I was running 1.76.3 inadvertently; I'll see what happens with .5.

 
 Actually - as I look at it, I'll bet it's coming from the call
 Service::log(), which calls which calls servicemanager.LogInfoMsg()
 
 Try setting a breakpoint there, and see if this stuff shows up in the
 msg param or log()
 
 Cheers,
 - Yarko
 
 On Apr 1, 9:39 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 6:18 AM, mdipierro wrote:
 
 applications/admin/cron/crontab
 
 The message itself, I mean. It's showing up on my console, and I can't find 
 the source.
 
 
 
 On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote:
 Wed Mar 31 16:10:00 2010 hard CRON RUNNING 
 ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python',
  'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 
 'applications/admin/cron/expire_sessions.py']
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



[web2py] web2py book and softcron

2010-04-01 Thread Jonathan Lundell
Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how to 
override them.

Section 4.1 (cli) doesn't list --softcron

The startup message for soft cron says: 'Using softcron (but this is not very 
efficient)'

In what sense not efficient? I understand that the timing is less consistent, 
but is there really more overhead? softcron seems like a pretty reasonable 
choice if all you're doing it deleting expired sessions.


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



Re: [web2py] Re: web2py book and softcron

2010-04-01 Thread Jonathan Lundell
On Apr 1, 2010, at 10:37 AM, AchipA wrote:

 There is some overhead, but efficiency is a disputable term - there is
 certainly more overhead than hardcron, but IMO not in a way that would
 affect overall performance unless you're running it on a site that has
 hundreds of thousands of hits per day...

Perhaps we could change (or eliminate) the wording. How about simply 'Using 
softcron'? 

I'm curious: what is the extra overhead of soft vs hard cron? Just that it does 
a test on each page access? I'm guessing that's pretty cheap.

 
 On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote:
 Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how 
 to override them.
 
 Section 4.1 (cli) doesn't list --softcron
 
 The startup message for soft cron says: 'Using softcron (but this is not 
 very efficient)'
 
 In what sense not efficient? I understand that the timing is less 
 consistent, but is there really more overhead? softcron seems like a pretty 
 reasonable choice if all you're doing it deleting expired sessions.


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



Re: [web2py] Re: web2py book and softcron

2010-04-01 Thread Jonathan Lundell
On Apr 1, 2010, at 11:20 AM, AchipA wrote:

 Exactly, hardcron checks once a minute, softcron checks on each page
 load. The 'check' is calling a function or two and comparing a file's
 timestamp, so not *that* much more expensive.

Thanks.

In that case, I have a suggestion, perhaps not entirely thought out. If cron is 
being used only for something relatively simple, say expire_sessions.py, how 
about a kind of 'cron lite' that runs its tasks in the context of an 
application rather than spawning an entirely new instance of python+web2py to 
do the work?

At the point where softcron is invoked, at the end of a request, if we're 
running in litecron mode, process only the crontab file for the current app, 
and run the cron tasks more or less as if they were models (that is, exec in 
environment).


 
 On Apr 1, 7:51 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 10:37 AM, AchipA wrote:
 
 There is some overhead, but efficiency is a disputable term - there is
 certainly more overhead than hardcron, but IMO not in a way that would
 affect overall performance unless you're running it on a site that has
 hundreds of thousands of hits per day...
 
 Perhaps we could change (or eliminate) the wording. How about simply 'Using 
 softcron'?
 
 I'm curious: what is the extra overhead of soft vs hard cron? Just that it 
 does a test on each page access? I'm guessing that's pretty cheap.
 
 
 
 On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote:
 Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say 
 how to override them.
 
 Section 4.1 (cli) doesn't list --softcron
 
 The startup message for soft cron says: 'Using softcron (but this is not 
 very efficient)'
 
 In what sense not efficient? I understand that the timing is less 
 consistent, but is there really more overhead? softcron seems like a 
 pretty reasonable choice if all you're doing it deleting expired sessions.



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



Re: [web2py] Re: web2py book and softcron

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 12:25 PM, AchipA wrote:

 There was talk about this a few months back, and I even have a dev
 branch that does exactly this. There *are* some concerns, that's why I
 have not yet submitted that to Massimo until I resolve GIL/locking/etc
 issues.

It also occurs to me that I can accomplish the same thing (though not through 
crontab) by expiring sessions through a model file. Touch an empty file in 
sessions/ to use as a timestamp, and when its mtime is more than an hour old, 
run the expiry logic.

BTW, does cron run if there's no crontab? 

 
 On Apr 2, 12:07 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 11:20 AM, AchipA wrote:
 
 Exactly, hardcron checks once a minute, softcron checks on each page
 load. The 'check' is calling a function or two and comparing a file's
 timestamp, so not *that* much more expensive.
 
 Thanks.
 
 In that case, I have a suggestion, perhaps not entirely thought out. If cron 
 is being used only for something relatively simple, say expire_sessions.py, 
 how about a kind of 'cron lite' that runs its tasks in the context of an 
 application rather than spawning an entirely new instance of python+web2py 
 to do the work?
 
 At the point where softcron is invoked, at the end of a request, if we're 
 running in litecron mode, process only the crontab file for the current app, 
 and run the cron tasks more or less as if they were models (that is, exec in 
 environment).
 
 
 
 On Apr 1, 7:51 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 10:37 AM, AchipA wrote:
 
 There is some overhead, but efficiency is a disputable term - there is
 certainly more overhead than hardcron, but IMO not in a way that would
 affect overall performance unless you're running it on a site that has
 hundreds of thousands of hits per day...
 
 Perhaps we could change (or eliminate) the wording. How about simply 
 'Using softcron'?
 
 I'm curious: what is the extra overhead of soft vs hard cron? Just that it 
 does a test on each page access? I'm guessing that's pretty cheap.
 
 On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote:
 Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say 
 how to override them.
 
 Section 4.1 (cli) doesn't list --softcron
 
 The startup message for soft cron says: 'Using softcron (but this is not 
 very efficient)'
 
 In what sense not efficient? I understand that the timing is less 
 consistent, but is there really more overhead? softcron seems like a 
 pretty reasonable choice if all you're doing it deleting expired 
 sessions.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: Field validation interaction

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 5:14 PM, mdipierro wrote:

 db.table.field1.requires=IS_NULL_OR(IS_IPV4())
 db.table.field2.requires=IS_NULL_OR(IS_IPV4()) if request.vars.field1
 else IS_IPV4()

Ah, that's the one I remember. Now I have to decide between this approach and 
Yarko's. 

Nice to have two

 
 On Apr 2, 10:32 am, Jonathan Lundell jlund...@pobox.com wrote:
 I think I've seen an answer to this one, but I can't find it.
 
 I've got a form with two Field's, both IS_IPV4(). The validation I'm after 
 is that one or both must be present; the only invalid case is both of them 
 null.
 
 How do I write that?


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



Re: [web2py] Re: where is this coming from?

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 5:33 PM, mdipierro wrote:

 h. I think it may be this line in newcron.py
 
logging.info('WEB2PY CRON (%s): %s executing %s in %s at
 %s' \
 % (ctype, app, task.get('cmd'),
os.getcwd(), datetime.datetime.now()))
 
 
 should it be .warn instead of .info?

Maybe, but I think my message must have been from the old cron, because it 
didn't say WEB2PY.

I'm going to abandon cron and do my session expirations from a model.


 
 On Apr 1, 11:06 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 8:49 AM, Yarko Tymciurak wrote:
 
 my quick guess would be start at line 45, winservice.py --  it has
 ReportServiceStatus
 
 This is OS X, so not winservice. Presumably.
 
 I was running 1.76.3 inadvertently; I'll see what happens with .5.
 
 
 
 Actually - as I look at it, I'll bet it's coming from the call
 Service::log(), which calls which calls servicemanager.LogInfoMsg()
 
 Try setting a breakpoint there, and see if this stuff shows up in the
 msg param or log()
 
 Cheers,
 - Yarko
 
 On Apr 1, 9:39 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 6:18 AM, mdipierro wrote:
 
 applications/admin/cron/crontab
 
 The message itself, I mean. It's showing up on my console, and I can't 
 find the source.
 
 On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote:
 Wed Mar 31 16:10:00 2010 hard CRON RUNNING 
 ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python',
  'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 
 'applications/admin/cron/expire_sessions.py']
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: web2py book and softcron

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 5:18 PM, mdipierro wrote:

 the process that checks for the crontab runs but it does not spawns
 additional processes if nothing to do.

Understood. But when it has something to do, if it's lightweight (like expiring 
sessions), why run another process ever?

I'm only talking about trivial tasks, but if you don't need cron functionality 
for anything but trivial tasks

 
 On Apr 2, 4:14 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 2, 2010, at 12:25 PM, AchipA wrote:
 
 There was talk about this a few months back, and I even have a dev
 branch that does exactly this. There *are* some concerns, that's why I
 have not yet submitted that to Massimo until I resolve GIL/locking/etc
 issues.
 
 It also occurs to me that I can accomplish the same thing (though not 
 through crontab) by expiring sessions through a model file. Touch an empty 
 file in sessions/ to use as a timestamp, and when its mtime is more than an 
 hour old, run the expiry logic.
 
 BTW, does cron run if there's no crontab?
 
 
 
 On Apr 2, 12:07 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 11:20 AM, AchipA wrote:
 
 Exactly, hardcron checks once a minute, softcron checks on each page
 load. The 'check' is calling a function or two and comparing a file's
 timestamp, so not *that* much more expensive.
 
 Thanks.
 
 In that case, I have a suggestion, perhaps not entirely thought out. If 
 cron is being used only for something relatively simple, say 
 expire_sessions.py, how about a kind of 'cron lite' that runs its tasks in 
 the context of an application rather than spawning an entirely new 
 instance of python+web2py to do the work?
 
 At the point where softcron is invoked, at the end of a request, if we're 
 running in litecron mode, process only the crontab file for the current 
 app, and run the cron tasks more or less as if they were models (that is, 
 exec in environment).
 
 On Apr 1, 7:51 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 1, 2010, at 10:37 AM, AchipA wrote:
 
 There is some overhead, but efficiency is a disputable term - there is
 certainly more overhead than hardcron, but IMO not in a way that would
 affect overall performance unless you're running it on a site that has
 hundreds of thousands of hits per day...
 
 Perhaps we could change (or eliminate) the wording. How about simply 
 'Using softcron'?
 
 I'm curious: what is the extra overhead of soft vs hard cron? Just that 
 it does a test on each page access? I'm guessing that's pretty cheap.
 
 On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote:
 Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't 
 say how to override them.
 
 Section 4.1 (cli) doesn't list --softcron
 
 The startup message for soft cron says: 'Using softcron (but this is 
 not very efficient)'
 
 In what sense not efficient? I understand that the timing is less 
 consistent, but is there really more overhead? softcron seems like a 
 pretty reasonable choice if all you're doing it deleting expired 
 sessions.


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



Re: [web2py] Re: Field validation interaction

2010-04-02 Thread Jonathan Lundell
On Apr 2, 2010, at 8:05 PM, mdipierro wrote:

 Yes. No one solution is obviously better. It is good to have some
 options.

Yarko's approach allows for a more general error message, at the expense of not 
associating it with a particular input field. In my case, I think I see a way 
of phrasing the error messages so that it works OK with Massimo's approach. 

 
 Massimo
 
 On Apr 2, 8:45 pm, Yarko Tymciurak resultsinsoftw...@gmail.com
 wrote:
 On Apr 2, 7:14 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
 db.table.field1.requires=IS_NULL_OR(IS_IPV4())
 db.table.field2.requires=IS_NULL_OR(IS_IPV4()) if request.vars.field1
 else IS_IPV4()
 
 Thank you for this, Massimo - this is a nice, compact idiom for using
 existing validators; I hadn't considered (don't know why not - it's
 obvious looking at it) this idiom in assigning to a requires field.
 
 My approach is more general - ANY situation where you want to do some
 combinatorial logic, or external checking: form.accepts( ...,
 dbio=False)...
 
 Good question, Jonathan! :-)
 
 - Yarko
 
 
 
 On Apr 2, 10:32 am, Jonathan Lundell jlund...@pobox.com wrote:
 
 I think I've seen an answer to this one, but I can't find it.
 
 I've got a form with two Field's, both IS_IPV4(). The validation I'm after 
 is that one or both must be present; the only invalid case is both of them 
 null.
 
 How do I write that?


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



Re: [web2py] Re: args problem in 1.76.5

2010-04-04 Thread Jonathan Lundell
On Apr 4, 2010, at 4:37 PM, DenesL wrote:

 It should be noted that there was some work done towards enabling an
 alternate setting that would allow the developer access to the
 unchanged (raw) args but it has not been finished yet.
 
 This would allow any character set in args which I believe mainly
 concerns non-English speaking developers/users.
 
 If any of you feel, as I do, that this is important please voice your
 concern.

The raw args feature is available in the current release. Specify it for a 
particular app in routes.py, and request.raw_args will have the unprocessed 
args. %20 will be converted to space.

URL rewriting is still somewhat broken, especially when a ? is involved. I've 
got a plan to address that too, but I haven't had a lot of time to put in on it.

 
 Denes.
 
 On Apr 4, 12:01 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 The problem is that web2py does not like spaces '%20' in url and
 replaces them with underscore.
 
 On Apr 4, 7:20 am, annet annet.verm...@gmail.com wrote:
 
 After upgrading to web2py version 1.76.5 one of the functions I
 defined no longer works.
 
 I defined a table newsmonth:
 
 db.define_table('newsmonth',
 
 db.Field('number',type='integer',length=2,default='',notnull=True),
 db.Field('month',length=14,default='',notnull=True,unique=True),
 db.Field('publish',type='boolean'),
 migrate=False)
 
 ... which I use to display archived news items per month. Number is
 the number of the month e.g April 4. Month is a string, for April it
 reads like: April 2010. Publish defaults to false and is set to true
 on the 1st of the next month.
 
 In the view I have a list with links:
 
 March 2010
 february 2010
 january 2010
 
 When the visitor clicks March 2010, the news table is queried:
 
 def archive():
 
 months=db(db.newsmonth.publish==True).select(db.newsmonth.ALL,orderby=~db.newsmonth.id)
 news=[]
 month=[]
 if request.args:
 news=db(db.news.publishing_date.month()==request.args[0])\
 .select(db.news.ALL,orderby=~db.news.publishing_date)
 month=request.args[1]
 if not news:
 response.flash='Select an archived month'
 else:
 response.flash='Select an archived month'
 return dict(months=months,news=news,month=month)
 
 month is set to request.args[1], i.e March 2010, and returned to the
 view:
 
 div id=twoColLayout
   div id=primarycontent
 
   div id=month
 h3Nieuws {{=month.replace('_',' ')}}/h3
 table
   thead
 tr
   td/td
 /tr
   /thead
   tbody
 {{for item in news:}}
   tr
 td
 
 h5{{=db.news.publishing_date.formatter(item.publishing_date)}}/h5
 /td
 td
 
 {{=A(item.title,_onmouseover=this.style.cursor='pointer';,\
 
 _onclick=javascript:newsdetails('%s')%URL(r=request,f='details',args=[item.id]))}}
 /td
   /tr
 {{pass}}
   /tbody
 /table
   /div !-- month --
   /div !-- primarycontent --
   div id=sidecontent
 div class=sidebox
   h3Archived months:/h3
   table
 tbody
   {{for month in months:}}
 tr
   td
 
 {{=A(month.month,_href=URL(r=request,args=[month.number,month.month]))}}
   /td
 /tr
   {{pass}}
 /tbody
   /table
 /div !-- sidebox --
   /div !-- sidecontent --
 /div !-- twoColLayout --
 
 When I expose the archive function, the view displays well. The URL
 reads like:http://127.0.0.1:8000/init/news/archive
 
 However, when I click one of the archived months links I get an
 invalid request error.
 
 The link in the view reads like: a href=init/news/archive/3/March
 %202010March 2010/a
 
 ... the URL in the browser reads 
 like:http://127.0.0.1:8000/init/news/archive/3/March%202010
 
 Since the function works without args, I suppose the error has
 something to do with the args, the porblem is I can't figure out what.
 
 Kind regards,
 
 Annet.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: args problem in 1.76.5

2010-04-05 Thread Jonathan Lundell
On Apr 5, 2010, at 3:15 AM, DenesL wrote:

 
 Thank you Jonathan and sorry that I have not been able to contribute
 more.
 Until we find a way to fix the missing part it is not really usable.
 
 At the risk of repeating myself, this is not only about blanks being
 converted to underscores which is not the only sanitizing of args done
 by web2py, this will allow any character to be processed, for example
 characters with different types of accents so common in Dutch,
 French, Spanish, and many other languages.
 For those interested it should be stressed that by turning on this
 feature the developer has to take responsibility of sanitizing the
 args.

The basic problem here (or at least one of the basic problems) is the way the 
routes.py logic handles '?' in separating vars from the rest of the URL, and 
then reassembling the URL after processing. It's definitely broken for anything 
that encodes a question mark in args.

All I was saying above is that the new logic solves a subset of problems, 
including spaces in args. It's definitely not a complete solution.

 
 
 On Apr 4, 6:55 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 4, 2010, at 4:37 PM, DenesL wrote:
 
 It should be noted that there was some work done towards enabling an
 alternate setting that would allow the developer access to the
 unchanged (raw) args but it has not been finished yet.
 
 This would allow any character set in args which I believe mainly
 concerns non-English speaking developers/users.
 
 If any of you feel, as I do, that this is important please voice your
 concern.
 
 The raw args feature is available in the current release. Specify it for a 
 particular app in routes.py, and request.raw_args will have the unprocessed 
 args. %20 will be converted to space.
 
 URL rewriting is still somewhat broken, especially when a ? is involved. 
 I've got a plan to address that too, but I haven't had a lot of time to put 
 in on it.
 
 
 
 Denes.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



[web2py] new session

2010-04-05 Thread Jonathan Lundell
I'd have thought that if I log out and then log back in I'd get a new session. 
But apparently not. Is there a reason to do it one way vs the other?

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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 7:14 AM, mdipierro wrote:

 Some people have reported problems with Jython due to a bug in Java
 regex. I tried Jython2.5rc2 and it worked for me. Let us know.

One or two of the regex patches a while back (URL checking IIRC) was aimed at 
preventing excessive backtracking under Jython. If anyone runs into that 
problem again, they should report it. I'm pretty sure I understand how to avoid 
at least the problem we had then, by making alternations mutually exclusive.

 
 On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
 Thanks,
 
 I am sure I searched in the 'book', how silly of me not to find it.
 What about Oracle and Jython ?  The last line of the entrie reads:
'You will be able to use DAL('sqlite://...') and
 DAL('postgres://...')  only.'
 
 John C.
 
 On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
 Hi,
 
 here they are:
 
 http://web2py.com/book/default/section/12/9
 
 + use newest stable
 
 --
 Kuba
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 9:55 AM, JC11 wrote:

 I am getting the dreaded error:
  RuntimeError: maximum recursion depth exceeded
 
 I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
 I have altered the web2py 'welcome' application defaault controller
 to: return 'Hello World' rather than return dict(message=T('Hello
 World')).
 This solved the recursion problem, but only if one does not use web2py
 views :(
 
 I tried adding the following to the default controller, but it did not
 help.
 import sys
 sys.setrecursionlimit(2500)
 
 Any suggestions ?

What's the regex that's causing the problem?

 
 On Apr 7, 4:16 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
 
 Some people have reported problems with Jython due to a bug in Java
 regex. I tried Jython2.5rc2 and it worked for me. Let us know.
 
 One or two of the regex patches a while back (URL checking IIRC) was aimed 
 at preventing excessive backtracking under Jython. If anyone runs into that 
 problem again, they should report it. I'm pretty sure I understand how to 
 avoid at least the problem we had then, by making alternations mutually 
 exclusive.
 
 
 
 On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
 Thanks,
 
 I am sure I searched in the 'book', how silly of me not to find it.
 What about Oracle and Jython ?  The last line of the entrie reads:
'You will be able to use DAL('sqlite://...') and
 DAL('postgres://...')  only.'
 
 John C.
 
 On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
 Hi,
 
 here they are:
 
 http://web2py.com/book/default/section/12/9
 
 + use newest stable
 
 --
 Kuba


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



[web2py] submit record row col3

2010-04-07 Thread Jonathan Lundell
OK, I'm feeling too lazy to look this up, and I'm hoping someone will just tell 
me.

How do I inject text into the col3 TD of the submit_record_row of an SQLFORM?

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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 12:44 PM, John Cobo wrote:

 I have not written any regular expressions. So far I am just trying to run 
 the web2py welcome app.
 
 The only reg. exp. is what creates the welcome page view.
 

No traceback?

 Thanks.
 
 
 On 7 Apr 2010 19:29, Jonathan Lundell jlund...@pobox.com wrote:
 
 On Apr 7, 2010, at 9:55 AM, JC11 wrote:
 
  I am getting the dreaded error:
   RuntimeError: maximum recursion depth exceeded
 
  I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
  I have altered the web2py 'welcome' application defaault controller
  to: return 'Hello World' rather than return dict(message=T('Hello
  World')).
  This solved the recursion problem, but only if one does not use web2py
  views :(
 
  I tried adding the following to the default controller, but it did not
  help.
  import sys
  sys.setrecursionlimit(2500)
 
  Any suggestions ?
 
 What's the regex that's causing the problem?
 
 
  On Apr 7, 4:16 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
 
  Some people have reported problems with Jython due to a bug in Java
  regex. I tried Jython2.5rc2 and it worked for me. Let us know.
 
  One or two of the regex patches a while back (URL checking IIRC) was 
  aimed at preventing excessive backtracking under Jython. If anyone runs 
  into that problem again, they should report it. I'm pretty sure I 
  understand how to avoid at least the problem we had then, by making 
  alternations mutually exclusive.
 
 
 
  On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
  Thanks,
 
  I am sure I searched in the 'book', how silly of me not to find it.
  What about Oracle and Jython ?  The last line of the entrie reads:
 'You will be able to use DAL('sqlite://...') and
  DAL('postgres://...')  only.'
 
  John C.
 
  On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
  Hi,
 
  here they are:
 
  http://web2py.com/book/default/section/12/9
 
  + use newest stable
 
  --
  Kuba
 
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 2:28 PM, Timothy Farrell wrote:

 I've looked at this problem extensively and I'm convinced that the solution 
 is to re-implement template.py without complicated regexps or remove the 
 claim of Jython support.
 
 The exact problem is related to the size of a view that is run through the 
 template module.  The re_strings as it is used in the parse() method is too 
 complicated.  A temporary solution is to comment out that line but templates 
 will not render some Javascript properly.

re_strings looks just plain broken to me. The inner parens should not be 
capturing, there should be non-capturing parens around the alternation, and the 
single-line quote patterns shouldn't have dots in the match.

I think.

I sent a patch for this back in November, and Timothy reported that it worked. 
But it never got applied.

Want to try again?


 
 This is ultimately a bug in Java (not even Jython) but it officially has 
 WONT-FIX status with Sun.
 
 On 4/7/2010 3:34 PM, Jonathan Lundell wrote:
 
 On Apr 7, 2010, at 12:44 PM, John Cobo wrote:
 
 I have not written any regular expressions. So far I am just trying to run 
 the web2py welcome app.
 
 The only reg. exp. is what creates the welcome page view.
 
 
 No traceback?
 
 Thanks.
 
 
 On 7 Apr 2010 19:29, Jonathan Lundell jlund...@pobox.com wrote:
 
 On Apr 7, 2010, at 9:55 AM, JC11 wrote:
 
  I am getting the dreaded error:
   RuntimeError: maximum recursion depth exceeded
 
  I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
  I have altered the web2py 'welcome' application defaault controller
  to: return 'Hello World' rather than return dict(message=T('Hello
  World')).
  This solved the recursion problem, but only if one does not use web2py
  views :(
 
  I tried adding the following to the default controller, but it did not
  help.
  import sys
  sys.setrecursionlimit(2500)
 
  Any suggestions ?
 
 What's the regex that's causing the problem?
 
 
  On Apr 7, 4:16 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
 
  Some people have reported problems with Jython due to a bug in Java
  regex. I tried Jython2.5rc2 and it worked for me. Let us know.
 
  One or two of the regex patches a while back (URL checking IIRC) was 
  aimed at preventing excessive backtracking under Jython. If anyone runs 
  into that problem again, they should report it. I'm pretty sure I 
  understand how to avoid at least the problem we had then, by making 
  alternations mutually exclusive.
 
 
 
  On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
  Thanks,
 
  I am sure I searched in the 'book', how silly of me not to find it.
  What about Oracle and Jython ?  The last line of the entrie reads:
 'You will be able to use DAL('sqlite://...') and
  DAL('postgres://...')  only.'
 
  John C.
 
  On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
  Hi,
 
  here they are:
 
  http://web2py.com/book/default/section/12/9
 
  + use newest stable
 
  --
  Kuba


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 6:33 PM, mdipierro wrote:

 Do you still have the patch. I remember applying one patch from you
 and rejecting one that I thought would break certain expressions. If
 you resend it I will double check.

You applied the patch to test_template.py, which was also broken.

I need to update it, since template.py has changed since I sent it last time.

A problem is that we don't have a good test case. The unit test doesn't have 
any embedded newlines, which is what re_strings is all about.

Back in a minute.


 
 On Apr 7, 7:43 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 2:28 PM, Timothy Farrell wrote:
 
 I've looked at this problem extensively and I'm convinced that the solution 
 is to re-implement template.py without complicated regexps or remove the 
 claim of Jython support.
 
 The exact problem is related to the size of a view that is run through the 
 template module.  The re_strings as it is used in the parse() method is 
 too complicated.  A temporary solution is to comment out that line but 
 templates will not render some Javascript properly.
 
 re_strings looks just plain broken to me. The inner parens should not be 
 capturing, there should be non-capturing parens around the alternation, and 
 the single-line quote patterns shouldn't have dots in the match.
 
 I think.
 
 I sent a patch for this back in November, and Timothy reported that it 
 worked. But it never got applied.
 
 Want to try again?
 
 
 
 This is ultimately a bug in Java (not even Jython) but it officially has 
 WONT-FIX status with Sun.
 
 On 4/7/2010 3:34 PM, Jonathan Lundell wrote:
 
 On Apr 7, 2010, at 12:44 PM, John Cobo wrote:
 
 I have not written any regular expressions. So far I am just trying to 
 run the web2py welcome app.
 
 The only reg. exp. is what creates the welcome page view.
 
 No traceback?
 
 Thanks.
 
 On 7 Apr 2010 19:29, Jonathan Lundell jlund...@pobox.com wrote:
 
 On Apr 7, 2010, at 9:55 AM, JC11 wrote:
 
 I am getting the dreaded error:
  RuntimeError: maximum recursion depth exceeded
 
 I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
 I have altered the web2py 'welcome' application defaault controller
 to: return 'Hello World' rather than return dict(message=T('Hello
 World')).
 This solved the recursion problem, but only if one does not use web2py
 views :(
 
 I tried adding the following to the default controller, but it did not
 help.
 import sys
 sys.setrecursionlimit(2500)
 
 Any suggestions ?
 
 What's the regex that's causing the problem?
 
 On Apr 7, 4:16 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
 
 Some people have reported problems with Jython due to a bug in Java
 regex. I tried Jython2.5rc2 and it worked for me. Let us know.
 
 One or two of the regex patches a while back (URL checking IIRC) was 
 aimed at preventing excessive backtracking under Jython. If anyone 
 runs into that problem again, they should report it. I'm pretty sure I 
 understand how to avoid at least the problem we had then, by making 
 alternations mutually exclusive.
 
 On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
 Thanks,
 
 I am sure I searched in the 'book', how silly of me not to find it.
 What about Oracle and Jython ?  The last line of the entrie reads:
'You will be able to use DAL('sqlite://...') and
 DAL('postgres://...')  only.'
 
 John C.
 
 On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
 Hi,
 
 here they are:
 
 http://web2py.com/book/default/section/12/9
 
 + use newest stable
 
 --
 Kuba
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 6:40 PM, Jonathan Lundell wrote:

 On Apr 7, 2010, at 6:33 PM, mdipierro wrote:
 
 Do you still have the patch. I remember applying one patch from you
 and rejecting one that I thought would break certain expressions. If
 you resend it I will double check.
 
 You applied the patch to test_template.py, which was also broken.
 
 I need to update it, since template.py has changed since I sent it last time.
 
 A problem is that we don't have a good test case. The unit test doesn't have 
 any embedded newlines, which is what re_strings is all about.
 
 Back in a minute.

This is for testing: http://web.me.com/jlundell/filechute/template.zip

I do not understand one part of the pattern. For example:

 + r'(?!'')(?:[^'\\]+|\\.)*'

Why do we need the |\\. ? What function is it serving? It seems to make the 
alternation useless. Also, I'm not sure why we're escaping the right square 
bracket.

 
 
 
 On Apr 7, 7:43 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 2:28 PM, Timothy Farrell wrote:
 
 I've looked at this problem extensively and I'm convinced that the 
 solution is to re-implement template.py without complicated regexps or 
 remove the claim of Jython support.
 
 The exact problem is related to the size of a view that is run through the 
 template module.  The re_strings as it is used in the parse() method is 
 too complicated.  A temporary solution is to comment out that line but 
 templates will not render some Javascript properly.
 
 re_strings looks just plain broken to me. The inner parens should not be 
 capturing, there should be non-capturing parens around the alternation, and 
 the single-line quote patterns shouldn't have dots in the match.
 
 I think.
 
 I sent a patch for this back in November, and Timothy reported that it 
 worked. But it never got applied.
 
 Want to try again?
 
 
 
 This is ultimately a bug in Java (not even Jython) but it officially has 
 WONT-FIX status with Sun.
 
 On 4/7/2010 3:34 PM, Jonathan Lundell wrote:
 
 On Apr 7, 2010, at 12:44 PM, John Cobo wrote:
 
 I have not written any regular expressions. So far I am just trying to 
 run the web2py welcome app.
 
 The only reg. exp. is what creates the welcome page view.
 
 No traceback?
 
 Thanks.
 
 On 7 Apr 2010 19:29, Jonathan Lundell jlund...@pobox.com wrote:
 
 On Apr 7, 2010, at 9:55 AM, JC11 wrote:
 
 I am getting the dreaded error:
 RuntimeError: maximum recursion depth exceeded
 
 I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
 I have altered the web2py 'welcome' application defaault controller
 to: return 'Hello World' rather than return dict(message=T('Hello
 World')).
 This solved the recursion problem, but only if one does not use web2py
 views :(
 
 I tried adding the following to the default controller, but it did not
 help.
import sys
sys.setrecursionlimit(2500)
 
 Any suggestions ?
 
 What's the regex that's causing the problem?
 
 On Apr 7, 4:16 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
 
 Some people have reported problems with Jython due to a bug in Java
 regex. I tried Jython2.5rc2 and it worked for me. Let us know.
 
 One or two of the regex patches a while back (URL checking IIRC) was 
 aimed at preventing excessive backtracking under Jython. If anyone 
 runs into that problem again, they should report it. I'm pretty sure 
 I understand how to avoid at least the problem we had then, by making 
 alternations mutually exclusive.
 
 On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
 Thanks,
 
 I am sure I searched in the 'book', how silly of me not to find it.
 What about Oracle and Jython ?  The last line of the entrie reads:
   'You will be able to use DAL('sqlite://...') and
 DAL('postgres://...')  only.'
 
 John C.
 
 On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
 Hi,
 
 here they are:
 
 http://web2py.com/book/default/section/12/9
 
 + use newest stable
 
 --
 Kuba


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread Jonathan Lundell
On Apr 7, 2010, at 6:48 PM, Jonathan Lundell wrote:

 On Apr 7, 2010, at 6:40 PM, Jonathan Lundell wrote:
 
 On Apr 7, 2010, at 6:33 PM, mdipierro wrote:
 
 Do you still have the patch. I remember applying one patch from you
 and rejecting one that I thought would break certain expressions. If
 you resend it I will double check.
 
 You applied the patch to test_template.py, which was also broken.
 
 I need to update it, since template.py has changed since I sent it last time.
 
 A problem is that we don't have a good test case. The unit test doesn't have 
 any embedded newlines, which is what re_strings is all about.
 
 Back in a minute.
 
 This is for testing: http://web.me.com/jlundell/filechute/template.zip
 
 I do not understand one part of the pattern. For example:
 
 + r'(?!'')(?:[^'\\]+|\\.)*'
 
 Why do we need the |\\. ? What function is it serving? It seems to make the 
 alternation useless. Also, I'm not sure why we're escaping the right square 
 bracket.

Never mind. Now I see what it's doing. If this works, I'll add some comments so 
it's not quite so opaque

 
 
 
 
 On Apr 7, 7:43 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 2:28 PM, Timothy Farrell wrote:
 
 I've looked at this problem extensively and I'm convinced that the 
 solution is to re-implement template.py without complicated regexps or 
 remove the claim of Jython support.
 
 The exact problem is related to the size of a view that is run through 
 the template module.  The re_strings as it is used in the parse() 
 method is too complicated.  A temporary solution is to comment out that 
 line but templates will not render some Javascript properly.
 
 re_strings looks just plain broken to me. The inner parens should not be 
 capturing, there should be non-capturing parens around the alternation, 
 and the single-line quote patterns shouldn't have dots in the match.
 
 I think.
 
 I sent a patch for this back in November, and Timothy reported that it 
 worked. But it never got applied.
 
 Want to try again?
 
 
 
 This is ultimately a bug in Java (not even Jython) but it officially has 
 WONT-FIX status with Sun.
 
 On 4/7/2010 3:34 PM, Jonathan Lundell wrote:
 
 On Apr 7, 2010, at 12:44 PM, John Cobo wrote:
 
 I have not written any regular expressions. So far I am just trying to 
 run the web2py welcome app.
 
 The only reg. exp. is what creates the welcome page view.
 
 No traceback?
 
 Thanks.
 
 On 7 Apr 2010 19:29, Jonathan Lundell jlund...@pobox.com wrote:
 
 On Apr 7, 2010, at 9:55 AM, JC11 wrote:
 
 I am getting the dreaded error:
RuntimeError: maximum recursion depth exceeded
 
 I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
 I have altered the web2py 'welcome' application defaault controller
 to: return 'Hello World' rather than return dict(message=T('Hello
 World')).
 This solved the recursion problem, but only if one does not use web2py
 views :(
 
 I tried adding the following to the default controller, but it did not
 help.
   import sys
   sys.setrecursionlimit(2500)
 
 Any suggestions ?
 
 What's the regex that's causing the problem?
 
 On Apr 7, 4:16 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
 
 Some people have reported problems with Jython due to a bug in Java
 regex. I tried Jython2.5rc2 and it worked for me. Let us know.
 
 One or two of the regex patches a while back (URL checking IIRC) was 
 aimed at preventing excessive backtracking under Jython. If anyone 
 runs into that problem again, they should report it. I'm pretty sure 
 I understand how to avoid at least the problem we had then, by 
 making alternations mutually exclusive.
 
 On Apr 7, 6:14 am, JC11 john.c...@gmail.com wrote:
 Thanks,
 
 I am sure I searched in the 'book', how silly of me not to find it.
 What about Oracle and Jython ?  The last line of the entrie reads:
  'You will be able to use DAL('sqlite://...') and
 DAL('postgres://...')  only.'
 
 John C.
 
 On Apr 7, 11:54 am, Kuba Kucharski kuba.kuchar...@gmail.com 
 wrote:
 
 Hi,
 
 here they are:
 
 http://web2py.com/book/default/section/12/9
 
 + use newest stable
 
 --
 Kuba
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-08 Thread Jonathan Lundell
On Apr 7, 2010, at 9:55 AM, JC11 wrote:

 I am getting the dreaded error:
  RuntimeError: maximum recursion depth exceeded
 
 I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.
 
 I have altered the web2py 'welcome' application defaault controller
 to: return 'Hello World' rather than return dict(message=T('Hello
 World')).
 This solved the recursion problem, but only if one does not use web2py
 views :(
 
 I tried adding the following to the default controller, but it did not
 help.
 import sys
 sys.setrecursionlimit(2500)
 
 Any suggestions ?

Try replacing gluon/template.py with this version: 
http://web.me.com/jlundell/filechute/template.zip

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



[web2py] web2py URLs

2010-04-08 Thread Jonathan Lundell
(Context: I've been working on URL parsing.)

One of the difficulties that parsing web2py URLs presents is that the boundary 
between /a/c/f and args isn't explicit, along with the fact that pieces of 
/a/c/f can be implied (in particular when routes.py is being used).

RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', 
taking advantage of the fact that ';' is reserved. So the RFC2396 approach is 
to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars.

That is, the boundary between /a/c/f and args is marked with a semi-colon 
instead of a slash. Args can of course be further divided however one likes; 
vars is subdivided with ''.

What I'm working on is an alternative to (or rather extension to) the routes.py 
logic that is capable of supporting arbitrary encoding where appropriate 
(especially in args and vars) and that does not rely on regexes to do the work. 
The present scheme would remain in place.

Which brings me to my question: I'd like to use the ';' convention to separate 
/a/c/f from args in this new regime. Does anyone have any strong feelings about 
it one way or the other?


(One last thing: the architecture would be somewhat modular, so that besides 
the current mechanism and the one I'm describing, it would be fairly 
straightforward to introduce new ones.)

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



Re: [web2py] Re: web2py URLs

2010-04-08 Thread Jonathan Lundell
On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote:

 How will we be able to configure to use one or the other?

I'm thinking an alternative variable in routes.py.

Also, there would be (I think) a provision for application-specific routes.py 
files, so once the application is resolved at the top level, the 
application-specific parsing could either be in the global routes.py (as now) 
or the app-specific version.

 
 Will it be able to do Both at the same time (for routes_in of
 course). I ask since certain web2py sites are scanned in google, you
 don't want the old links to dis-appear.

Perhaps, but with some restrictions, since using / as the args separator leads 
to ambiguities that don't exist with ;. 

I'd like to be able to use standard Python libraries to do the main parsing 
work. See http://docs.python.org/library/urlparse.html




BTW, RFC2396 actually allows a ;-separated parameter on each component of the 
path; you could have 
http://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a 
use for that in the web2py architecture, though.

 
 -Thadeus
 
 
 
 
 
 On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 +1
 
 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote:
 (Context: I've been working on URL parsing.)
 
 One of the difficulties that parsing web2py URLs presents is that the 
 boundary between /a/c/f and args isn't explicit, along with the fact that 
 pieces of /a/c/f can be implied (in particular when routes.py is being 
 used).
 
 RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', 
 taking advantage of the fact that ';' is reserved. So the RFC2396 approach 
 is to write: /a/c/f;parameters?query_string, or in web2py terms 
 /a/c/f;args?vars.
 
 That is, the boundary between /a/c/f and args is marked with a semi-colon 
 instead of a slash. Args can of course be further divided however one 
 likes; vars is subdivided with ''.
 
 What I'm working on is an alternative to (or rather extension to) the 
 routes.py logic that is capable of supporting arbitrary encoding where 
 appropriate (especially in args and vars) and that does not rely on regexes 
 to do the work. The present scheme would remain in place.
 
 Which brings me to my question: I'd like to use the ';' convention to 
 separate /a/c/f from args in this new regime. Does anyone have any strong 
 feelings about it one way or the other?
 
 (One last thing: the architecture would be somewhat modular, so that 
 besides the current mechanism and the one I'm describing, it would be 
 fairly straightforward to introduce new ones.)
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: How to install and run web2py on Jython ?

2010-04-08 Thread Jonathan Lundell
On Apr 8, 2010, at 9:53 AM, John Cobo wrote:

 Jonathan,
 
 Your new template.py solves the problem !  Super.  Thanks a lot.
 
 John C.
 

Thanks for testing it.

Massimo, if you decide to incorporate the patch, I'd like to add some comments 
to it. Even though I wrote the new pattern a few months ago, it took me a good 
10 minutes to figure out what the heck it was doing, and why.

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



Re: [web2py] Re: web2py URLs

2010-04-09 Thread Jonathan Lundell
On Apr 9, 2010, at 6:16 AM, DenesL wrote:

 I like the semicolon idea.
 But doesn't it imply changing web2py, anywhere where args and vars are
 used, like the URL function?.

The URL function, yes, because it's basically the rewrite-out handler. Nobody 
else should care, because the fields have already been split, unless an 
application is using the original URL.

WRT handling missing defaults from a URL (a/c/f), I realized the other day that 
it's best to look at it starting with the routes-out side, URL(), and making 
the routes-in side complement it. I think that's conceptually simpler than the 
implied routes.py approach of managing routes-in and then figuring out the 
routes-out complement. Maybe that's just me...

 
 
 On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I think if ; is present it be used by default to delimit the args
 since there cannot be confusion there
 
 /a/c/f.ext;a0/a1/a2
 /a/c/f/a0/a1/a2.ext
 
 should be parsed in the same way.
 
 routes_in and routes_out should not be affected since they only
 rewrite the URL before web2py interprets it.
 
 On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 
 I just want it to be able to routes_in on both with ; and without ;.
 
 This is because my blog is indexed on google, and I want my old links
 to still work If I moved over to the ; method.
 
 -Thadeus
 
 On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote:
 
 How will we be able to configure to use one or the other?
 
 I'm thinking an alternative variable in routes.py.
 
 Also, there would be (I think) a provision for application-specific 
 routes.py files, so once the application is resolved at the top level, the 
 application-specific parsing could either be in the global routes.py (as 
 now) or the app-specific version.
 
 Will it be able to do Both at the same time (for routes_in of
 course). I ask since certain web2py sites are scanned in google, you
 don't want the old links to dis-appear.
 
 Perhaps, but with some restrictions, since using / as the args separator 
 leads to ambiguities that don't exist with ;.
 
 I'd like to be able to use standard Python libraries to do the main 
 parsing work. Seehttp://docs.python.org/library/urlparse.html
 
 BTW, RFC2396 actually allows a ;-separated parameter on each component of 
 the path; you could 
 havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I 
 don't see a use for that in the web2py architecture, though.
 
 -Thadeus
 
 On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu 
 wrote:
 +1
 
 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote:
 (Context: I've been working on URL parsing.)
 
 One of the difficulties that parsing web2py URLs presents is that the 
 boundary between /a/c/f and args isn't explicit, along with the fact 
 that pieces of /a/c/f can be implied (in particular when routes.py is 
 being used).
 
 RFC2396 (1998) introduced (or rather extended) the notion of 
 'parameters', taking advantage of the fact that ';' is reserved. So the 
 RFC2396 approach is to write: /a/c/f;parameters?query_string, or in 
 web2py terms /a/c/f;args?vars.
 
 That is, the boundary between /a/c/f and args is marked with a 
 semi-colon instead of a slash. Args can of course be further divided 
 however one likes; vars is subdivided with ''.
 
 What I'm working on is an alternative to (or rather extension to) the 
 routes.py logic that is capable of supporting arbitrary encoding where 
 appropriate (especially in args and vars) and that does not rely on 
 regexes to do the work. The present scheme would remain in place.
 
 Which brings me to my question: I'd like to use the ';' convention to 
 separate /a/c/f from args in this new regime. Does anyone have any 
 strong feelings about it one way or the other?
 
 (One last thing: the architecture would be somewhat modular, so that 
 besides the current mechanism and the one I'm describing, it would be 
 fairly straightforward to introduce new ones.)
 
 --
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr

Re: [web2py] Re: web2py URLs

2010-04-09 Thread Jonathan Lundell
On Apr 9, 2010, at 8:09 AM, mdipierro wrote:

 Right not if there is a ; the URL does not pass validation so ; is
 simply not allowed. We can write this so that if ; is present the new
 method for parsing is used and urls generated by URL would always
 follow the new convention. Old convention would still work. I do not
 see any ambiguity.

I think we still need a flag (possibly per-app), to recognize the case when 
there are no args (the canonical form of the URL never has a bare ;).

 
 On Apr 9, 8:16 am, DenesL denes1...@yahoo.ca wrote:
 I like the semicolon idea.
 But doesn't it imply changing web2py, anywhere where args and vars are
 used, like the URL function?.
 
 On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
 I think if ; is present it be used by default to delimit the args
 since there cannot be confusion there
 
 /a/c/f.ext;a0/a1/a2
 /a/c/f/a0/a1/a2.ext
 
 should be parsed in the same way.
 
 routes_in and routes_out should not be affected since they only
 rewrite the URL before web2py interprets it.
 
 On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 
 I just want it to be able to routes_in on both with ; and without ;.
 
 This is because my blog is indexed on google, and I want my old links
 to still work If I moved over to the ; method.
 
 -Thadeus
 
 On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote:
 
 How will we be able to configure to use one or the other?
 
 I'm thinking an alternative variable in routes.py.
 
 Also, there would be (I think) a provision for application-specific 
 routes.py files, so once the application is resolved at the top level, 
 the application-specific parsing could either be in the global routes.py 
 (as now) or the app-specific version.
 
 Will it be able to do Both at the same time (for routes_in of
 course). I ask since certain web2py sites are scanned in google, you
 don't want the old links to dis-appear.
 
 Perhaps, but with some restrictions, since using / as the args separator 
 leads to ambiguities that don't exist with ;.
 
 I'd like to be able to use standard Python libraries to do the main 
 parsing work. Seehttp://docs.python.org/library/urlparse.html
 
 BTW, RFC2396 actually allows a ;-separated parameter on each component of 
 the path; you could 
 havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I 
 don't see a use for that in the web2py architecture, though.
 
 -Thadeus
 
 On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu 
 wrote:
 +1
 
 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote:
 (Context: I've been working on URL parsing.)
 
 One of the difficulties that parsing web2py URLs presents is that the 
 boundary between /a/c/f and args isn't explicit, along with the fact 
 that pieces of /a/c/f can be implied (in particular when routes.py is 
 being used).
 
 RFC2396 (1998) introduced (or rather extended) the notion of 
 'parameters', taking advantage of the fact that ';' is reserved. So 
 the RFC2396 approach is to write: /a/c/f;parameters?query_string, or 
 in web2py terms /a/c/f;args?vars.
 
 That is, the boundary between /a/c/f and args is marked with a 
 semi-colon instead of a slash. Args can of course be further divided 
 however one likes; vars is subdivided with ''.
 
 What I'm working on is an alternative to (or rather extension to) the 
 routes.py logic that is capable of supporting arbitrary encoding where 
 appropriate (especially in args and vars) and that does not rely on 
 regexes to do the work. The present scheme would remain in place.
 
 Which brings me to my question: I'd like to use the ';' convention to 
 separate /a/c/f from args in this new regime. Does anyone have any 
 strong feelings about it one way or the other?
 
 (One last thing: the architecture would be somewhat modular, so that 
 besides the current mechanism and the one I'm describing, it would be 
 fairly straightforward to introduce new ones.)
 
 --
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.
 
 --
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp

Re: [web2py] Re: web2py URLs

2010-04-09 Thread Jonathan Lundell
On Apr 9, 2010, at 8:25 AM, Thadeus Burgess wrote:

 Just as long as its a variable we have to flag on, and web2py
 continues to work like it always has :)

That's the plan.

 
 -Thadeus
 
 
 
 
 
 On Fri, Apr 9, 2010 at 10:17 AM, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 9, 2010, at 6:16 AM, DenesL wrote:
 
 I like the semicolon idea.
 But doesn't it imply changing web2py, anywhere where args and vars are
 used, like the URL function?.
 
 The URL function, yes, because it's basically the rewrite-out handler. 
 Nobody else should care, because the fields have already been split, unless 
 an application is using the original URL.
 
 WRT handling missing defaults from a URL (a/c/f), I realized the other day 
 that it's best to look at it starting with the routes-out side, URL(), and 
 making the routes-in side complement it. I think that's conceptually simpler 
 than the implied routes.py approach of managing routes-in and then figuring 
 out the routes-out complement. Maybe that's just me...
 
 
 
 On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I think if ; is present it be used by default to delimit the args
 since there cannot be confusion there
 
 /a/c/f.ext;a0/a1/a2
 /a/c/f/a0/a1/a2.ext
 
 should be parsed in the same way.
 
 routes_in and routes_out should not be affected since they only
 rewrite the URL before web2py interprets it.
 
 On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 
 I just want it to be able to routes_in on both with ; and without ;.
 
 This is because my blog is indexed on google, and I want my old links
 to still work If I moved over to the ; method.
 
 -Thadeus
 
 On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com 
 wrote:
 On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote:
 
 How will we be able to configure to use one or the other?
 
 I'm thinking an alternative variable in routes.py.
 
 Also, there would be (I think) a provision for application-specific 
 routes.py files, so once the application is resolved at the top level, 
 the application-specific parsing could either be in the global routes.py 
 (as now) or the app-specific version.
 
 Will it be able to do Both at the same time (for routes_in of
 course). I ask since certain web2py sites are scanned in google, you
 don't want the old links to dis-appear.
 
 Perhaps, but with some restrictions, since using / as the args separator 
 leads to ambiguities that don't exist with ;.
 
 I'd like to be able to use standard Python libraries to do the main 
 parsing work. Seehttp://docs.python.org/library/urlparse.html
 
 BTW, RFC2396 actually allows a ;-separated parameter on each component 
 of the path; you could 
 havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I 
 don't see a use for that in the web2py architecture, though.
 
 -Thadeus
 
 On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu 
 wrote:
 +1
 
 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote:
 (Context: I've been working on URL parsing.)
 
 One of the difficulties that parsing web2py URLs presents is that the 
 boundary between /a/c/f and args isn't explicit, along with the fact 
 that pieces of /a/c/f can be implied (in particular when routes.py is 
 being used).
 
 RFC2396 (1998) introduced (or rather extended) the notion of 
 'parameters', taking advantage of the fact that ';' is reserved. So 
 the RFC2396 approach is to write: /a/c/f;parameters?query_string, or 
 in web2py terms /a/c/f;args?vars.
 
 That is, the boundary between /a/c/f and args is marked with a 
 semi-colon instead of a slash. Args can of course be further divided 
 however one likes; vars is subdivided with ''.
 
 What I'm working on is an alternative to (or rather extension to) the 
 routes.py logic that is capable of supporting arbitrary encoding 
 where appropriate (especially in args and vars) and that does not 
 rely on regexes to do the work. The present scheme would remain in 
 place.
 
 Which brings me to my question: I'd like to use the ';' convention to 
 separate /a/c/f from args in this new regime. Does anyone have any 
 strong feelings about it one way or the other?
 
 (One last thing: the architecture would be somewhat modular, so that 
 besides the current mechanism and the one I'm describing, it would be 
 fairly straightforward to introduce new ones.)
 
 --
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.
 
 --
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group

Re: [web2py] html5

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 9:59 AM, mdipierro wrote:

 should we replace in welcome
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
 www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
 
 
 with
 
 !DOCTYPE html
 
 pros? cons?

HTML5 is still a draft, not a standard. Validation tools tend not to support it 
(BBEdit is a case in point).



-- 
To unsubscribe, reply using remove me as the subject.


Re: [web2py] Re: html5

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 10:23 AM, mdipierro wrote:

 ps. I am not suggesting we use the new html5 features yet (like
 forms). Only the doctype (google does it) and make sure it w3c
 validates.

I'm not sure that Google is the best example to follow: 
http://validator.w3.org/check?uri=http://www.google.com

 
 On Apr 12, 12:10 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 12, 2010, at 9:59 AM, mdipierro wrote:
 
 should we replace in welcome
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
 www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
 
 with
 
 !DOCTYPE html
 
 pros? cons?
 
 HTML5 is still a draft, not a standard. Validation tools tend not to support 
 it (BBEdit is a case in point).
 
 
 -- 
 To unsubscribe, reply using remove me as the subject.




Re: [web2py] model files can not end with a comment

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 11:52 AM, DenesL wrote:

 In 1.76.3, and probably others, model files can not end with a comment
 line:
 
 Traceback (most recent call last):
  File D:\web2py\hg\gluon\restricted.py, line 171, in restricted
ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
  File D:/web2py/hg/applications/mssqltest/models/db.py, line 111
#
^
 SyntaxError: invalid syntax
 
 Adding an empty line fixes the problem but figuring that out is a
 waste of time.

FWIW, compile() requires at least one terminal newline. Perhaps it'd be 
reasonable to append one (along the the \r\n conversion).

-- 
To unsubscribe, reply using remove me as the subject.


Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 12:39 PM, Jonathan Lundell wrote:

 On Apr 12, 2010, at 12:17 PM, Yarko Tymciurak wrote:
 
 On Apr 12, 2:15 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 12, 2010, at 11:52 AM, DenesL wrote:
 
 In 1.76.3, and probably others, model files can not end with a comment
 line:
 
 Traceback (most recent call last):
 File D:\web2py\hg\gluon\restricted.py, line 171, in restricted
   ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
 File D:/web2py/hg/applications/mssqltest/models/db.py, line 111
   #
   ^
 SyntaxError: invalid syntax
 
 Adding an empty line fixes the problem but figuring that out is a
 waste of time.
 
 FWIW, compile() requires at least one terminal newline. Perhaps it'd be 
 reasonable to append one (along the the \r\n conversion).
 
 hmmm. I am not able to reproce this;  I even ensured that the
 model file I tested with actually had NO newline after the comment:
 
 $ od -c mymodel.py
 ...
 0001640   t   i   o   n   t   o   o   l \n   #
 0001654
 
 Mine runs fine.
 
 I wonder if this is a platform, or python version specific thing...
 
 Can you provide more details?
 
 I ran into it a week or two ago on OS X, Python 2.6.4.
 
 http://docs.python.org/library/functions.html
 
 Note When compiling a string with multi-line code, line endings must be 
 represented by a single newline character ('\n'), and the input must be 
 terminated by at least one newline character. If line endings are 
 represented by '\r\n', usestr.replace() to change them into '\n'.

...or maybe it was Linux. I forget.



-- 
To unsubscribe, reply using remove me as the subject.


Re: [web2py] Re: model files can not end with a comment

2010-04-12 Thread Jonathan Lundell
On Apr 12, 2010, at 4:25 PM, Yarko Tymciurak wrote:

 Ok - not sure why I was not able to reproduce before:  I put a
 breakpoint on line 179 of restricted, and sure enough code, when it
 had no ending newline,  would cause an error.
 
 This seems like it is a bug with the builtin, compile() ...

It's documented (and presumably deliberate) behavior.


-- 
To unsubscribe, reply using remove me as the subject.


Re: [web2py] Re: model files can not end with a comment

2010-04-13 Thread Jonathan Lundell
On Apr 13, 2010, at 8:16 AM, Thadeus Burgess wrote:

 Agreed, we need more code comments!
 
 Massimo, no more commits unless they contain descriptive comments!
 
 I'm sure there was a reason it doesn't. Most programming languages
 require a newline at the end of your source code file.
 
 It probably has something to do with cross-platform compatibility.
 Since \r and \n mean different things for windows and linux.

It's a peculiar requirement, especially since it would have taken less effort 
to append a newline in compile() than to document the fact that it's required.

 
 --
 Thadeus
 
 
 
 
 
 On Tue, Apr 13, 2010 at 1:23 AM, Yarko Tymciurak
 resultsinsoftw...@gmail.com wrote:
 On Apr 12, 11:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 hmmm... on a second thought we do that already in admin.
 
 data = request.vars.data.replace('\r\n', '\n').strip() +
 '\n'
 
 Ah!  This is probably why I was not seeing the problem - I had to
 delete the trailing '\n' in Wing, at the breakpoint to get the problem
 to show..
 
 
 So, question is:  If people introduce comments in debugging
 environments, having this in admin may not be good enough;
 
 But, as Massimo points out,  cache will be affected.
 
 I think the real solution is (then) to do this (if possible) as _late_
 as possible (i.e. at the call to compile()) but - would like to
 know what the reason for strip was (some retained comments in code
 would be helpful).
 
 - Yarko
 
 So the problem is definitively the compile function. I do not oppose
 to Yarko's proposed fix but I'd like to know if anybody has anything
 against it.
 
 Massimo
 
 On Apr 12, 11:22 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
 I agree.
 There is a reason why we strip()  models and controllers but I forgot
 what that was.
 I do not see a problem with stripping and adding a \n.
 
 Massimo
 
 On Apr 12, 10:33 pm, Yarko Tymciurak resultsinsoftw...@gmail.com
 wrote:
 
 On Apr 12, 6:36 pm, Jonathan Lundell jlund...@pobox.com wrote:
 
 On Apr 12, 2010, at 4:25 PM, Yarko Tymciurak wrote:
 
 Ok - not sure why I was not able to reproduce before:  I put a
 breakpoint on line 179 of restricted, and sure enough code, when it
 had no ending newline,  would cause an error.
 
 This seems like it is a bug with the builtin, compile() ...
 
 It's documented (and presumably deliberate) behavior.
 
 Massimo -
 
 Yes, Jonathan is right: this is a bug in web2py (strictly speaking);
 seehttp://docs.python.org/library/functions.html
 
 I suggest either take the simple change I posted, or a test to see if
 end of code[-1]=='\n'
 
 (The latter seems a waste of logic, since newline - extra or not - is
 cheap).
 
 Regards,
 Yarko
 
 
 --
 To unsubscribe, reply using remove me as the subject.
 




Re: [web2py] request.vars convenience

2010-04-15 Thread Jonathan Lundell
On Apr 15, 2010, at 3:05 AM, Mladen Milankovic wrote:

 q = request.vars.get('q', None)
 
 You can put anything instead of None. It's like a default value.

Or just q = request.vars.get('q'), since None is the default.

This is standard dictionary behavior in Python. It and setdefault are 
particularly useful dict methods, and worth getting to know.

Re: [web2py] Re: r1812 breaks winservice.py

2010-04-15 Thread Jonathan Lundell
On Apr 15, 2010, at 6:50 AM, mdipierro wrote:

 I think it is not fixed. Please check. Thanks.

Or now fixed, as the case may be.

 
 On Apr 15, 3:13 am, Fran francisb...@googlemail.com wrote:
 In Bzr revision 1813 onwards, Web2Py no longer works as a Win32
 service:
 
 Traceback (most recent call last):
   File C:\Bin\web2py\gluon\winservice.py, line 46, in SvcDoRun
 self.start()
   File C:\Bin\web2py\gluon\winservice.py, line 118, in start
 path=options.folder,
 TypeError: __init__() got an unexpected keyword argument 'path'
 
 This has been traced to the removal of the relevant option to
 HttpServer in this 
 revision:http://bazaar.launchpad.net/~mdipierro/web2py/devel/revision/1813#glu...
 
 I'm not sure whether the option needs restoring or whether
 winservice.py should no longer attempt to pass it.
 
 Many thanks,
 Fran.
 
 
 -- 
 To unsubscribe, reply using remove me as the subject.




[web2py] error compiling app

2010-04-16 Thread Jonathan Lundell
I have several questions regarding app compiles, but the first one is this:

Error traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
Traceback (most recent call last):
  File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py, line 173, 
in restricted
exec ccode in environment
  File 
/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
 line 1061, in module
  File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py, line 96, in 
lambda
self._caller = lambda f: f()
  File 
/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
 line 213, in compile_app
c = app_compile(request.args[0], request)
  File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py, line 141, in 
app_compile
compile_application(folder)
  File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, line 520, 
in compile_application
compile_views(folder)
  File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, line 293, 
in compile_views
data = parse_template(file, path)
  File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py, line 139, 
in parse_template
t = os.path.join(path, eval(match.group('name'), context))
  File string, line 1, in module
NameError: name 'request' is not defined
The match in question is presumably {{extend request.layout}}, right?

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] compiling apps and reporting errors

2010-04-16 Thread Jonathan Lundell
In admin/default, we have:

def compile_app():
c = app_compile(request.args[0], request)
if c:
session.flash = T('application compiled')
else:
import traceback
tb = traceback.format_exc()
session.flash = DIV(T('Cannot compile: there are errors in your 
app:',CODE(tb)))
redirect(URL(r=request, f='site'))


It's calling this from gluon/admin:

def app_compile(app, request):

Compiles the application

Parameters
--
app:
application name
request:
the global request object

from compileapp import compile_application, remove_compiled_application
folder = apath(app, request)
try:
compile_application(folder)
return True
except (Exception, RestrictedError):
remove_compiled_application(folder)
return False


However, CODE(tb) appears to be always empty. I believe that's because 
traceback.format_exc() expects to find a traceback buffer on the stack, but 
since app_compile() has returned after catching the exception, the exception 
isn't on the stack any more. I think it's necessary for app_compile to return 
the traceback to the caller.



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] error compiling app

2010-04-16 Thread Jonathan Lundell
On Apr 16, 2010, at 2:11 PM, Jonathan Lundell wrote:

 I have several questions regarding app compiles, but the first one is this:
 
 Error traceback
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 Traceback (most recent call last):
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py, line 
 173, in restricted
 exec ccode in environment
   File 
 /Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
  line 1061, in module
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py, line 96, 
 in lambda
 self._caller = lambda f: f()
   File 
 /Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
  line 213, in compile_app
 c = app_compile(request.args[0], request)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py, line 141, in 
 app_compile
 compile_application(folder)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, line 
 520, in compile_application
 compile_views(folder)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, line 
 293, in compile_views
 data = parse_template(file, path)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py, line 139, 
 in parse_template
 t = os.path.join(path, eval(match.group('name'), context))
   File string, line 1, in module
 NameError: name 'request' is not defined
 The match in question is presumably {{extend request.layout}}, right?

OK, that's what I changed. Because I was experimenting with layouts, I changed 
{{extend 'layout.html'}} to {{extend request.layout}}, which I assumed would 
work because request appears to be defined in views. But it's not defined in 
the context of the extend logic's eval().

It seems like a reasonable thing to be able to do

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] compiling an app externally

2010-04-16 Thread Jonathan Lundell
Can I invoke the compile-app functionality from the command line 
(non-interactively) in order to compile an app as part of an external make?

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: error compiling app

2010-04-16 Thread Jonathan Lundell
On Apr 16, 2010, at 5:13 PM, mdipierro wrote:

 Not quite.
 
 {{extend name}} without quote is supported by name has to be a
 variable containing the name of the template. This allows to have
 templates determined dynamically based on user for example.

So instead of {{extend request.layout}}, what?

Can I do:

{{layout = request.layout}}
{{extend layout}}

?

Note that {{extend request.layout}} works fine in normal operation. It only 
breaks when I try to compile the app, because request isn't defined for the 
eval().


 
 On Apr 16, 5:24 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 16, 2010, at 2:11 PM, Jonathan Lundell wrote:
 
 
 
 I have several questions regarding app compiles, but the first one is this:
 
 Error traceback
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 Traceback (most recent call last):
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py, line 
 173, in restricted
 exec ccode in environment
   File 
 /Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
  line 1061, in module
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py, line 96, 
 in lambda
 self._caller = lambda f: f()
   File 
 /Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
  line 213, in compile_app
 c = app_compile(request.args[0], request)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py, line 141, 
 in app_compile
 compile_application(folder)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, line 
 520, in compile_application
 compile_views(folder)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, line 
 293, in compile_views
 data = parse_template(file, path)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py, line 
 139, in parse_template
 t = os.path.join(path, eval(match.group('name'), context))
   File string, line 1, in module
 NameError: name 'request' is not defined
 The match in question is presumably {{extend request.layout}}, right?
 
 OK, that's what I changed. Because I was experimenting with layouts, I 
 changed {{extend 'layout.html'}} to {{extend request.layout}}, which I 
 assumed would work because request appears to be defined in views. But it's 
 not defined in the context of the extend logic's eval().
 
 It seems like a reasonable thing to be able to do
 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] Re: compiling apps and reporting errors

2010-04-17 Thread Jonathan Lundell
On Apr 16, 2010, at 6:39 PM, mdipierro wrote:

 I think I fixed it in trunk, please let check it.

It looks right. I'll try to make a test case.

Two minor things. You added , e to the except clause, but e appears to be 
unused. Is there a reason for it?

Second, while it makes no difference to the logic, I'd return None instead of 
False in the normal case, for aesthetic reasons.

 
 Massimo
 
 On Apr 16, 4:15 pm, Jonathan Lundell jlund...@pobox.com wrote:
 In admin/default, we have:
 
 def compile_app():
 c = app_compile(request.args[0], request)
 if c:
 session.flash = T('application compiled')
 else:
 import traceback
 tb = traceback.format_exc()
 session.flash = DIV(T('Cannot compile: there are errors in your 
 app:',CODE(tb)))
 redirect(URL(r=request, f='site'))
 
 It's calling this from gluon/admin:
 
 def app_compile(app, request):
 
 Compiles the application
 
 Parameters
 --
 app:
 application name
 request:
 the global request object
 
 from compileapp import compile_application, remove_compiled_application
 folder = apath(app, request)
 try:
 compile_application(folder)
 return True
 except (Exception, RestrictedError):
 remove_compiled_application(folder)
 return False
 
 However, CODE(tb) appears to be always empty. I believe that's because 
 traceback.format_exc() expects to find a traceback buffer on the stack, but 
 since app_compile() has returned after catching the exception, the exception 
 isn't on the stack any more. I think it's necessary for app_compile to 
 return the traceback to the caller.
 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] Re: error compiling app

2010-04-17 Thread Jonathan Lundell
On Apr 16, 2010, at 6:47 PM, mdipierro wrote:

 I am readying your question and my answer again and I said something
 silly. You should be able to do what you originally proposed
 
 {{extend request.layout}} although I'd probably do {{extend
 reponse.layout}} instead. I tried and both work for me (unless the app
 is bytecode compiled). If the app is bytecode compiled dynamical
 extend and imports are not supported.

That sounds like what I'm seeing. The failure (traceback below) happens during 
the compile itself.

The exception is raised during the eval in parse_template:

# check whether it extends a layout
while 1:
match = re_extend.search(text)
if not match:
break
t = os.path.join(path, eval(match.group('name'), context))
try:
fp = open(t, 'rb')


Perhaps the eval should be in a try, to make the error reporting a little more 
explicit? Otherwise it's a little confusing for code that works normally to 
crash a compile.

 
 Massimo
 
 On Apr 16, 8:09 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 16, 2010, at 5:13 PM, mdipierro wrote:
 
 Not quite.
 
 {{extend name}} without quote is supported by name has to be a
 variable containing the name of the template. This allows to have
 templates determined dynamically based on user for example.
 
 So instead of {{extend request.layout}}, what?
 
 Can I do:
 
 {{layout = request.layout}}
 {{extend layout}}
 
 ?
 
 Note that {{extend request.layout}} works fine in normal operation. It only 
 breaks when I try to compile the app, because request isn't defined for the 
 eval().
 
 
 
 On Apr 16, 5:24 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 16, 2010, at 2:11 PM, Jonathan Lundell wrote:
 
 I have several questions regarding app compiles, but the first one is 
 this:
 
 Error traceback
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 Traceback (most recent call last):
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py, 
 line 173, in restricted
 exec ccode in environment
   File 
 /Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
  line 1061, in module
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py, line 
 96, in lambda
 self._caller = lambda f: f()
   File 
 /Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py,
  line 213, in compile_app
 c = app_compile(request.args[0], request)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py, line 
 141, in app_compile
 compile_application(folder)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, 
 line 520, in compile_application
 compile_views(folder)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py, 
 line 293, in compile_views
 data = parse_template(file, path)
   File /Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py, line 
 139, in parse_template
 t = os.path.join(path, eval(match.group('name'), context))
   File string, line 1, in module
 NameError: name 'request' is not defined
 The match in question is presumably {{extend request.layout}}, right?
 
 OK, that's what I changed. Because I was experimenting with layouts, I 
 changed {{extend 'layout.html'}} to {{extend request.layout}}, which I 
 assumed would work because request appears to be defined in views. But 
 it's not defined in the context of the extend logic's eval().
 
 It seems like a reasonable thing to be able to do
 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] what do you make of this?

2010-04-18 Thread Jonathan Lundell
On Apr 18, 2010, at 5:07 PM, mdipierro wrote:

 http://twitter.com/idlecool/status/12408675362

You never know, but it seems doubtful, especially since the pdf came from 
Keynote. Bitdefender has had problems with false positives in the past.

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] what do you make of this?

2010-04-18 Thread Jonathan Lundell
On Apr 18, 2010, at 5:07 PM, mdipierro wrote:

 http://twitter.com/idlecool/status/12408675362

Speaking of viruses in PDFs, I hope that everyone on this list using Acrobat or 
Adobe Reader knows to disable JavaScript. It's of little to no use in PDFs 
(except for some interactive forms, I think), and it's the principle infection 
vector.

Just say no.



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] creating links to '#blah'

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 5:38 AM, G. Clifford Williams wrote:

 I'm trying to figure out how to get links created in web2py that point to an 
 anchor name here is the code I'm using: 
 
{{=DIV(SPAN(gripe.created_on, _class='gripe-date'), 
A(SPAN(SPAN('Comments:'),
SPAN(gripe.comments, _class='comment-number'),
_class='comment-count'),
_href=URL(r=request, f='gripe',
args=[gripe.id,  
 XML('#comments')] )),
_class='gripe-footer')}}
 
 
 from this I was hoping to get a link like: 
 http://localhost:8081/init/default/gripe/9/#comments
 
 but instead I got :
 http://localhost:8081/init/default/gripe/9/%23comments

Try

   _href=URL(r=request, f='gripe',
   args=[gripe.id], 
anchor='comments' )),

Which should get you something like this (note no slash before the anchor):

http://localhost:8081/init/default/gripe/9#comments

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] a bug of sorts in app installation

2010-04-19 Thread Jonathan Lundell
I've been trying to install an app through admin, and it's been failing. 
(Problem #1: there's no feedback at all when this happens, just a message that 
the install failed; I had to run a debugger to find out why.)

It turned out that fix_newlines was raising an exception because it was trying 
to write a .py file that was read-only. It was read-only because my app is 
under Perforce source control, and read-only is the normal state for files not 
being edited.

So when the app was packed, tar preserved the read-only state of the files, and 
when fix_newlines tries to write them, kablooey.

My workaround is below: since this is a Unix system, fix_newlines isn't really 
necessary. I made the rewrite conditional on there actually being a change. 
Now, this is perhaps a good thing to do regardless, but of course it doesn't 
solve the problem in the Windows case.

I'm not sure what the right fix is, though this one is adequate for me. Maybe 
fix_newlines should make the file writable if necessary?


def fix_newlines(path):
regex = re.compile(r'''(\r
|\r|
)''')
for filename in listdir(path, '.*\.(py|html)$', drop=False):
fp = open(filename, 'rb')
rdata = fp.read()
fp.close()
wdata = regex.sub('\n', rdata)
if wdata != rdata:
fp = open(filename, 'wb')
fp.write(wdata)
fp.close()



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] another compilation question

2010-04-19 Thread Jonathan Lundell
When I compile an app, and the install it, it appears that controllers show up 
twice: once in controllers/ as one .pyc per controller file, and again in 
compiled/, this time once per function. What's going on, and how are these 
files used?

Also, the manual says:

 Because views can extend and include other views in a tree, before bytecode 
 compilation, the view tree for every controller is collapsed into a single 
 file. 

But in compiled/, I see a view .pyc per function, not per controller. I assume 
that I'm misinterpreting something, but again: what's going on here?



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: another compilation question

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 4:10 PM, mdipierro wrote:

 web2py does something clever for view but very stupid for controllers.
 
 The good:
 For each action is collapses its view, all extended views (layout for
 example) and included views into a single pyc file.
 
 The bad:
 For each action it generates one pyc that contains a copy of the
 entire controller.
 
 The ugly:
 The bad part can easily be fixed so that there is only one pyc per
 controller and not per action but this breaks backward compatibility
 for bytecode compiled apps. In the end we are using more space than
 needed in order to perform less checks. I admit it is ugly.

Why does the compiled version include the .pyc files in controllers/ (outside 
of compiled/)? It doesn't seem like those get used, at least not by 
run_controller_in.

And a minor thing: there's a lot of this kind of thing:

path = os.path.join(folder, 'compiled/')

Should the '/' really be part of the call? It sort of defeats the purpose of 
os.path.join.


 
 On Apr 19, 4:54 pm, Jonathan Lundell jlund...@pobox.com wrote:
 When I compile an app, and the install it, it appears that controllers show 
 up twice: once in controllers/ as one .pyc per controller file, and again in 
 compiled/, this time once per function. What's going on, and how are these 
 files used?
 
 Also, the manual says:
 
 Because views can extend and include other views in a tree, before bytecode 
 compilation, the view tree for every controller is collapsed into a single 
 file.
 
 But in compiled/, I see a view .pyc per function, not per controller. I 
 assume that I'm misinterpreting something, but again: what's going on here?
 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] Re: another compilation question

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 5:05 PM, mdipierro wrote:

 Why does the compiled version include the .pyc files in controllers/ 
 (outside of compiled/)? It doesn't seem like those get used, at least not by 
 run_controller_in.
 
 I think you refer to line 298 of compileapp.py. I do not recall why it
 is there. I will try remove it and see what breaks.

Ah, yes, that's where it comes from.

 
 And a minor thing: there's a lot of this kind of thing:
 
 path = os.path.join(folder, 'compiled/')
 
 Should the '/' really be part of the call? It sort of defeats the purpose of 
 os.path.join.
 
 There are a few cases when in can be removed (and I just did in trunk)
 but most of them are required else listdir does not work properly.

listdir appends a '/' if there isn't one already. (Though I don't see why it 
needs to, as long as it computes n correctly.)

BTW, the comment for listdir seems to confuse add_dirs with drop. Or something. 
And a pair of typos: s/b regex pattern to filter files

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: another compilation question

2010-04-19 Thread Jonathan Lundell
On Apr 19, 2010, at 6:16 PM, mdipierro wrote:

 I tried remove it and I an error in listdir.

Odd, since listdir starts out with:

if path[-1:] != '/':
path = path + '/'


Which one did you remove that caused the error?

 
 Massimo
 
 On Apr 19, 7:22 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 19, 2010, at 5:05 PM, mdipierro wrote:
 
 Why does the compiled version include the .pyc files in controllers/ 
 (outside of compiled/)? It doesn't seem like those get used, at least not 
 by run_controller_in.
 
 I think you refer to line 298 of compileapp.py. I do not recall why it
 is there. I will try remove it and see what breaks.
 
 Ah, yes, that's where it comes from.
 
 
 
 And a minor thing: there's a lot of this kind of thing:
 
 path = os.path.join(folder, 'compiled/')
 
 Should the '/' really be part of the call? It sort of defeats the purpose 
 of os.path.join.
 
 There are a few cases when in can be removed (and I just did in trunk)
 but most of them are required else listdir does not work properly.
 
 listdir appends a '/' if there isn't one already. (Though I don't see why it 
 needs to, as long as it computes n correctly.)
 
 BTW, the comment for listdir seems to confuse add_dirs with drop. Or 
 something. And a pair of typos: s/b regex pattern to filter files
 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




[web2py] Re: a bug of sorts in app installation

2010-04-19 Thread Jonathan Lundell
As a halfway fix, how about the patch below?

On Apr 19, 2010, at 2:48 PM, Jonathan Lundell wrote:

 I've been trying to install an app through admin, and it's been failing. 
 (Problem #1: there's no feedback at all when this happens, just a message 
 that the install failed; I had to run a debugger to find out why.)
 
 It turned out that fix_newlines was raising an exception because it was 
 trying to write a .py file that was read-only. It was read-only because my 
 app is under Perforce source control, and read-only is the normal state for 
 files not being edited.
 
 So when the app was packed, tar preserved the read-only state of the files, 
 and when fix_newlines tries to write them, kablooey.
 
 My workaround is below: since this is a Unix system, fix_newlines isn't 
 really necessary. I made the rewrite conditional on there actually being a 
 change. Now, this is perhaps a good thing to do regardless, but of course it 
 doesn't solve the problem in the Windows case.
 
 I'm not sure what the right fix is, though this one is adequate for me. Maybe 
 fix_newlines should make the file writable if necessary?
 
 
 def fix_newlines(path):
regex = re.compile(r'''(\r
 |\r|
 )''')
for filename in listdir(path, '.*\.(py|html)$', drop=False):
fp = open(filename, 'rb')
rdata = fp.read()
fp.close()
wdata = regex.sub('\n', rdata)
if wdata != rdata:
fp = open(filename, 'wb')
fp.write(wdata)
fp.close()
 




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Auto Creating Users/Groups/Roles

2010-04-21 Thread Jonathan Lundell
On Apr 21, 2010, at 7:09 PM, mdipierro wrote:

 NO. You cannot use
 
 password=IS_CRYPT()(passwd)[0])
 
 You must use
 
 password=db.auth_user.password.requires[0](passwd)[0])
 
 the reason is that IS_CRYPT() by default uses MD5 while if you pass a
 key IS_CRYPT(key='sha521:blabla') is uses better algorithms (for
 example hmac+sha512). So to encrypt the password you have to use the
 same IS_CRYPT(key='...') that you used when defining the model.
 
 When you create a new app from admin, auth uses hmac+sha512.

FWIW (and I'm not sure it's responsive to the original question), I use 
something like this:

uid = auth.get_or_create_user(dict(username='xxx', first_name='fff', 
last_name='lll',
email='whate...@localhost', password=hmac.new(my_hmac_key, 'hey!', 
sha512).hexdigest(), registration_key=))
auth.add_membership(gid_admin, uid)



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 7:55 AM, Patrick wrote:

 
 
 On Apr 21, 10:09 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 21, 2010, at 7:09 PM, mdipierro wrote:
 
 NO. You cannot use
 
 password=IS_CRYPT()(passwd)[0])
 
 You must use
 
 password=db.auth_user.password.requires[0](passwd)[0])
 
 the reason is that IS_CRYPT() by default uses MD5 while if you pass a
 key IS_CRYPT(key='sha521:blabla') is uses better algorithms (for
 example hmac+sha512). So to encrypt the password you have to use the
 same IS_CRYPT(key='...') that you used when defining the model.
 
 When you create a new app from admin, auth uses hmac+sha512.
 
 FWIW (and I'm not sure it's responsive to the original question), I use 
 something like this:
 
 uid = auth.get_or_create_user(dict(username='xxx', first_name='fff', 
 last_name='lll',
 email='whate...@localhost', password=hmac.new(my_hmac_key, 'hey!', 
 sha512).hexdigest(), registration_key=))
 auth.add_membership(gid_admin, uid)
 
 --
 
 I've attempted to use your example but I get an error saying 'hmac' is
 not defined.

I left out: import hmac (it's from the Python library)

 Aside from that it works if I remove the hmac.new
 altogether but then I'm stuck with it setting the password but not
 being able to log in due to it not being hashed properly. Thanks, for
 showing me a simpler way with auth.get_or_create_user.
 
 
 -- 
 Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 9:32 AM, Patrick wrote:

 I'm sorry your solution *does* work, I misread it in the reply, the
 formatting got off and I was treating it like a separate variable. So
 it works! When you first start web2py the user gets created (and every
 time the user gets deleted as well. I'll figure out a better way to do
 this later on. For now call this a feature). But the password gets set
 properly and you can login and perform actions as the user. Thanks for
 all the suggestions, until next time.

I use something like this to make it happen once. This isn't necessarily the 
test you want, but it's adaptable.

if not db(auth.settings.table_group.id0).count():
...do your thing...

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] IS_INT_IN_RANGE

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 4:28 PM, dave wrote:

 When using validator IS_INT_IN_RANGE(1900,2100) and a value of
 2100 is entered an error message of 'enter an integer between
 1900 and 2099' is displayed.  A value of 1900 is accepted.

It's using the Python notion of a range, from the programmer's point of view, 
but not the user's.

 
 Seams like the range of the validator should be inclusive for BOTH
 ends.  I have not checked validator IS_FLOAT_IN_RANGE

Float is inclusive; Python doesn't have an intrinsic notion of a float range.

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] is there or hot to create an 'IS_ALPHA' validator

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 4:56 PM, dave wrote:

 I'm interested in only there letters 'a..z' and 'A..z'.  I'm sure its
 easy with regx, but I'm looking to see how such would be defined it it
 was native to web2y.  I'm a database/batch guy, but this framework
 makes it look like I know what I'm doing with a GUI !!!

IS_MATCH('[a-zA-Z]+') ought to work.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: routes question

2010-04-25 Thread Jonathan Lundell
On Apr 25, 2010, at 8:51 AM, Vasile Ermicioi wrote:

 worked, thank you!
 
 need something like this
 
 routes_in = (
   ('(.*):https?://(.*)site1\.com:(.*)/(.*)', '/site1/$4),
   ('(.*):https?://(.*)site2\.com:(.*)/(.*)', '/site2/$4'),
 )

At the very least, you might want something like this:

routes_in = (
  ('(.*):https?://(.*)site1\.com:(.*?)/(.*)', '/site1/$4'),
  ('(.*):https?://(.*)site2\.com:(.*?)/(.*)', '/site2/$4'),
)

...and you can use Massimo's nifty $anything pattern as well. Otherwise you'll 
translate something like this:

http://site1.com/a/c/f/a1/a2

into

/site1/a2

Have you tested your pattern with 'site1.com'? (That is, with no trailing 
slash?)




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: SEO

2010-04-26 Thread Jonathan Lundell
On Apr 26, 2010, at 9:01 AM, mdmcginn wrote:

 To add to what Massimo said, make sure each page has a unique title
 and meta-description. Search engines don't like websites where every
 page appears to be identical. Also, don't count on them reading
 Javascript. When you view the source of the page, remember that's what
 the search engine crawler is viewing too. Getting other related,
 reputable sites to link to your site is one of the most important
 things you can do. Search engines look for inbound links and relevant
 content, and virtually ignore lists of meta-keywords.

Yes. As for page content, having a good, descriptive title is probably the 
single best thing you can do.

 
 Michael McGinnis
 
 
 On Apr 25, 7:08 pm, Al albertsec...@gmail.com wrote:
 Hi,
 
 I have built my web site, now how does web2py enable people be able to
 find it? is there any helper function or built-in variables which I
 can use? Also in my SQLite database, there is a column called keywords
 which I like to be indexed, is there any simple SEO techniques I can
 follow?
 
 Al
 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] Re: r=request problem.

2010-04-26 Thread Jonathan Lundell
On Apr 26, 2010, at 9:41 AM, annet wrote:

 Now I understand the problem. When I rewrite the _href:
 
 {{=A('View it in your browser',  _href=http://127.0.0.1:8000; +
 URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,item.contactpersoon.id]),
 _target=_blank)}}
 
 ... the problem is solved. I guess I'd best add a variable containing
 the http://127.0.0.1:8000; value e.g. mydomain, and then:
 
 {{=A('View it in your browser',  _href=mydomain +
 URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,item.contactpersoon.id]),
 _target=_blank)}}
 
 
 Does anyone know a better solution?

Massimo will warn you, correctly, that this isn't a universal solution, but if 
your server configuration permits it, you might be able to extract your host 
name from request.env. Have a look at request.env.http_host or 
request.env.server_name, or at similar variables in request.wsgi.environ. 

These won't always be correct (if you're behind a proxy such as Apache 
mod_proxy, for example), but if they *are* correct, it's probably better than 
hard-coding your hostname into your application.

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Rocket issues

2010-04-28 Thread Jonathan Lundell
Our engineering folks have started looking at the new release, with attention 
to Rocket, and have reported a couple of problems.

1) when https is enabled, but a connection is attempted to http,
CherryPy (?) will return a message indicating this server operates on
https only.  The new version, Rocket, does not, and the browser
appears to spin waiting for a response. 

2) if a localhost managed server is configured using the same port
as [web2py], but http protocol, atttempting to connect to that URL
will cause [web2py] to become unresponsive to all requests until it
is restarted.  With the same configuration, prior versions will
display an unable to obtain API version warning, but will remain
functional.  The configuration attempted was:

 Name: localhost
 Description: Localhost
 URL: http://127.0.0.1:8004



I believe that by managed server they mean a copy of Apache; we tend to run 
multiple copies of Apache at different ports. I'm a little confused by #2 
myself, and will get clarification, but perhaps it makes sense to Tim.

Re: [web2py] Re: Rocket issues

2010-04-28 Thread Jonathan Lundell
On Apr 28, 2010, at 7:10 AM, mdipierro wrote:

 I am sure Tim is on the case.

No doubt; thanks.

I'll get some clarification on #2. The unable to obtain API version is a 
message from our web2py app, making its own xmlrpc request directed at another 
(not web2py) server, and the get-api-version function is the first time the app 
tries to talk to the outside world (unsuccessfully, it appears).

 
 On Apr 28, 8:56 am, Jonathan Lundell jlund...@pobox.com wrote:
 Our engineering folks have started looking at the new release, with 
 attention to Rocket, and have reported a couple of problems.
 
 1) when https is enabled, but a connection is attempted to http,
 CherryPy (?) will return a message indicating this server operates on
 https only.  The new version, Rocket, does not, and the browser
 appears to spin waiting for a response.
 
 2) if a localhost managed server is configured using the same port
 as [web2py], but http protocol, atttempting to connect to that URL
 will cause [web2py] to become unresponsive to all requests until it
 is restarted.  With the same configuration, prior versions will
 display an unable to obtain API version warning, but will remain
 functional.  The configuration attempted was:
 
  Name: localhost
  Description: Localhost
  URL:http://127.0.0.1:8004
 
 I believe that by managed server they mean a copy of Apache; we tend to 
 run multiple copies of Apache at different ports. I'm a little confused by 
 #2 myself, and will get clarification, but perhaps it makes sense to Tim.




Re: [web2py] Rocket issues

2010-04-28 Thread Jonathan Lundell
On Apr 28, 2010, at 6:56 AM, Jonathan Lundell wrote:

 2) if a localhost managed server is configured using the same port
 as [web2py], but http protocol, atttempting to connect to that URL
 will cause [web2py] to become unresponsive to all requests until it
 is restarted.  With the same configuration, prior versions will
 display an unable to obtain API version warning, but will remain
 functional.  The configuration attempted was:
 
 Name: localhost
 Description: Localhost
 URL: http://127.0.0.1:8004

OK, I have a clarification on this one. I had misinterpreted the report.


In the above case, web2py is configured as https-only, port 8004.

The web2py app is configured to *talk* to another (non-web2py) entity at 
http://localhost:8004. This is a conflict, of course. But with CherryPy, the 
communication simply failed (resulting in the 'API version' message above; I'll 
try to find out what the underlying error was). With Rocket, web2py becomes 
unresponsive and has to be restarted. 

Re: [web2py] request with args

2010-04-28 Thread Jonathan Lundell
On Apr 28, 2010, at 9:30 AM, annet wrote:

 In one of my functions I redirect the user to another function. I
 would like to notify the user that he has been redirect by setting a
 flash message, the problem is the args in the url. This is the
 function:
 
 if
 request==URL(r=request,a='crm',c='clublocatormail',f='update_form'):
response.flash='message'
 
 An example of request would be: 
 http://www.fitwise.nl/crm/clublocatormail/update_form/1/1
 
 Is there a way to get rid of the args in the request? Right now the if
 will never be true.

(I *think*): just don't pass r=request to URL. Also, I think you want 
session.flash, not response.flash.

Re: [web2py] Rocket issues

2010-04-28 Thread Jonathan Lundell
On Apr 28, 2010, at 8:48 AM, Jonathan Lundell wrote:

 On Apr 28, 2010, at 6:56 AM, Jonathan Lundell wrote:
 
 2) if a localhost managed server is configured using the same port
 as [web2py], but http protocol, atttempting to connect to that URL
 will cause [web2py] to become unresponsive to all requests until it
 is restarted.  With the same configuration, prior versions will
 display an unable to obtain API version warning, but will remain
 functional.  The configuration attempted was:
 
 Name: localhost
 Description: Localhost
 URL: http://127.0.0.1:8004
 
 OK, I have a clarification on this one. I had misinterpreted the report.
 
 
 In the above case, web2py is configured as https-only, port 8004.
 
 The web2py app is configured to *talk* to another (non-web2py) entity at 
 http://localhost:8004. This is a conflict, of course. But with CherryPy, the 
 communication simply failed (resulting in the 'API version' message above; 
 I'll try to find out what the underlying error was). With Rocket, web2py 
 becomes unresponsive and has to be restarted.

More data.

It seems that CherryPy explicitly detects an attempt to make an http connection 
to its https socket and sends back a 400 Bad Request (which I'm seeing). If 
you're poking around in CherryPy, the key bit of code is this:

if thirdarg == 'http request':
# The client is talking HTTP to an HTTPS server.
raise NoSSLError()

...and you can see how it deals with NoSSLError elsewhere.

My impression is that Rocket simply closes the connection, but a) I could be 
wrong, and b) whatever is going on isn't enough.

Try this simple test: start web2py/rocket in SSL mode, and then use Firefox or 
Safari (all I've tried it with) to connect to that port with http. You should 
see the browser hang. Well, you shouldn't, really, but you will. I think.

At this point, I'm sort of stuck. I'd like to upgrade web2py for an upcoming 
release, but I can't.



Re: [web2py] Re: zoolander

2010-04-28 Thread Jonathan Lundell
On Apr 28, 2010, at 7:00 PM, mr.freeze wrote:

 Interesting. This would be an easy way to make your CSS dynamic.

web2py views are an easy way to make your CSS dynamic.


Re: [web2py] Rocket issues

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 5:58 AM, Timothy Farrell wrote:

 It sounds to me like these two issues are really one.  Basically, Rocket is 
 not sending an HTTP response when in HTTPS mode.  It closes the socket but 
 (for some reason) Python doesn't close it immediately.  This causes a client 
 to hang for a while.
 
 Thanks for the clarification.  Jon, if it's ok with you can I send you test 
 versions?

Yes, I agree that they seem to be the same, and yes, please send me test 
versions.

Thanks.

Re: [web2py] Re: Application logging

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 7:22 AM, mdipierro wrote:

 It may go in tools. What do other people think?

Logging is important enough for that, yes.

WRT Keith's comment below: Python logging offers a rich collection of logging 
mechanisms, one of which is syslog, which in turn offers a rich collection of 
logging mechanisms. For many applications (including mine) we need unified 
logging with other processes, not necessarily Python. So syslog becomes the 
unifying mechanism for all our logging.

I can see an argument for *not* using syslog, especially for self-contained 
apps that may not have access to syslog, or where you don't want to bother 
setting up a syslog environment. (What's the logging convention for GAE, btw?)


 
 On Apr 29, 8:37 am, Keith Edmunds k...@midnighthax.com wrote:
 Hi Iceberg
 
 But I would recommend you use a later version, quoted already in
 Omicron's post. It uses RotatingFileHandler to avoid unstoppable log
 file size
 
 Thanks for providing it. I can see the sense of your suggestion; however,
 I want the logging to be to the standard syslog files (which are
 logrotated independently).
 
 Massimo: I would have thought that application logging was an integral
 part of an enterprise application, much as authentication is, and should
 be in the scaffolding. It really isn't very big.
 
 Keith




Re: [web2py] restart web2py command line

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 10:30 AM, Avik Basu wrote:

 Is there a way to restart web2py from the command line in a linux
 environment?

I adapted one of the startup scripts in scripts/ (I think I started with the 
Fedora one) to make a shell script that I use from the command line. It'd be 
easy enough to add a 'restart' case that combines stop  start.

#!/bin/sh
#
#  start web2py with recycled password and no tk UI
#  -N disables cron
#
W2PDIR=path-to-web2py
PIDFILE=httpserver.pid
SCRIPT=`basename $0`
PORT=8000
PW=admin-password

if [ $1 == first ]; then
echo $W2PDIR/web2py -p $PORT -a $PW
(python $W2PDIR/web2py.py -p $PORT -N -a $PW) 
echo
echo vpepm started
elif [ $1 == start ]; then
echo $W2PDIR/web2py -p $PORT -a recycle
(python $W2PDIR/web2py.py -p $PORT -N -a recycle) 
echo
echo vpepm started
elif [ $1 == stop ]; then
if [ ! -r $W2PDIR/$PIDFILE ]; then
echo pid file $PIDFILE not found
exit 1
fi
PID=`cat $W2PDIR/$PIDFILE`
rm -f $W2PDIR/$PIDFILE
kill -TERM $PID
echo vpepm stopped
else
echo usage: $SCRIPT start|stop
exit 1
fi
exit 0



Re: [web2py] Rocket issues

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 10:37 AM, Timothy Farrell wrote:

 To those reading.  I've submitted a fix to Massimo that Jonathan's engineers 
 have tested (we should all have engineers =) ).
 
 There's one question that remains.  Is this serious enough for an immediate 
 web2py bugfix release?  I don't think so.

Probably not. The risk is that in some circumstances there's a DoS 
vulnerability (I think?); otherwise the offending case isn't actually useful 
and won't be missed.

 
 -tim
 
 On 4/29/2010 9:07 AM, Jonathan Lundell wrote:
 On Apr 29, 2010, at 5:58 AM, Timothy Farrell wrote:
 
   
 It sounds to me like these two issues are really one.  Basically, Rocket is 
 not sending an HTTP response when in HTTPS mode.  It closes the socket but 
 (for some reason) Python doesn't close it immediately.  This causes a 
 client to hang for a while.
 
 Thanks for the clarification.  Jon, if it's ok with you can I send you test 
 versions?
 
 Yes, I agree that they seem to be the same, and yes, please send me test 
 versions.
 
 Thanks.
 




Re: [web2py] Proposed patch for SQLTABLE

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 1:43 PM, Thadeus Burgess wrote:

 There is also a bug in appadmin that when you sort you get the list
 sorted, but if you browse the next 100 records, the sorting reverses
 itself. Do you think this would fix that bug as well?

Perhaps what you want to do is to append orderby=c to request.vars, and 
generate the URL from there. 

Also, vars wants to be encoded. This is the logic from html.URL:

 '?%s' % urllib.urlencode(vars)

It's not needed in the current code because we know a priori that there's 
nothing to encode. But that's not true if we include request.vars.

 
 --
 Thadeus
 
 
 
 
 
 On Thu, Apr 29, 2010 at 3:35 PM, Philip philip.el...@gmail.com wrote:
 I'm not sure the patch submittal process, nor am I confident that my
 solution is the best way to solve the issue, but I'd like to propose a
 solution.
 
 Problem:
 * Situation: SQLTABLE with orderby=True is used on a URL that includes
 any variable. For example, URL is myapp.com/init/default/invoices?
 customer=Fred, and we'll say the table has three columns, Invoice
 number, Date, and Amount.
 * Bug: If you then click on one of the column headers in the table to
 sort the table, for example Amount, the resulting URL that gets called
 loses the variable. In this example, the resulting URL is myapp.com/
 init/default/invoices?orderby=Amount.  We have lost the customer
 variable we passed to the original URL.
 * Relevant code: In the code visible here -
 http://www.web2py.com/examples/static/epydoc/web2py.gluon.sqlhtml-pysrc.html#SQLTABLE.__init__,
 the problem code is on line 1091,  _href=th_link+'?orderby=' + c
 
 Proposed Solution:
 I think this requires adding a parameter to SQLTABLE which holds the
 vars passed to the current URL. I'll call it :vars.  For simplicity,
 let's assume that vars always has the same form as request.vars, so
 that the canonical way of calling SQLTABLE in these circumstances in a
 controller is to add a parameter 'vars=request.vars'.  Since it only
 comes into play when orderby=True, we can insert a few lines in
 SQLTABLE as follows.  These lines would follow line 1089.
 
 var_url=''
 if length(vars)  0:
for v in vars:
var_url += '' + v + '=' + vars[v]
 
 Then line 1091 would be changed from _href=th_link+'?orderby='+c to
 _href=th_link+'?orderby=' + c + var_url
 
 Please let me know if there is a better way to submit patches or to
 ensure that a proposed patch such as this has no unintended side
 effects.  And, of course, if others have a better way of solving this
 problem, please speak up.
 
 Regards,
 Philip
 
 
 




Re: [web2py] Login without using email id

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 1:49 PM, DJ wrote:

 I would like to set the auth method to use any username ('tom')
 instead of forcing an email id ('t...@something.com').
 
 How can I do this?

In the latest version, call define_tables(username=True). In earlier versions 
you have to create the user table manually; there's a discussion in the manual.

IIRC, if there's a username in the user table, it gets used by auth in 
preference to the email address.

Re: [web2py] Re: Proposed patch for SQLTABLE

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 2:14 PM, Yarko Tymciurak wrote:

 I am confused...  or missing something...
 
 On Apr 29, 3:35 pm, Philip philip.el...@gmail.com wrote:
 I'm not sure the patch submittal process, nor am I confident that my
 solution is the best way to solve the issue, but I'd like to propose a
 solution.
 
 Problem:
 * Situation: SQLTABLE with orderby=True is used on a URL that includes
 any variable. For example, URL is myapp.com/init/default/invoices?
 customer=Fred, and we'll say the table has three columns, Invoice
 number, Date, and Amount.
 * Bug: If you then click on one of the column headers in the table to
 sort the table, for example Amount, the resulting URL that gets called
 loses the variable. In this example, the resulting URL is myapp.com/
 init/default/invoices?orderby=Amount.  We have lost the customer
 variable we passed to the original URL.
 
 THe web is stateles;  two requests are not correlated - so I do not
 understand why this is a bug...
 
 response.vars holds all your responses from the client (browser) - it
 is up to your application to do something reasonable (i.e. preserve
 the value in a controller, if it's pertinent to the applicaiton).
 
 I do not see how / why this should be imposed on SQLTABLE you
 could certainly keep this in your table definition if you wanted
 
 Maybe I'm missing something...

I *think* what you're missing is that SQLTABLE's orderby link relies on state 
(the current URL) being held in the browser. Providing a relative URL as it 
does causes the browser to recycle the old URL with the new ?orderby=something 
appended to it. So the old a/c/f/args is implicitly preserved, but the old vars 
gets lost. Since SQLTABLE is creating the URL, it needs to support the 
preservation.

An alternative would be to put the extra information in args instead of vars.

At any rate, since SQLTABLE is creating the URL, it's got *some* responsibility 
for it.




 
 - Yakro
 * Relevant code: In the code visible here 
 -http://www.web2py.com/examples/static/epydoc/web2py.gluon.sqlhtml-pys...,
 the problem code is on line 1091,  _href=th_link+'?orderby=' + c
 
 Proposed Solution:
 I think this requires adding a parameter to SQLTABLE which holds the
 vars passed to the current URL. I'll call it :vars.  For simplicity,
 let's assume that vars always has the same form as request.vars, so
 that the canonical way of calling SQLTABLE in these circumstances in a
 controller is to add a parameter 'vars=request.vars'.  Since it only
 comes into play when orderby=True, we can insert a few lines in
 SQLTABLE as follows.  These lines would follow line 1089.
 
 var_url=''
 if length(vars)  0:
 for v in vars:
 var_url += '' + v + '=' + vars[v]
 
 Then line 1091 would be changed from _href=th_link+'?orderby='+c to
 _href=th_link+'?orderby=' + c + var_url
 
 Please let me know if there is a better way to submit patches or to
 ensure that a proposed patch such as this has no unintended side
 effects.  And, of course, if others have a better way of solving this
 problem, please speak up.
 
 Regards,
 Philip




Re: [web2py] Re: Proposed patch for SQLTABLE

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 2:06 PM, Philip wrote:

 Thadeus,
 I have noticed the same bug in appadmin, but unfortunately I do not
 believe this will help resolve that bug.

If you put the orderby in request.vars, then the next-page logic will be able 
to use it to do the right thing (caveat: I'm not looking at the code).

 -Philip
 
 On Apr 29, 4:49 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 29, 2010, at 1:43 PM, Thadeus Burgess wrote:
 
 There is also a bug in appadmin that when you sort you get the list
 sorted, but if you browse the next 100 records, the sorting reverses
 itself. Do you think this would fix that bug as well?
 
 Perhaps what you want to do is to append orderby=c to request.vars, and 
 generate the URL from there.
 
 Also, vars wants to be encoded. This is the logic from html.URL:
 
  '?%s' % urllib.urlencode(vars)
 
 It's not needed in the current code because we know a priori that there's 
 nothing to encode. But that's not true if we include request.vars.
 
 
 
 
 
 --
 Thadeus
 
 On Thu, Apr 29, 2010 at 3:35 PM, Philip philip.el...@gmail.com wrote:
 I'm not sure the patch submittal process, nor am I confident that my
 solution is the best way to solve the issue, but I'd like to propose a
 solution.
 
 Problem:
 * Situation: SQLTABLE with orderby=True is used on a URL that includes
 any variable. For example, URL is myapp.com/init/default/invoices?
 customer=Fred, and we'll say the table has three columns, Invoice
 number, Date, and Amount.
 * Bug: If you then click on one of the column headers in the table to
 sort the table, for example Amount, the resulting URL that gets called
 loses the variable. In this example, the resulting URL is myapp.com/
 init/default/invoices?orderby=Amount.  We have lost the customer
 variable we passed to the original URL.
 * Relevant code: In the code visible here -
 http://www.web2py.com/examples/static/epydoc/web2py.gluon.sqlhtml-pys...,
 the problem code is on line 1091,  _href=th_link+'?orderby=' + c
 
 Proposed Solution:
 I think this requires adding a parameter to SQLTABLE which holds the
 vars passed to the current URL. I'll call it :vars.  For simplicity,
 let's assume that vars always has the same form as request.vars, so
 that the canonical way of calling SQLTABLE in these circumstances in a
 controller is to add a parameter 'vars=request.vars'.  Since it only
 comes into play when orderby=True, we can insert a few lines in
 SQLTABLE as follows.  These lines would follow line 1089.
 
 var_url=''
 if length(vars)  0:
for v in vars:
var_url += '' + v + '=' + vars[v]
 
 Then line 1091 would be changed from _href=th_link+'?orderby='+c to
 _href=th_link+'?orderby=' + c + var_url
 
 Please let me know if there is a better way to submit patches or to
 ensure that a proposed patch such as this has no unintended side
 effects.  And, of course, if others have a better way of solving this
 problem, please speak up.
 
 Regards,
 Philip




Re: [web2py] Re: Proposed patch for SQLTABLE

2010-04-29 Thread Jonathan Lundell
On Apr 29, 2010, at 4:50 PM, Yarko Tymciurak wrote:

 I think this is about data containment.
 
 RIght now, there is coupling.
 
 That this bug took long to find suggests its at the periphery of the
 problem space (if it were smack-in-the-middle, lots of people would
 have already complained).
 
 But - if the bug (as it looks to me) is because of something gluon or
 SQLTABLE, specifically, should not be involved with (format, data
 passed around between app and client / view --- that's _way_ at the
 other end of where gluon should be),  then (in that terminology) your
 proposal takes an imperfectly (but innappropriately) coupled
 situation, and solves it by completing  / patching --- _increasing_
 the coupling.
 
 The fundamental problem wtih that: at some point, something else from
 the business-logic (i.e. controllers and models at the application
 level)  will change, and someone will _yet again_  have to patch a
 situation.
 
 I think the real solution shoudl be to look at what SQLTABLE is doing
 (in this case, sorting is DEFINITEVLY a view operation), and just _get
 out of that functionality all together_.
 
 While the motivation for making useful, common things easily available
 is good, and I have no problem with that, I think the positioning of
 where it is done needs to be adjusted.   This (in my mind) is calling
 loud and clear for a plugin.   Of course, a plugin could still be too
 coupled to your controller, so there is more structural stuff to think
 about here, but I suggest that a simple code / patch solution is
 probably not the right one here.
 
 Can anyone suggest how to pull sorting out of SQLTABLE into a plugin,
 and in a way that won't break backward compatability?

Another way of looking at this problem is that there's (inevitably, perhaps) 
too much functionality being packed into the URL. Or alternatively, *sharing* 
the URL. The linkto convention isn't really all that great either. Here's one 
hunk of it:

elif linkto and field.type == 'id':
try:
href = linkto(r, 'table', tablename)
except TypeError:
href = '%s/%s/%s' % (linkto, tablename, r_old)
r = A(r, _href=href)

If the linkto URL has vars in it, the string-interpolation version of this is 
going to break, because tablename and whatever r_old is are going to get tacked 
on the end of the vars. The lambda form might be salvageable (and maybe that's 
the solution), but since the controller's 'business logic' needs to share the 
URL with SQLTABLE, somehow that sharing needs to be coordinated. 

Re: [web2py] Disabling few functions for certain users

2010-04-30 Thread Jonathan Lundell
On Apr 30, 2010, at 7:22 AM, Thadeus Burgess wrote:

 You need to store the preferences in the database, what seems to be
 happening is you are setting the disabled actions, but its being lost
 on the next request.
 
 So along with your auth_user table you probably need to add a couple
 boolean columns to disable these options, this way it is persistant.

Unless I'm missing something, this seems like a natural application for 
web2py's roles and permissions. If so, Rohan can look at chapter 8 of the book: 
http://web2py.com/book/default/section/8/0. I use it to divide my users into 3 
roles, and it's very straightforward to implement.

 
 But for normal users they can still retrieve_password and
 change_password, so you need to check this before you call the auth
 form.
 
 def user():
# get the user token here, use request.args to determine URL (ie:
 user/reset_password)
# then pull the user from the database using the email/username
 
if my_user.retrieve_password_disabled:
   auth.settings.actions_disabled.append('retrieve_password')
 
return dict(form=auth())
 
 --
 Thadeus
 
 
 
 
 
 On Fri, Apr 30, 2010 at 1:15 AM, Rohan yourbuddyro...@gmail.com wrote:
 Hi All,
 
 I am creating a session for a user logged in from facebook and wants
 to disable certain functions like retrieve_password, change_password
 etc. here is the code for this
 
if not auth.is_logged_in():
user_obj = Storage(user_table._filter_fields(user,
 id=True))
#print 'user is not logged in'
session.auth = Storage(user=user_obj,
 last_visit=request.now, expiration=auth.settings.expiration)
auth.user = user_obj
auth.settings.actions_disabled.append('retrieve_password')
auth.settings.actions_disabled.append('change_password')
 
 but user is still able to access these functions. As an alternate, I
 was thinking of creating a group for facebook users and disable these
 functions at group level. Is this feasible? Is there any simpler way
 without need to create user groups?
 
 Thanks
 




<    1   2   3   4   5   6   7   8   9   10   >