Re: [web2py] Re: crud delete weird behavior (on GAE at least)

2010-02-26 Thread Miguel Goncalves
I just saw that 1.75.5 is out.
Since it has : "fixed problem with GAE deleted by id (thanks what_ho)"

Do you think it is related or is this to fix the count vs len issue?

In any case I will try it tomorrow morning.

Thanks
Miguel

On Thu, Feb 25, 2010 at 3:33 PM, Miguel Goncalves  wrote:

> Hi
>
> I attached a modified "welcome" application that reproduces the problem.
>
> To repro:
> - create a user
> - login
> - click on the "list Stats" link (top left of the page)
> - add few stats. You will see the stats you add get listed on the same
> page.
> - click on the link "Delete stat"
> You should now see the error.
>
> Thanks
> Miguel
>
>
> On Tue, Feb 23, 2010 at 8:32 PM, mdipierro wrote:
>
>> I think:
>>
>> 1. Run "appcfg.py vacuum_indexes your_app_dir/"
>> 2. Run "appcfg.py update_indexes your_app_dir/"
>>
>> On Feb 23, 10:23 pm, Miguel Goncalves 
>> wrote:
>> > How do I do that?
>> >
>> > On Tue, Feb 23, 2010 at 7:09 PM, mdipierro 
>> wrote:
>> > > I would try delete and rebuild indices.
>> >
>> > > On Feb 23, 7:54 pm, Miguel Goncalves 
>> > > wrote:
>> > > > Yes I tried to upload it to GAE but I ran into the missing indexes
>> issue.
>> > > So
>> > > > I was trying to run the app locally to generate the required indexes
>> and
>> > > be
>> > > > able to run on the live GAE. :(
>> >
>> > > > I have the issue on the dev server. This used to work and I have no
>> clue
>> > > > what could have broken it. I believe the only thing I did was to
>> update
>> > > GAE
>> > > > to the latest sdk.
>> >
>> > > > Debugging the app a little bit further I found the place where the
>> > > exception
>> > > > is raised:
>> >
>> > > > class Table
>> > > >  def __delitem__(self, key):
>> > > > if not str(key).isdigit() or not self._db(self.id ==
>> > > key).delete():
>> > > > raise SyntaxError, 'No such record: %s' % key
>> >
>> > > > However the table does contain a record equal to key.
>> > > > What  gives?
>> >
>> > > > Thanks
>> > > > Miguel
>> >
>> > > > On Tue, Feb 23, 2010 at 11:04 AM, Wes James 
>> wrote:
>> > > > > Have you uploaded your app to gae and tested it there?
>> >
>> > > > > -wes
>> >
>> > > > > On Tue, Feb 23, 2010 at 10:57 AM, Miguel Goncalves
>> > > > >  wrote:
>> > > > > > Anybody run into a similar issue?
>> > > > > > I cannot seem to figure it out. :(
>> >
>> > > > > > Thanks
>> > > > > > -Miguel
>> >
>> > > > > > On Mon, Feb 22, 2010 at 6:09 PM, Miguel <
>> goncalvesmig...@gmail.com>
>> > > > > wrote:
>> >
>> > > > > >> Hi
>> >
>> > > > > >> I implemented the following function to delete an entry in a
>> db:
>> >
>> > > > > >> @auth.requires_login()
>> > > > > >> def DeleteSite():
>> > > > > >>msg = T("Cannot delete specified record.")
>> > > > > >>try:
>> > > > > >>record_id = request.vars['id']
>> > > > > >>next_page = request.vars['next']
>> > > > > >>except:
>> > > > > >>response.flash = msg
>> > > > > >>return dict( message=msg)
>> >
>> > > > > >>if record_id is None or next_page is None or
>> len(next_page)
>> > > == 0:
>> > > > > >>response.flash = msg
>> > > > > >>return dict( message=msg)
>> >
>> > > > > >>crud.delete(db.sites,record_id,
>> > > next=URL(r=request,f=next_page))
>> >
>> > > > > >> It gets invoked like this (local server on GAE):
>> > > > > >>
>> http://127.0.0.1:8081/mlinks/default/DeleteSite?id=388&next=MySites
>> >
>> > > > > >> This used to work nicely however now when this gets invoked,
>> the
>> > > item
>> > > > > >> gets deleted from the database BUT I get a ticket error:
>> >
>> > > > > >> Error traceback
>> >
>> > > > > >> Traceback (most recent call last):
>> > > > > >>  File "C:\web2py\gluon\restricted.py", line 173, in restricted
>> > > > > >>exec ccode in environment
>> > > > > >>  File "C:\web2py\applications\mlinks/controllers/
>> > > > > >> default.py:DeleteSite", line 164, in 
>> > > > > >>  File "C:\web2py\gluon\globals.py", line 96, in 
>> > > > > >>self._caller = lambda f: f()
>> > > > > >>  File "C:\web2py\gluon\tools.py", line 1848, in f
>> > > > > >>return action(*a, **b)
>> > > > > >>  File "C:\web2py\applications\mlinks/controllers/
>> > > > > >> default.py:DeleteSite", line 130, in DeleteSite
>> > > > > >>  File "C:\web2py\gluon\tools.py", line 2377, in delete
>> > > > > >>del table[record_id]
>> > > > > >>  File "C:\web2py\gluon\sql.py", line 1545, in __delitem__
>> > > > > >>raise SyntaxError, 'No such record: %s' % key
>> > > > > >> SyntaxError: No such record: 388
>> >
>> > > > > >> Before invoking the delete I made sure the entry I wanted to
>> delete
>> > > > > >> was indeed in the DB.
>> > > > > >> After the error the correct entry  has been deleted.
>> >
>> > > > > >> It is like the delete is being called twice!
>> > > > > >> Any idea of what might be causing this?
>> >
>> > > > > >> thanks
>> > > > > >> Miguel
>> >
>> > > > > >> --
>> > > > > >> You received this me

[web2py] Re: datagrid with cell styles - any examples?

2010-02-26 Thread mdipierro
I do not know if this helps but perhaps something like this?

jQuery('tr').each(function(this){var a=jQuery(this).child('td:eq(1)');
if(parseFloat(a.html())<0) a.css('color','red')});

1 is the col number

On Feb 26, 1:23 am, BrendanC  wrote:
> Massimo,
> Thx for the response - however that's the html table approach (not
> what I would call a real datagrid).
>
> I was really looking for a more dynamic/Web 2.0 approach using a
> browser based ( jquery/other)  datagrid. I was envisioning returning
> data in json format and then having that rendered in a client/browser
> grid control. A datagrid would allow a user to click on column header
> and sort the data (w/o sending a server refresh request).
>
> Since the presentation style is dictated by business rules ( e.g.
> rules for overdue book, payments etc can vary) assigning a css style
> to each cell in the view may make sense - however I'm not sure how
> that could work with json/jquery. Maybe I'm on a fool's errand here,
> but I've done this a lot with client/server and desktop apps ( and
> with Adobe Flex/Actionscript) , but I have not seen a (non HTML)
> browser implementation of this.
>
> Any further thoughts?
>
> On Feb 25, 10:07 pm, mdipierro  wrote:
>
> > I think this is transparent to jquery. Something like this?
>
> > #Model
> > db.define_table('person',Field('name'),Field('balance','double'))
>
> > #controller
> > def index(): return dict(people=db().select(db.person.ALL))
>
> > #view
> > {{extend 'layout.html'}}
> > 
> > .red { backrgound-color: red; }
> > .green {background-color: green; }
> > 
> > 
> >   {{for p in people:}}
> >   
> >      {{=p.name}}
> >      {{=p.balance}} > td>
> >   
> >   {{pass}}
> > 
>
> > On Feb 25, 11:57 pm, BrendanC  wrote:
>
> > > I'm interested in building a web2py demo that show color coded data in
> > > a (jquery?) datagrid. Ideally cells would be  color coded based on the
> > > underlying data value (e.g. neg values, overdue dates etc. in red).
> > > This type of display is pretty common in desktop apps, spreadsheets
> > > etc. but I have not found any web based examples ( which seems a bit
> > > odd - not sure why ).
>
> > > Are there any web2py examples of something like this?
>
> > > TIA,
> > > Brendan

-- 
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] Re: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread mdipierro
The fact is the web server may be restarting the process or running
more than one process. Apache does the same. In this case you should
use cache.disk, not cache.ram.

On Feb 26, 1:34 am, szimszon  wrote:
> Hello!
>
> I wonder if somebody could it confirm:
>
> I have a db:
> --- cut 
> db.define_table('guestbook',
>                 Field('email','string',
>                       label=T("E-Mail"),
>                       requires=IS_EMAIL()),
>                 Field('nick','string',
>                       label=T("Nickname"),
>                       requires=IS_NOT_EMPTY()),
>                 Field('ts','datetime',
>                       label=T("Date"),
>                       default=request.now,
>                       writable=False,
>                       readable=False),
>                 Field('text','string',
>                       label=T("Text"),
>                       requires=IS_NOT_EMPTY()),
> )
> --- cut 
>
> A controller:
> --- cut 
> def flush_cache(form=None):
>     cache.ram.clear()
>
> def vendegkonyv():
>     lista=None
>     if (( auth.user_id==1 ) and (request.vars.r)):
>
> form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cache)
>     else:
>         form=SQLFORM(db.guestbook,onaccept=flush_cache)
>     #form=SQLFORM.factory()
>     if not auth.user_id:
>         form[0].append(Recaptcha(request,
>                                  "...",
>                                  "..."))
>     if form.accepts(request.vars, session):
>         response.flash = "Record updated"
>         flush_cache()
>     elif form.errors:
>         response.flash = "Error"
>         flush_cache()
>
>     try:
>         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
>                                            cache=(cache.ram,120))
>     except:
>         pass
>     return dict(form=form,lista=lista)
> --- cut 
>
> And a view:
> --- cut 
> {{extend 'layout.html'}}
>
> GuestBook
> 
> {{=form}}
> 
> {{if lista:}}
> 
>   
>     {{=db.guestbook.ts.label}}
>     {{=db.guestbook.nick.label}}
>     {{=db.guestbook.text.label}}
>   
> {{for elem in lista:}}
>   
>     
>       {{if (auth.user_id==1):}}
>
> {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
>       {{else:}}
>         {{=elem.ts}}
>       {{pass}}
>     
>     {{=elem.nick}}
>     {{=elem.text}}
>   
> {{pass}}
> 
> --- cut 
>
> With the cherrypy isn't a problem but with apache2 and wsgi:
>
> 1, I make 3-4 post to the guest book
> 2, delete them
> 3, reload the page with a link on page pointing to self to guestbook
>
> I see 0 to 3-4 post on each click randomly which are nonexistent posts
> anymore :(

-- 
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] Re: request.vars bug?

2010-02-26 Thread mdipierro
The next stable version 1.75.5 is out and includes your fix

On Feb 26, 1:58 am, Ben  wrote:
> At this stage I've just patched my current version of gluon/main.py as
> it was only a two line change. I can confirm that everything works now
> as it should.
>
> I will upgrade when the next stable version is available.
> Cheers,
> - Ben.
>
> On Feb 26, 4:34 pm, mdipierro  wrote:
>
> > I will post a new stable version soon.
>
> > Massimo
>
> > On Feb 25, 11:20 pm, Ben  wrote:
>
> > > Ah excellent, thanks very much indeed!
> > > I guess I should update to trunk now...
> > > Thanks again!
> > > - Ben.
>
> > > On Feb 26, 4:18 pm, mdipierro  wrote:
>
> > > > I can reproduce it. It is a major bug in web2py. I fixed it in trunk
> > > > just now.
> > > > Thanks for reporting this problem.
>
> > > > The problem is that except for the first value '51' all other values
> > > > with the same keys where being broken into chars and the chars would
> > > > be appended.
>
> > > > On Feb 25, 10:06 pm, Ben  wrote:
>
> > > > > Hi all,
> > > > > I have a URL like the following:
> > > > > feature_reading?
> > > > > feature_id=15&sensor_id=51&sensor_id=52&sensor_id2&sensor_id=53&sensor_id=5
> > > > >  4
>
> > > > > however, when I try to extract the sensor_id vars at the other end, i
> > > > > get a list as such:
> > > > > ['51', '5', '2', '5', '3', '5', '4']
>
> > > > > anyone had this problem before?

-- 
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] Re: crud delete weird behavior (on GAE at least)

2010-02-26 Thread mdipierro
I am a bit confused myself and I have low bandwidth to search the
thread. Please let me know if there is a problem still.

On Feb 26, 2:03 am, Miguel Goncalves 
wrote:
> I just saw that 1.75.5 is out.
> Since it has : "fixed problem with GAE deleted by id (thanks what_ho)"
>
> Do you think it is related or is this to fix the count vs len issue?
>
> In any case I will try it tomorrow morning.
>
> Thanks
> Miguel
>
> On Thu, Feb 25, 2010 at 3:33 PM, Miguel Goncalves 
> > wrote:
> > Hi
>
> > I attached a modified "welcome" application that reproduces the problem.
>
> > To repro:
> > - create a user
> > - login
> > - click on the "list Stats" link (top left of the page)
> > - add few stats. You will see the stats you add get listed on the same
> > page.
> > - click on the link "Delete stat"
> > You should now see the error.
>
> > Thanks
> > Miguel
>
> > On Tue, Feb 23, 2010 at 8:32 PM, mdipierro wrote:
>
> >> I think:
>
> >> 1. Run "appcfg.py vacuum_indexes your_app_dir/"
> >> 2. Run "appcfg.py update_indexes your_app_dir/"
>
> >> On Feb 23, 10:23 pm, Miguel Goncalves 
> >> wrote:
> >> > How do I do that?
>
> >> > On Tue, Feb 23, 2010 at 7:09 PM, mdipierro 
> >> wrote:
> >> > > I would try delete and rebuild indices.
>
> >> > > On Feb 23, 7:54 pm, Miguel Goncalves 
> >> > > wrote:
> >> > > > Yes I tried to upload it to GAE but I ran into the missing indexes
> >> issue.
> >> > > So
> >> > > > I was trying to run the app locally to generate the required indexes
> >> and
> >> > > be
> >> > > > able to run on the live GAE. :(
>
> >> > > > I have the issue on the dev server. This used to work and I have no
> >> clue
> >> > > > what could have broken it. I believe the only thing I did was to
> >> update
> >> > > GAE
> >> > > > to the latest sdk.
>
> >> > > > Debugging the app a little bit further I found the place where the
> >> > > exception
> >> > > > is raised:
>
> >> > > > class Table
> >> > > >  def __delitem__(self, key):
> >> > > >         if not str(key).isdigit() or not self._db(self.id ==
> >> > > key).delete():
> >> > > >             raise SyntaxError, 'No such record: %s' % key
>
> >> > > > However the table does contain a record equal to key.
> >> > > > What  gives?
>
> >> > > > Thanks
> >> > > > Miguel
>
> >> > > > On Tue, Feb 23, 2010 at 11:04 AM, Wes James 
> >> wrote:
> >> > > > > Have you uploaded your app to gae and tested it there?
>
> >> > > > > -wes
>
> >> > > > > On Tue, Feb 23, 2010 at 10:57 AM, Miguel Goncalves
> >> > > > >  wrote:
> >> > > > > > Anybody run into a similar issue?
> >> > > > > > I cannot seem to figure it out. :(
>
> >> > > > > > Thanks
> >> > > > > > -Miguel
>
> >> > > > > > On Mon, Feb 22, 2010 at 6:09 PM, Miguel <
> >> goncalvesmig...@gmail.com>
> >> > > > > wrote:
>
> >> > > > > >> Hi
>
> >> > > > > >> I implemented the following function to delete an entry in a
> >> db:
>
> >> > > > > >> @auth.requires_login()
> >> > > > > >> def DeleteSite():
> >> > > > > >>        msg = T("Cannot delete specified record.")
> >> > > > > >>        try:
> >> > > > > >>                record_id = request.vars['id']
> >> > > > > >>                next_page = request.vars['next']
> >> > > > > >>        except:
> >> > > > > >>                response.flash = msg
> >> > > > > >>                return dict( message=msg)
>
> >> > > > > >>        if record_id is None or next_page is None or
> >> len(next_page)
> >> > > == 0:
> >> > > > > >>                response.flash = msg
> >> > > > > >>                return dict( message=msg)
>
> >> > > > > >>        crud.delete(db.sites,record_id,
> >> > > next=URL(r=request,f=next_page))
>
> >> > > > > >> It gets invoked like this (local server on GAE):
>
> >>http://127.0.0.1:8081/mlinks/default/DeleteSite?id=388&next=MySites
>
> >> > > > > >> This used to work nicely however now when this gets invoked,
> >> the
> >> > > item
> >> > > > > >> gets deleted from the database BUT I get a ticket error:
>
> >> > > > > >> Error traceback
>
> >> > > > > >> Traceback (most recent call last):
> >> > > > > >>  File "C:\web2py\gluon\restricted.py", line 173, in restricted
> >> > > > > >>    exec ccode in environment
> >> > > > > >>  File "C:\web2py\applications\mlinks/controllers/
> >> > > > > >> default.py:DeleteSite", line 164, in 
> >> > > > > >>  File "C:\web2py\gluon\globals.py", line 96, in 
> >> > > > > >>    self._caller = lambda f: f()
> >> > > > > >>  File "C:\web2py\gluon\tools.py", line 1848, in f
> >> > > > > >>    return action(*a, **b)
> >> > > > > >>  File "C:\web2py\applications\mlinks/controllers/
> >> > > > > >> default.py:DeleteSite", line 130, in DeleteSite
> >> > > > > >>  File "C:\web2py\gluon\tools.py", line 2377, in delete
> >> > > > > >>    del table[record_id]
> >> > > > > >>  File "C:\web2py\gluon\sql.py", line 1545, in __delitem__
> >> > > > > >>    raise SyntaxError, 'No such record: %s' % key
> >> > > > > >> SyntaxError: No such record: 388
>
> >> > > > > >> Before invoking the delete I made sure the entry I wanted to
> >> delete
> >> >

[web2py] Recaptcha doesn't play nice with crud

2010-02-26 Thread szimszon
Hello!

Sorry for the lot messages :-o

I have a controller:

def captcha():
form=crud.create(db.mytable)
form[0].append(Recaptcha(request,"","..."))
return dict(form=form)

but the validation is always succeed...

I have 2 errors on javascript console (chrome) but I don't know if it
is significant:

[The HTML that caused this error was generated by a script.]  is
not allowed inside . Inserting  before the 
instead.

 is not allowed inside . Inserting  before
the  instead.
-- cut ---
form:Myfield: https://api-secure.recaptcha.net/challenge?
k=6LeacwsAAA401GAmoDdAE1ph_kHj_wvT7pJA">
[The HTML that caused this error was generated by a script.]  is
not allowed inside . Inserting  before the 
instead.

 is not allowed inside . Inserting  before
the  instead.
https://api-secure.recaptcha.net/noscript?
k=6LeacwsAAA401GAmoDdAE1ph_kHj_wvT7pJA" height="300" width="500"
frameborder="0">




-- cut ---

-- 
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] Re: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread szimszon
Okay. It looks good now. Thanks for the prompt replay.

But if I understand well than the cache.ram is useless all the time
apache is used?

On febr. 26, 09:10, mdipierro  wrote:
> The fact is the web server may be restarting the process or running
> more than one process. Apache does the same. In this case you should
> use cache.disk, not cache.ram.
>
> On Feb 26, 1:34 am, szimszon  wrote:
>
>
>
> > Hello!
>
> > I wonder if somebody could it confirm:
>
> > I have a db:
> > --- cut 
> > db.define_table('guestbook',
> >                 Field('email','string',
> >                       label=T("E-Mail"),
> >                       requires=IS_EMAIL()),
> >                 Field('nick','string',
> >                       label=T("Nickname"),
> >                       requires=IS_NOT_EMPTY()),
> >                 Field('ts','datetime',
> >                       label=T("Date"),
> >                       default=request.now,
> >                       writable=False,
> >                       readable=False),
> >                 Field('text','string',
> >                       label=T("Text"),
> >                       requires=IS_NOT_EMPTY()),
> > )
> > --- cut 
>
> > A controller:
> > --- cut 
> > def flush_cache(form=None):
> >     cache.ram.clear()
>
> > def vendegkonyv():
> >     lista=None
> >     if (( auth.user_id==1 ) and (request.vars.r)):
>
> > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach 
> > e)
> >     else:
> >         form=SQLFORM(db.guestbook,onaccept=flush_cache)
> >     #form=SQLFORM.factory()
> >     if not auth.user_id:
> >         form[0].append(Recaptcha(request,
> >                                  "...",
> >                                  "..."))
> >     if form.accepts(request.vars, session):
> >         response.flash = "Record updated"
> >         flush_cache()
> >     elif form.errors:
> >         response.flash = "Error"
> >         flush_cache()
>
> >     try:
> >         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
> >                                            cache=(cache.ram,120))
> >     except:
> >         pass
> >     return dict(form=form,lista=lista)
> > --- cut 
>
> > And a view:
> > --- cut 
> > {{extend 'layout.html'}}
>
> > GuestBook
> > 
> > {{=form}}
> > 
> > {{if lista:}}
> > 
> >   
> >     {{=db.guestbook.ts.label}}
> >     {{=db.guestbook.nick.label}}
> >     {{=db.guestbook.text.label}}
> >   
> > {{for elem in lista:}}
> >   
> >     
> >       {{if (auth.user_id==1):}}
>
> > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
> >       {{else:}}
> >         {{=elem.ts}}
> >       {{pass}}
> >     
> >     {{=elem.nick}}
> >     {{=elem.text}}
> >   
> > {{pass}}
> > 
> > --- cut 
>
> > With the cherrypy isn't a problem but with apache2 and wsgi:
>
> > 1, I make 3-4 post to the guest book
> > 2, delete them
> > 3, reload the page with a link on page pointing to self to guestbook
>
> > I see 0 to 3-4 post on each click randomly which are nonexistent posts
> > anymore :(

-- 
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] Re: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread mdipierro
it is not useless. It works of if you run only one wsgi process but
cache lives only within the lifetime of the process.

On Feb 26, 2:32 am, szimszon  wrote:
> Okay. It looks good now. Thanks for the prompt replay.
>
> But if I understand well than the cache.ram is useless all the time
> apache is used?
>
> On febr. 26, 09:10, mdipierro  wrote:
>
> > The fact is the web server may be restarting the process or running
> > more than one process. Apache does the same. In this case you should
> > use cache.disk, not cache.ram.
>
> > On Feb 26, 1:34 am, szimszon  wrote:
>
> > > Hello!
>
> > > I wonder if somebody could it confirm:
>
> > > I have a db:
> > > --- cut 
> > > db.define_table('guestbook',
> > >                 Field('email','string',
> > >                       label=T("E-Mail"),
> > >                       requires=IS_EMAIL()),
> > >                 Field('nick','string',
> > >                       label=T("Nickname"),
> > >                       requires=IS_NOT_EMPTY()),
> > >                 Field('ts','datetime',
> > >                       label=T("Date"),
> > >                       default=request.now,
> > >                       writable=False,
> > >                       readable=False),
> > >                 Field('text','string',
> > >                       label=T("Text"),
> > >                       requires=IS_NOT_EMPTY()),
> > > )
> > > --- cut 
>
> > > A controller:
> > > --- cut 
> > > def flush_cache(form=None):
> > >     cache.ram.clear()
>
> > > def vendegkonyv():
> > >     lista=None
> > >     if (( auth.user_id==1 ) and (request.vars.r)):
>
> > > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach
> > >  e)
> > >     else:
> > >         form=SQLFORM(db.guestbook,onaccept=flush_cache)
> > >     #form=SQLFORM.factory()
> > >     if not auth.user_id:
> > >         form[0].append(Recaptcha(request,
> > >                                  "...",
> > >                                  "..."))
> > >     if form.accepts(request.vars, session):
> > >         response.flash = "Record updated"
> > >         flush_cache()
> > >     elif form.errors:
> > >         response.flash = "Error"
> > >         flush_cache()
>
> > >     try:
> > >         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
> > >                                            cache=(cache.ram,120))
> > >     except:
> > >         pass
> > >     return dict(form=form,lista=lista)
> > > --- cut 
>
> > > And a view:
> > > --- cut 
> > > {{extend 'layout.html'}}
>
> > > GuestBook
> > > 
> > > {{=form}}
> > > 
> > > {{if lista:}}
> > > 
> > >   
> > >     {{=db.guestbook.ts.label}}
> > >     {{=db.guestbook.nick.label}}
> > >     {{=db.guestbook.text.label}}
> > >   
> > > {{for elem in lista:}}
> > >   
> > >     
> > >       {{if (auth.user_id==1):}}
>
> > > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
> > >       {{else:}}
> > >         {{=elem.ts}}
> > >       {{pass}}
> > >     
> > >     {{=elem.nick}}
> > >     {{=elem.text}}
> > >   
> > > {{pass}}
> > > 
> > > --- cut 
>
> > > With the cherrypy isn't a problem but with apache2 and wsgi:
>
> > > 1, I make 3-4 post to the guest book
> > > 2, delete them
> > > 3, reload the page with a link on page pointing to self to guestbook
>
> > > I see 0 to 3-4 post on each click randomly which are nonexistent posts
> > > anymore :(

-- 
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] Re: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread szimszon
I see, thanks.

On febr. 26, 09:42, mdipierro  wrote:
> it is not useless. It works of if you run only one wsgi process but
> cache lives only within the lifetime of the process.
>
> On Feb 26, 2:32 am, szimszon  wrote:
>
>
>
> > Okay. It looks good now. Thanks for the prompt replay.
>
> > But if I understand well than the cache.ram is useless all the time
> > apache is used?
>
> > On febr. 26, 09:10, mdipierro  wrote:
>
> > > The fact is the web server may be restarting the process or running
> > > more than one process. Apache does the same. In this case you should
> > > use cache.disk, not cache.ram.
>
> > > On Feb 26, 1:34 am, szimszon  wrote:
>
> > > > Hello!
>
> > > > I wonder if somebody could it confirm:
>
> > > > I have a db:
> > > > --- cut 
> > > > db.define_table('guestbook',
> > > >                 Field('email','string',
> > > >                       label=T("E-Mail"),
> > > >                       requires=IS_EMAIL()),
> > > >                 Field('nick','string',
> > > >                       label=T("Nickname"),
> > > >                       requires=IS_NOT_EMPTY()),
> > > >                 Field('ts','datetime',
> > > >                       label=T("Date"),
> > > >                       default=request.now,
> > > >                       writable=False,
> > > >                       readable=False),
> > > >                 Field('text','string',
> > > >                       label=T("Text"),
> > > >                       requires=IS_NOT_EMPTY()),
> > > > )
> > > > --- cut 
>
> > > > A controller:
> > > > --- cut 
> > > > def flush_cache(form=None):
> > > >     cache.ram.clear()
>
> > > > def vendegkonyv():
> > > >     lista=None
> > > >     if (( auth.user_id==1 ) and (request.vars.r)):
>
> > > > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach
> > > >  e)
> > > >     else:
> > > >         form=SQLFORM(db.guestbook,onaccept=flush_cache)
> > > >     #form=SQLFORM.factory()
> > > >     if not auth.user_id:
> > > >         form[0].append(Recaptcha(request,
> > > >                                  "...",
> > > >                                  "..."))
> > > >     if form.accepts(request.vars, session):
> > > >         response.flash = "Record updated"
> > > >         flush_cache()
> > > >     elif form.errors:
> > > >         response.flash = "Error"
> > > >         flush_cache()
>
> > > >     try:
> > > >         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
> > > >                                            cache=(cache.ram,120))
> > > >     except:
> > > >         pass
> > > >     return dict(form=form,lista=lista)
> > > > --- cut 
>
> > > > And a view:
> > > > --- cut 
> > > > {{extend 'layout.html'}}
>
> > > > GuestBook
> > > > 
> > > > {{=form}}
> > > > 
> > > > {{if lista:}}
> > > > 
> > > >   
> > > >     {{=db.guestbook.ts.label}}
> > > >     {{=db.guestbook.nick.label}}
> > > >     {{=db.guestbook.text.label}}
> > > >   
> > > > {{for elem in lista:}}
> > > >   
> > > >     
> > > >       {{if (auth.user_id==1):}}
>
> > > > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
> > > >       {{else:}}
> > > >         {{=elem.ts}}
> > > >       {{pass}}
> > > >     
> > > >     {{=elem.nick}}
> > > >     {{=elem.text}}
> > > >   
> > > > {{pass}}
> > > > 
> > > > --- cut 
>
> > > > With the cherrypy isn't a problem but with apache2 and wsgi:
>
> > > > 1, I make 3-4 post to the guest book
> > > > 2, delete them
> > > > 3, reload the page with a link on page pointing to self to guestbook
>
> > > > I see 0 to 3-4 post on each click randomly which are nonexistent posts
> > > > anymore :(

-- 
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] Re: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread Graham Dumpleton
For a further explanation of different modes you can run application
under with Apache/mod_wsgi read:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

Graham

On Feb 26, 7:42 pm, mdipierro  wrote:
> it is not useless. It works of if you run only one wsgi process but
> cache lives only within the lifetime of the process.
>
> On Feb 26, 2:32 am, szimszon  wrote:
>
>
>
> > Okay. It looks good now. Thanks for the prompt replay.
>
> > But if I understand well than the cache.ram is useless all the time
> > apache is used?
>
> > On febr. 26, 09:10, mdipierro  wrote:
>
> > > The fact is the web server may be restarting the process or running
> > > more than one process. Apache does the same. In this case you should
> > > use cache.disk, not cache.ram.
>
> > > On Feb 26, 1:34 am, szimszon  wrote:
>
> > > > Hello!
>
> > > > I wonder if somebody could it confirm:
>
> > > > I have a db:
> > > > --- cut 
> > > > db.define_table('guestbook',
> > > >                 Field('email','string',
> > > >                       label=T("E-Mail"),
> > > >                       requires=IS_EMAIL()),
> > > >                 Field('nick','string',
> > > >                       label=T("Nickname"),
> > > >                       requires=IS_NOT_EMPTY()),
> > > >                 Field('ts','datetime',
> > > >                       label=T("Date"),
> > > >                       default=request.now,
> > > >                       writable=False,
> > > >                       readable=False),
> > > >                 Field('text','string',
> > > >                       label=T("Text"),
> > > >                       requires=IS_NOT_EMPTY()),
> > > > )
> > > > --- cut 
>
> > > > A controller:
> > > > --- cut 
> > > > def flush_cache(form=None):
> > > >     cache.ram.clear()
>
> > > > def vendegkonyv():
> > > >     lista=None
> > > >     if (( auth.user_id==1 ) and (request.vars.r)):
>
> > > > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach
> > > >  e)
> > > >     else:
> > > >         form=SQLFORM(db.guestbook,onaccept=flush_cache)
> > > >     #form=SQLFORM.factory()
> > > >     if not auth.user_id:
> > > >         form[0].append(Recaptcha(request,
> > > >                                  "...",
> > > >                                  "..."))
> > > >     if form.accepts(request.vars, session):
> > > >         response.flash = "Record updated"
> > > >         flush_cache()
> > > >     elif form.errors:
> > > >         response.flash = "Error"
> > > >         flush_cache()
>
> > > >     try:
> > > >         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
> > > >                                            cache=(cache.ram,120))
> > > >     except:
> > > >         pass
> > > >     return dict(form=form,lista=lista)
> > > > --- cut 
>
> > > > And a view:
> > > > --- cut 
> > > > {{extend 'layout.html'}}
>
> > > > GuestBook
> > > > 
> > > > {{=form}}
> > > > 
> > > > {{if lista:}}
> > > > 
> > > >   
> > > >     {{=db.guestbook.ts.label}}
> > > >     {{=db.guestbook.nick.label}}
> > > >     {{=db.guestbook.text.label}}
> > > >   
> > > > {{for elem in lista:}}
> > > >   
> > > >     
> > > >       {{if (auth.user_id==1):}}
>
> > > > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
> > > >       {{else:}}
> > > >         {{=elem.ts}}
> > > >       {{pass}}
> > > >     
> > > >     {{=elem.nick}}
> > > >     {{=elem.text}}
> > > >   
> > > > {{pass}}
> > > > 
> > > > --- cut 
>
> > > > With the cherrypy isn't a problem but with apache2 and wsgi:
>
> > > > 1, I make 3-4 post to the guest book
> > > > 2, delete them
> > > > 3, reload the page with a link on page pointing to self to guestbook
>
> > > > I see 0 to 3-4 post on each click randomly which are nonexistent posts
> > > > anymore :(

-- 
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] Re: web2py 1.75.5 is OUT

2010-02-26 Thread KMax


On 26 фев, 12:09, mdipierro  wrote:
> Changelog #1.75.5
>
> fixed behaviour with languages.py, thanks Iceberg
I had an issue with shifting translation.
a=a
b=b
c=c
become
a=a
b=c
c=
Does this issue fixed or something else?

-- 
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] Re: web2py 1.75.5 is OUT

2010-02-26 Thread mdipierro
Probably not because I cannot reproduce the problem.
I need an example to be able to reproduce it.

Massimo

On Feb 26, 4:28 am, KMax  wrote:
> On 26 фев, 12:09, mdipierro  wrote:> Changelog 
> #1.75.5
>
> > fixed behaviour with languages.py, thanks Iceberg
>
> I had an issue with shifting translation.
> a=a
> b=b
> c=c
> become
> a=a
> b=c
> c=
> Does this issue fixed or something else?

-- 
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: importing local modules

2010-02-26 Thread Tiago Almeida
Allow me to hijack this thread for a related question.

How do you usually import a module from a module. I've tried using
local_import but I had problems (don't remember details) so I solved the
problem by hardcoding the path like 'applications./modules/...' but
don't like it.
Can local_import do this and I used it incorrectly?

Thanks a lot in advance.

Best regards,
Tiago
--

On Fri, Feb 26, 2010 at 2:11 AM, Thadeus Burgess wrote:

> Done.
>
> -Thadeus
>
>
>
>
>
> On Thu, Feb 25, 2010 at 7:06 PM, Jonathan Lundell 
> wrote:
> > On Feb 25, 2010, at 4:19 PM, mr.freeze wrote:
> >
> >> Just do: dt = local_import('datatables')
> >
> > Thanks. Maybe the book should reflect this:
> http://web2py.com/book/default/section/4/18
> >
> > (I'd make the change, but I'm a little fuzzy on the details.)
> >
> >>
> >> On Feb 25, 6:11 pm, Jonathan Lundell  wrote:
> >>> I've made a module that does a nice job, if I do say so myself, of
> encapsulating DataTables (I'll post something about it eventually).
> >>>
> >>> Since it's a module, I need to import it to my controller, which I'm
> doing like so:
> >>>
> >>> import sys
> >>> sys.path.append(request.folder)
> >>> import modules.datatables as dt
> >>>
> >>> My question: is there a better way to manage this? At first I was
> building the import path all the way from the web2py base, but I didn't want
> to include the literal application name.
> >
> >
> > --
> > 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.



[web2py] Re: web2py 1.75.5 is OUT

2010-02-26 Thread Iceberg
How about this?  http://groups.google.com/group/web2py/msg/94ab1188910ae303

On Feb26, 6:44pm, mdipierro  wrote:
> Probably not because I cannot reproduce the problem.
> I need an example to be able to reproduce it.
>
> Massimo
>
> On Feb 26, 4:28 am, KMax  wrote:
>
>
>
> > On 26 фев, 12:09, mdipierro  wrote:> Changelog 
> > #1.75.5
>
> > > fixed behaviour with languages.py, thanks Iceberg
>
> > I had an issue with shifting translation.
> > a=a
> > b=b
> > c=c
> > become
> > a=a
> > b=c
> > c=
> > Does this issue fixed or something else?

-- 
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: Some interrogations concerning Web2py compatibilities

2010-02-26 Thread Tiago Almeida
Thanks. Didn't know about it :)


On Fri, Feb 26, 2010 at 2:19 AM, mr.freeze  wrote:

> I started using ActivePython instead of the stock releases of python.
> They have win32 extensions built in and a few other helpful things.
> http://www.activestate.com/activepython/features/
>
> On Feb 25, 8:12 pm, mdipierro  wrote:
> > Tiago was right. You need the windows extension to have file locking
> > in windows. I do not know why they did not include that as standard in
> > Python. I agree with you it should be critical.
> >
> > On Feb 25, 6:13 am, Magnitus  wrote:
> >
> > > >what os are you using. This should work o Posix and win32.
> >
> > > Windows Vista, 64-bit.
> >
> > > I got the 64-bit download for the windows extension at the link that
> > > Tiago mentioned and it 'fixed' the warning message (though I'm still
> > > puzzled at why a special windows extension was needed on top of the
> > > release to 'fix' python, perhaps they should include it the release...
> > > some doc came with the open source version, guess I'll have to read it
> > > and find out what the add-on fixes).
> >
> > > Thanks for all the help :).
> >
> > > On Feb 25, 6:32 am, Tiago Almeida  wrote:
> >
> > > > For the root no file locking, try:
> >
> > > > Install "Python for windows
> > > > extensions http://www.google.com/url?sa=D&q=http://sourceforge.net/projects/pywi..
> .>>"
> > > > (If you're using windows)
> >
> > > > I had a similar issue and documented here
> > > > <
> http://groups.google.co.uk/group/web2py/browse_thread/thread/ddc56534...[Troubleshooting]+Running+from+source+on+windows+[WARNING%3Aroot%3Aunable+t
> ­o+import+wsgiserver]+[WARNING%3Aroot%3Ano+file+locking]#f61c0827103abcd7>in
> > > > the past and it solved my problem. Don't know why though.
> >
> > > > Regards,
> > > > Tiago
> > > > ---
> >
> > > > On Thu, Feb 25, 2010 at 10:02 AM, Magnitus 
> wrote:
> > > > > Thanks for the heads up.
> >
> > > > > I did run web2py.py directly and while it works, I got the
> following
> > > > > warning:
> >
> > > > > WARNING:root:no file locking
> >
> > > > > It seems to work otherwise, but I'd still like some clarification
> on
> > > > > the warning if anybody knows.
> >
> > > > > Parallel to this, I found a py2exe to make a 64 bit binary at
> > > > > (downloaded the one for python 2.6 as its the version of python
> that I
> > > > > use):http://sourceforge.net/projects/py2exe/files/
> >
> > > > > When I tried running "python setup_exe.py py2exe", I got the
> following
> > > > > error during installation:
> >
> > > > > *** copy data files ***
> > > > > warning: install_data: setup script did not provide a directory for
> > > > > 'admin.w2p'
> > > > > -- installing right in 'D:\web2py\dist'
> > > > > error: can't copy 'admin.w2p': doesn't exist or not a regular file
> >
> > > > > >>python web2py.py
> >
> > > > > Because you can do so, I believe you can package it in a binary
> form
> > > > > using
> > > > > tools like py2exe.
> >
> > > > > On Feb 24, 9:48 am, Tiago Almeida 
> wrote:
> > > > > > No questions are stupid.
> > > > > > I'm no expert but I'll coment on what I know.
> >
> > > > > > Web2py runs officially in python 2.5. Don't know how hard it
> would be to
> > > > > put
> > > > > > web2py running on 2.6.
> >
> > > > > > You don't need the binary package to run web2py, you can run it
> directly
> > > > > > from python (execute file web2py.py)>>python web2py.py
> >
> > > > > > Because you can do so, I believe you can package it in a binary
> form
> > > > > using
> > > > > > tools like py2exe.
> >
> > > > > > Backward compatibility claim is just related to the fact that
> code
> > > > > changes
> > > > > > to web2py don't break webapplications written for web2py.
> >
> > > > > > I believe web2py will have to support python2.6 eventually but
> don't know
> > > > > > when.
> > > > > > Python 3.x support is even farther away. Py3k is a different
> language, it
> > > > > > has some details that break existing code base and, as such, all
> the code
> > > > > > has to be ported. It won't happen overnight.
> >
> > > > > > Doesn't the code you wrote for python 2.6 run in 2.5? Maybe it
> does and
> > > > > you
> > > > > > can integrate it easily with web2py (instead of integrating
> web2py with
> > > > > what
> > > > > > you have).
> >
> > > > > > Regards,
> > > > > > Tiago
> >
> > > > > > ---
> >
> > > > > > On Wed, Feb 24, 2010 at 9:23 AM, Magnitus <
> eric_vallee2...@yahoo.ca>
> > > > > wrote:
> > > > > > > Hi, I'm a beginner in python and a complete neophyte in python
> web
> > > > > > > frameworks so don't bash my head in if the questions are
> stupid...
> >
> > > > > > > I'm developing an application in C++ for windows x64 and I am
> now
> > > > > > > looking for a way to make it a web app.
> >
> > > > > > > I'm looking for compatibility with python 2.6 (already started
> the
> > > > > > > process of gluing my code with the C API) and eventually python
> 3.1 in
> > > > 

[web2py] Re: web2py 1.75.5 is OUT

2010-02-26 Thread mdipierro
Thanks for the pointer. I think I found and fixed the problem. This
was ONLY a problem if you opened the translation window, add a new
translation string from another tab or from the shell, then submit the
previous form that did not include the new strings. Anyway. Now even
this problem should gone, please try trunk.

On Feb 26, 6:03 am, Iceberg  wrote:
> How about this?  http://groups.google.com/group/web2py/msg/94ab1188910ae303
>
> On Feb26, 6:44pm, mdipierro  wrote:
>
>
>
>
>
> > Probably not because I cannot reproduce the problem.
> > I need an example to be able to reproduce it.
>
> > Massimo
>
> > On Feb 26, 4:28 am, KMax  wrote:
>
> > > On 26 фев, 12:09, mdipierro  wrote:> Changelog 
> > > #1.75.5
>
> > > > fixed behaviour with languages.py, thanks Iceberg
>
> > > I had an issue with shifting translation.
> > > a=a
> > > b=b
> > > c=c
> > > become
> > > a=a
> > > b=c
> > > c=
> > > Does this issue fixed or something else?

-- 
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] Re: importing local modules

2010-02-26 Thread mdipierro
The problem with Python is that path for searching modules is one for
each process and not one per thread or one per application.

This means if you use third part modules you should install them AS IF
web2py was not there and import them from web2py in the usual way.

If you want to make some modules part of an app (i.e. place them in
the modules/ folder of the app) you have to be careful. Not all
modules are suitable. In particular if the module consists of multiple
files they should import each other using only paths relative to the
folder where the importing file is located because the modules/ folder
IS NOT and CANNOT be added to the search path.

Massimo



On Feb 26, 5:46 am, Tiago Almeida  wrote:
> Allow me to hijack this thread for a related question.
>
> How do you usually import a module from a module. I've tried using
> local_import but I had problems (don't remember details) so I solved the
> problem by hardcoding the path like 'applications./modules/...' but
> don't like it.
> Can local_import do this and I used it incorrectly?
>
> Thanks a lot in advance.
>
> Best regards,
> Tiago
> --
>
> On Fri, Feb 26, 2010 at 2:11 AM, Thadeus Burgess wrote:
>
> > Done.
>
> > -Thadeus
>
> > On Thu, Feb 25, 2010 at 7:06 PM, Jonathan Lundell 
> > wrote:
> > > On Feb 25, 2010, at 4:19 PM, mr.freeze wrote:
>
> > >> Just do: dt = local_import('datatables')
>
> > > Thanks. Maybe the book should reflect this:
> >http://web2py.com/book/default/section/4/18
>
> > > (I'd make the change, but I'm a little fuzzy on the details.)
>
> > >> On Feb 25, 6:11 pm, Jonathan Lundell  wrote:
> > >>> I've made a module that does a nice job, if I do say so myself, of
> > encapsulating DataTables (I'll post something about it eventually).
>
> > >>> Since it's a module, I need to import it to my controller, which I'm
> > doing like so:
>
> > >>> import sys
> > >>> sys.path.append(request.folder)
> > >>> import modules.datatables as dt
>
> > >>> My question: is there a better way to manage this? At first I was
> > building the import path all the way from the web2py base, but I didn't want
> > to include the literal application name.
>
> > > --
> > > 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.



[web2py] Re: Some interrogations concerning Web2py compatibilities

2010-02-26 Thread mdipierro
If you get the web2py binary it also includes win32 extension.
ActiveState does not solve the problem that the Python standard
distribution for windows does not include it.

On Feb 25, 8:19 pm, "mr.freeze"  wrote:
> I started using ActivePython instead of the stock releases of python.
> They have win32 extensions built in and a few other helpful 
> things.http://www.activestate.com/activepython/features/
>
> On Feb 25, 8:12 pm, mdipierro  wrote:
>
> > Tiago was right. You need the windows extension to have file locking
> > in windows. I do not know why they did not include that as standard in
> > Python. I agree with you it should be critical.
>
> > On Feb 25, 6:13 am, Magnitus  wrote:
>
> > > >what os are you using. This should work o Posix and win32.
>
> > > Windows Vista, 64-bit.
>
> > > I got the 64-bit download for the windows extension at the link that
> > > Tiago mentioned and it 'fixed' the warning message (though I'm still
> > > puzzled at why a special windows extension was needed on top of the
> > > release to 'fix' python, perhaps they should include it the release...
> > > some doc came with the open source version, guess I'll have to read it
> > > and find out what the add-on fixes).
>
> > > Thanks for all the help :).
>
> > > On Feb 25, 6:32 am, Tiago Almeida  wrote:
>
> > > > For the root no file locking, try:
>
> > > > Install "Python for windows
> > > > extensions>"
> > > > (If you're using windows)
>
> > > > I had a similar issue and documented here
> > > > in
> > > > the past and it solved my problem. Don't know why though.
>
> > > > Regards,
> > > > Tiago
> > > > ---
>
> > > > On Thu, Feb 25, 2010 at 10:02 AM, Magnitus  
> > > > wrote:
> > > > > Thanks for the heads up.
>
> > > > > I did run web2py.py directly and while it works, I got the following
> > > > > warning:
>
> > > > > WARNING:root:no file locking
>
> > > > > It seems to work otherwise, but I'd still like some clarification on
> > > > > the warning if anybody knows.
>
> > > > > Parallel to this, I found a py2exe to make a 64 bit binary at
> > > > > (downloaded the one for python 2.6 as its the version of python that I
> > > > > use):http://sourceforge.net/projects/py2exe/files/
>
> > > > > When I tried running "python setup_exe.py py2exe", I got the following
> > > > > error during installation:
>
> > > > > *** copy data files ***
> > > > > warning: install_data: setup script did not provide a directory for
> > > > > 'admin.w2p'
> > > > > -- installing right in 'D:\web2py\dist'
> > > > > error: can't copy 'admin.w2p': doesn't exist or not a regular file
>
> > > > > >>python web2py.py
>
> > > > > Because you can do so, I believe you can package it in a binary form
> > > > > using
> > > > > tools like py2exe.
>
> > > > > On Feb 24, 9:48 am, Tiago Almeida  wrote:
> > > > > > No questions are stupid.
> > > > > > I'm no expert but I'll coment on what I know.
>
> > > > > > Web2py runs officially in python 2.5. Don't know how hard it would 
> > > > > > be to
> > > > > put
> > > > > > web2py running on 2.6.
>
> > > > > > You don't need the binary package to run web2py, you can run it 
> > > > > > directly
> > > > > > from python (execute file web2py.py)>>python web2py.py
>
> > > > > > Because you can do so, I believe you can package it in a binary form
> > > > > using
> > > > > > tools like py2exe.
>
> > > > > > Backward compatibility claim is just related to the fact that code
> > > > > changes
> > > > > > to web2py don't break webapplications written for web2py.
>
> > > > > > I believe web2py will have to support python2.6 eventually but 
> > > > > > don't know
> > > > > > when.
> > > > > > Python 3.x support is even farther away. Py3k is a different 
> > > > > > language, it
> > > > > > has some details that break existing code base and, as such, all 
> > > > > > the code
> > > > > > has to be ported. It won't happen overnight.
>
> > > > > > Doesn't the code you wrote for python 2.6 run in 2.5? Maybe it does 
> > > > > > and
> > > > > you
> > > > > > can integrate it easily with web2py (instead of integrating web2py 
> > > > > > with
> > > > > what
> > > > > > you have).
>
> > > > > > Regards,
> > > > > > Tiago
>
> > > > > > ---
>
> > > > > > On Wed, Feb 24, 2010 at 9:23 AM, Magnitus 
> > > > > wrote:
> > > > > > > Hi, I'm a beginner in python and a complete neophyte in python web
> > > > > > > frameworks so don't bash my head in if the questions are stupid...
>
> > > > > > > I'm developing an application in C++ for windows x64 and I am now
> > > > > > > looking for a way to make it a web app.
>
> > > > > > > I'm looking for compatibility with python 2.6 (already started the
> > > > 

[web2py] Re: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread szimszon
Nice. TNX.

On febr. 26, 11:25, Graham Dumpleton 
wrote:
> For a further explanation of different modes you can run application
> under with Apache/mod_wsgi read:
>
>  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
> Graham
>
> On Feb 26, 7:42 pm, mdipierro  wrote:
>
>
>
> > it is not useless. It works of if you run only one wsgi process but
> > cache lives only within the lifetime of the process.
>
> > On Feb 26, 2:32 am, szimszon  wrote:
>
> > > Okay. It looks good now. Thanks for the prompt replay.
>
> > > But if I understand well than the cache.ram is useless all the time
> > > apache is used?
>
> > > On febr. 26, 09:10, mdipierro  wrote:
>
> > > > The fact is the web server may be restarting the process or running
> > > > more than one process. Apache does the same. In this case you should
> > > > use cache.disk, not cache.ram.
>
> > > > On Feb 26, 1:34 am, szimszon  wrote:
>
> > > > > Hello!
>
> > > > > I wonder if somebody could it confirm:
>
> > > > > I have a db:
> > > > > --- cut 
> > > > > db.define_table('guestbook',
> > > > >                 Field('email','string',
> > > > >                       label=T("E-Mail"),
> > > > >                       requires=IS_EMAIL()),
> > > > >                 Field('nick','string',
> > > > >                       label=T("Nickname"),
> > > > >                       requires=IS_NOT_EMPTY()),
> > > > >                 Field('ts','datetime',
> > > > >                       label=T("Date"),
> > > > >                       default=request.now,
> > > > >                       writable=False,
> > > > >                       readable=False),
> > > > >                 Field('text','string',
> > > > >                       label=T("Text"),
> > > > >                       requires=IS_NOT_EMPTY()),
> > > > > )
> > > > > --- cut 
>
> > > > > A controller:
> > > > > --- cut 
> > > > > def flush_cache(form=None):
> > > > >     cache.ram.clear()
>
> > > > > def vendegkonyv():
> > > > >     lista=None
> > > > >     if (( auth.user_id==1 ) and (request.vars.r)):
>
> > > > > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach
> > > > >  e)
> > > > >     else:
> > > > >         form=SQLFORM(db.guestbook,onaccept=flush_cache)
> > > > >     #form=SQLFORM.factory()
> > > > >     if not auth.user_id:
> > > > >         form[0].append(Recaptcha(request,
> > > > >                                  "...",
> > > > >                                  "..."))
> > > > >     if form.accepts(request.vars, session):
> > > > >         response.flash = "Record updated"
> > > > >         flush_cache()
> > > > >     elif form.errors:
> > > > >         response.flash = "Error"
> > > > >         flush_cache()
>
> > > > >     try:
> > > > >         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
> > > > >                                            cache=(cache.ram,120))
> > > > >     except:
> > > > >         pass
> > > > >     return dict(form=form,lista=lista)
> > > > > --- cut 
>
> > > > > And a view:
> > > > > --- cut 
> > > > > {{extend 'layout.html'}}
>
> > > > > GuestBook
> > > > > 
> > > > > {{=form}}
> > > > > 
> > > > > {{if lista:}}
> > > > > 
> > > > >   
> > > > >     {{=db.guestbook.ts.label}}
> > > > >     {{=db.guestbook.nick.label}}
> > > > >     {{=db.guestbook.text.label}}
> > > > >   
> > > > > {{for elem in lista:}}
> > > > >   
> > > > >     
> > > > >       {{if (auth.user_id==1):}}
>
> > > > > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
> > > > >       {{else:}}
> > > > >         {{=elem.ts}}
> > > > >       {{pass}}
> > > > >     
> > > > >     {{=elem.nick}}
> > > > >     {{=elem.text}}
> > > > >   
> > > > > {{pass}}
> > > > > 
> > > > > --- cut 
>
> > > > > With the cherrypy isn't a problem but with apache2 and wsgi:
>
> > > > > 1, I make 3-4 post to the guest book
> > > > > 2, delete them
> > > > > 3, reload the page with a link on page pointing to self to guestbook
>
> > > > > I see 0 to 3-4 post on each click randomly which are nonexistent posts
> > > > > anymore :(

-- 
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] Re: web2py 1.75.5 is OUT

2010-02-26 Thread Iceberg
OK, it works! Thanks!

On Feb26, 8:38pm, mdipierro  wrote:
> Thanks for the pointer. I think I found and fixed the problem. This
> was ONLY a problem if you opened the translation window, add a new
> translation string from another tab or from the shell, then submit the
> previous form that did not include the new strings. Anyway. Now even
> this problem should gone, please try trunk.
>
> On Feb 26, 6:03 am, Iceberg  wrote:
>
>
>
> > How about this?  http://groups.google.com/group/web2py/msg/94ab1188910ae303
>
> > On Feb26, 6:44pm, mdipierro  wrote:
>
> > > Probably not because I cannot reproduce the problem.
> > > I need an example to be able to reproduce it.
>
> > > Massimo
>
> > > On Feb 26, 4:28 am, KMax  wrote:
>
> > > > On 26 фев, 12:09, mdipierro  wrote:> Changelog 
> > > > #1.75.5
>
> > > > > fixed behaviour with languages.py, thanks Iceberg
>
> > > > I had an issue with shifting translation.
> > > > a=a
> > > > b=b
> > > > c=c
> > > > become
> > > > a=a
> > > > b=c
> > > > c=
> > > > Does this issue fixed or something else?

-- 
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] Re: web2py 1.75.5 is OUT

2010-02-26 Thread Iceberg
Minor, minor issue. You forgot to change VERSION file to 1.75.5...

On Feb26, 2:09pm, mdipierro  wrote:
> Changelog #1.75.5
>
> fixed behaviour with languages.py, thanks Iceberg
> added chinese (thanks Iceberg) and Hungarian (thanks Gyuris)
> fixed problem with GAE deleted by id (thanks what_ho)
> fixed bug in LOAD with custom views, thanks vhang
> improved IS_IN_SET takes iterator, dict, list and list of tuples,
> thanks Iceberg
> Auth(...,controller='default')
> Fixed major bug in parsing repeated request.vars, thanks Ben
> IS_DATE and IS_DATETIME can now handle any 0 allow to disable editarea onload, thanks Alex
>
> please give it a try

-- 
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] strange traceback from db select's cache.disk with apache2 and wsgi

2010-02-26 Thread szimszon
Error traceback

Traceback (most recent call last):
  File "gluon/restricted.py", line 173, in restricted
exec ccode in environment
  File "applications/raktar/compiled/controllers_lista_szamla.py",
line 360, in 
  File "gluon/globals.py", line 96, in 
self._caller = lambda f: f()
  File "gluon/tools.py", line 1850, in f
return action(*a, **b)
  File "applications/raktar/compiled/controllers_lista_szamla.py",
line 74, in szamla
  File "gluon/sql.py", line 3048, in select
rows = cache_model(key, lambda : response(query), time_expire)
  File "gluon/cache.py", line 305, in __call__
storage[key] = (time.time(), value)
  File "/usr/lib/python2.5/shelve.py", line 123, in __setitem__
p.dump(value)
  File "/usr/lib/python2.5/copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle buffer objects

-- 
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 1.75.5 is OUT

2010-02-26 Thread Thadeus Burgess
Also, there is a typo in gluon/contrib/markdown/__init__.py

['extra'] should be ['extras']

-Thadeus





On Fri, Feb 26, 2010 at 8:24 AM, Iceberg  wrote:
> Minor, minor issue. You forgot to change VERSION file to 1.75.5...
>
> On Feb26, 2:09pm, mdipierro  wrote:
>> Changelog #1.75.5
>>
>> fixed behaviour with languages.py, thanks Iceberg
>> added chinese (thanks Iceberg) and Hungarian (thanks Gyuris)
>> fixed problem with GAE deleted by id (thanks what_ho)
>> fixed bug in LOAD with custom views, thanks vhang
>> improved IS_IN_SET takes iterator, dict, list and list of tuples,
>> thanks Iceberg
>> Auth(...,controller='default')
>> Fixed major bug in parsing repeated request.vars, thanks Ben
>> IS_DATE and IS_DATETIME can now handle any 0> allow to disable editarea onload, thanks Alex
>>
>> please give it a try
>
> --
> 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] Recaptcha doesn't play nice with crud

2010-02-26 Thread Thadeus Burgess
Actually I think this is a valid bug :)

For a simple solution, you can try using SQLFORM.custom... this way
you won't run into the invalid html markup

http://web2py.com/AlterEgo/default/show/205

-Thadeus





On Fri, Feb 26, 2010 at 2:27 AM, szimszon  wrote:
> ello!
>
> Sorry for the lot messa

-- 
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: importing local modules

2010-02-26 Thread Thadeus Burgess
So a simple

modules/mymoduleA.py
modules/mymoduleB.py

# mymoduleA.py
import mymoduleB.py

def functionA():
   print mymoduleB.functionB()

should work ?

-Thadeus





On Fri, Feb 26, 2010 at 6:42 AM, mdipierro  wrote:
> The problem with Python is that path for searching modules is one for
> each process and not one per thread or one per application.
>
> This means if you use third part modules you should install them AS IF
> web2py was not there and import them from web2py in the usual way.
>
> If you want to make some modules part of an app (i.e. place them in
> the modules/ folder of the app) you have to be careful. Not all
> modules are suitable. In particular if the module consists of multiple
> files they should import each other using only paths relative to the
> folder where the importing file is located because the modules/ folder
> IS NOT and CANNOT be added to the search path.
>
> Massimo
>
>
>
> On Feb 26, 5:46 am, Tiago Almeida  wrote:
>> Allow me to hijack this thread for a related question.
>>
>> How do you usually import a module from a module. I've tried using
>> local_import but I had problems (don't remember details) so I solved the
>> problem by hardcoding the path like 'applications./modules/...' but
>> don't like it.
>> Can local_import do this and I used it incorrectly?
>>
>> Thanks a lot in advance.
>>
>> Best regards,
>> Tiago
>> --
>>
>> On Fri, Feb 26, 2010 at 2:11 AM, Thadeus Burgess 
>> wrote:
>>
>> > Done.
>>
>> > -Thadeus
>>
>> > On Thu, Feb 25, 2010 at 7:06 PM, Jonathan Lundell 
>> > wrote:
>> > > On Feb 25, 2010, at 4:19 PM, mr.freeze wrote:
>>
>> > >> Just do: dt = local_import('datatables')
>>
>> > > Thanks. Maybe the book should reflect this:
>> >http://web2py.com/book/default/section/4/18
>>
>> > > (I'd make the change, but I'm a little fuzzy on the details.)
>>
>> > >> On Feb 25, 6:11 pm, Jonathan Lundell  wrote:
>> > >>> I've made a module that does a nice job, if I do say so myself, of
>> > encapsulating DataTables (I'll post something about it eventually).
>>
>> > >>> Since it's a module, I need to import it to my controller, which I'm
>> > doing like so:
>>
>> > >>> import sys
>> > >>> sys.path.append(request.folder)
>> > >>> import modules.datatables as dt
>>
>> > >>> My question: is there a better way to manage this? At first I was
>> > building the import path all the way from the web2py base, but I didn't 
>> > want
>> > to include the literal application name.
>>
>> > > --
>> > > 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.
>
>

-- 
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: db select cache.ram.clear() and apache2 + wsgi not working

2010-02-26 Thread Thadeus Burgess
Cache.ram is not "completely" useless in a multi processes. If your
caching the entire html output of your front page, then its faster to
have this cached in ram instead of on disk, but its not a big deal
since its ok for new threads to recreate the cache in this single
instance.

Also if your running on latest stable web2py code, it does include
some cache statistics in appadmin, including memory usage if you have
guppy heapy installed

-Thadeus





On Fri, Feb 26, 2010 at 7:07 AM, szimszon  wrote:
> Nice. TNX.
>
> On febr. 26, 11:25, Graham Dumpleton 
> wrote:
>> For a further explanation of different modes you can run application
>> under with Apache/mod_wsgi read:
>>
>>  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>>
>> Graham
>>
>> On Feb 26, 7:42 pm, mdipierro  wrote:
>>
>>
>>
>> > it is not useless. It works of if you run only one wsgi process but
>> > cache lives only within the lifetime of the process.
>>
>> > On Feb 26, 2:32 am, szimszon  wrote:
>>
>> > > Okay. It looks good now. Thanks for the prompt replay.
>>
>> > > But if I understand well than the cache.ram is useless all the time
>> > > apache is used?
>>
>> > > On febr. 26, 09:10, mdipierro  wrote:
>>
>> > > > The fact is the web server may be restarting the process or running
>> > > > more than one process. Apache does the same. In this case you should
>> > > > use cache.disk, not cache.ram.
>>
>> > > > On Feb 26, 1:34 am, szimszon  wrote:
>>
>> > > > > Hello!
>>
>> > > > > I wonder if somebody could it confirm:
>>
>> > > > > I have a db:
>> > > > > --- cut 
>> > > > > db.define_table('guestbook',
>> > > > >                 Field('email','string',
>> > > > >                       label=T("E-Mail"),
>> > > > >                       requires=IS_EMAIL()),
>> > > > >                 Field('nick','string',
>> > > > >                       label=T("Nickname"),
>> > > > >                       requires=IS_NOT_EMPTY()),
>> > > > >                 Field('ts','datetime',
>> > > > >                       label=T("Date"),
>> > > > >                       default=request.now,
>> > > > >                       writable=False,
>> > > > >                       readable=False),
>> > > > >                 Field('text','string',
>> > > > >                       label=T("Text"),
>> > > > >                       requires=IS_NOT_EMPTY()),
>> > > > > )
>> > > > > --- cut 
>>
>> > > > > A controller:
>> > > > > --- cut 
>> > > > > def flush_cache(form=None):
>> > > > >     cache.ram.clear()
>>
>> > > > > def vendegkonyv():
>> > > > >     lista=None
>> > > > >     if (( auth.user_id==1 ) and (request.vars.r)):
>>
>> > > > > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach
>> > > > >  e)
>> > > > >     else:
>> > > > >         form=SQLFORM(db.guestbook,onaccept=flush_cache)
>> > > > >     #form=SQLFORM.factory()
>> > > > >     if not auth.user_id:
>> > > > >         form[0].append(Recaptcha(request,
>> > > > >                                  "...",
>> > > > >                                  "..."))
>> > > > >     if form.accepts(request.vars, session):
>> > > > >         response.flash = "Record updated"
>> > > > >         flush_cache()
>> > > > >     elif form.errors:
>> > > > >         response.flash = "Error"
>> > > > >         flush_cache()
>>
>> > > > >     try:
>> > > > >         lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts,
>> > > > >                                            cache=(cache.ram,120))
>> > > > >     except:
>> > > > >         pass
>> > > > >     return dict(form=form,lista=lista)
>> > > > > --- cut 
>>
>> > > > > And a view:
>> > > > > --- cut 
>> > > > > {{extend 'layout.html'}}
>>
>> > > > > GuestBook
>> > > > > 
>> > > > > {{=form}}
>> > > > > 
>> > > > > {{if lista:}}
>> > > > > 
>> > > > >   
>> > > > >     {{=db.guestbook.ts.label}}
>> > > > >     {{=db.guestbook.nick.label}}
>> > > > >     {{=db.guestbook.text.label}}
>> > > > >   
>> > > > > {{for elem in lista:}}
>> > > > >   
>> > > > >     
>> > > > >       {{if (auth.user_id==1):}}
>>
>> > > > > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}}
>> > > > >       {{else:}}
>> > > > >         {{=elem.ts}}
>> > > > >       {{pass}}
>> > > > >     
>> > > > >     {{=elem.nick}}
>> > > > >     {{=elem.text}}
>> > > > >   
>> > > > > {{pass}}
>> > > > > 
>> > > > > --- cut 
>>
>> > > > > With the cherrypy isn't a problem but with apache2 and wsgi:
>>
>> > > > > 1, I make 3-4 post to the guest book
>> > > > > 2, delete them
>> > > > > 3, reload the page with a link on page pointing to self to guestbook
>>
>> > > > > I see 0 to 3-4 post on each click randomly which are nonexistent 
>> > > > > posts
>> > > > > anymore :(
>
> --
> 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] mail sending no functioning from Chrome

2010-02-26 Thread LBarret
This code works under FF not under Chrome (5.0.330.0 (39184) Ubuntu ).


form = FORM(
   LABEL("Get our monthly
newsletter:",_class="InputCaption", _id="NL"),
 
INPUT(id="Email",_class="RegistrarInput",_name="email",size="25",maxlength="50",value="Enter
your email here",_onfocus="this.value=''",_type="text",
   requires=IS_EMAIL()),
   INPUT(_type="submit",_name="Send",value="submit",
text="ok"),
   _id="NL"
)
if form.accepts(request.vars, session):
response.flash="form accepted"
email= "Email: %s"%( form.vars.email)
#==
mail.send( to=['cont...@gamr7.com'],
   subject='newsletter inscription',
   message=email)
redirect(URL(r=request,f='index'))


something to do with the redirect ?

-- 
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: importing local modules

2010-02-26 Thread Jonathan Lundell
On Feb 26, 2010, at 3:46 AM, Tiago Almeida wrote:

> How do you usually import a module from a module. I've tried using 
> local_import but I had problems (don't remember details) so I solved the 
> problem by hardcoding the path like 'applications./modules/...' but 
> don't like it.
> Can local_import do this and I used it incorrectly? 

local_import isn't in the environment of a module, so you can't use it. You 
also don't have request, so you can't get your appname from there, either.

If it's not a problem to add request.folder to sys.path, that would probably 
work (though you might want to do it a little more carefully than I did, and 
check that it's not already in the path).

-- 
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: importing local modules

2010-02-26 Thread Jonathan Lundell
On Feb 26, 2010, at 4:42 AM, mdipierro wrote:

> the modules/ folder
> IS NOT and CANNOT be added to the search path.

Why is 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.



[web2py] Re: mail sending no functioning from Chrome

2010-02-26 Thread szimszon
What is the output? Any error message? Form is accepted?

On febr. 26, 17:16, LBarret  wrote:
> This code works under FF not under Chrome (5.0.330.0 (39184) Ubuntu ).
>
> 
>     form = FORM(
>                LABEL("Get our monthly
> newsletter:",_class="InputCaption", _id="NL"),
>
> INPUT(id="Email",_class="RegistrarInput",_name="email",size="25",maxlength= 
> "50",value="Enter
> your email here",_onfocus="this.value=''",_type="text",
>                requires=IS_EMAIL()),
>                INPUT(_type="submit",_name="Send",value="submit",
> text="ok"),
>                _id="NL"
>             )
>     if form.accepts(request.vars, session):
>         response.flash="form accepted"
>         email        = "Email: %s"        %( form.vars.email)
>         #==
>         mail.send( to=['cont...@gamr7.com'],
>                    subject='newsletter inscription',
>                    message=email)
>         redirect(URL(r=request,f='index'))
> 
>
> something to do with the redirect ?

-- 
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] Re: Recaptcha doesn't play nice with crud

2010-02-26 Thread szimszon
I'm already using SQLFORM.factory and if form.accepts(... and it's
working :-D

On febr. 26, 16:45, Thadeus Burgess  wrote:
> Actually I think this is a valid bug :)
>
> For a simple solution, you can try using SQLFORM.custom... this way
> you won't run into the invalid html markup
>
> http://web2py.com/AlterEgo/default/show/205
>
> -Thadeus
>
>
>
> On Fri, Feb 26, 2010 at 2:27 AM, szimszon  wrote:
> > ello!
>
> > Sorry for the lot messa

-- 
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] Re: mail sending no functioning from Chrome

2010-02-26 Thread LBarret
It depends on the browser.

IE8, FF/Linux, FF/Windows do the checks (like if the email is a real
email)
Chrome/Linux, Chrome/Windows don't .

I get the emails from FF & IE, not from chrome.

I don't have any errors due to this behavior.

L.




On Feb 26, 5:32 pm, szimszon  wrote:
> What is the output? Any error message? Form is accepted?
>
> On febr. 26, 17:16, LBarret  wrote:
>
>
>
> > This code works under FF not under Chrome (5.0.330.0 (39184) Ubuntu ).
>
> > 
> >     form = FORM(
> >                LABEL("Get our monthly
> > newsletter:",_class="InputCaption", _id="NL"),
>
> > INPUT(id="Email",_class="RegistrarInput",_name="email",size="25",maxlength= 
> > "50",value="Enter
> > your email here",_onfocus="this.value=''",_type="text",
> >                requires=IS_EMAIL()),
> >                INPUT(_type="submit",_name="Send",value="submit",
> > text="ok"),
> >                _id="NL"
> >             )
> >     if form.accepts(request.vars, session):
> >         response.flash="form accepted"
> >         email        = "Email: %s"        %( form.vars.email)
> >         #==
> >         mail.send( to=['cont...@gamr7.com'],
> >                    subject='newsletter inscription',
> >                    message=email)
> >         redirect(URL(r=request,f='index'))
> > 
>
> > something to do with the redirect ?

-- 
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] Re: Uservoice: web2py forum

2010-02-26 Thread waTR
Can we get a link to the web2py uservoice forum on the web2py main
page?
http://web2py.uservoice.com


On Feb 25, 9:32 am, waTR  wrote:
> The idea of uservoice is not simply a list of feature requests, but
> also a measure of popularity or demand. The forum isn't a good list of
> features (as they are overwhelmed by posts about other topics), and
> google code gives no indication upon quick examination of the demand
> for a feature existing in the user community.
>
> On Feb 23, 4:56 pm, Richard  wrote:
>
> > works well - I used it previously via Elance.
> > Though people can already request features via this forum or Google
> > Code (http://code.google.com/p/web2py/issues/list)
>
> > On Feb 24, 9:08 am, waTR  wrote:
>
> > > I was just wondering if Massimo is interested in creating a UserVoice
> > > account & forum for web2py. It's free, and it is really nice to have.
> > > At least people will have a place to request features... It's also a
> > > really nice interface.
>
> > > Here is an example:http://freenet.uservoice.com/forums/8861-general

-- 
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] Re: Toggle on/off editarea on startup

2010-02-26 Thread Alex
Yes, when EditArea is off, Its All Text works perfectly.
I think that the best way of EditArea DISPLAY parameter control using
GUI is storing the user choice in session.
Now I am exploring EditArea to make it possible...

On 25 фев, 22:22, Thadeus Burgess  wrote:
> So this patch allows you to disable EditArea javascript, this way you
> can use Its All Text with the actual html textarea?
>
> Is there a way to make it so that you have GUI access to this instead
> of having to edit admin. Perhaps it can get this value from
> request.get_vars. It would be a nuance if it were something you would
> have to edit admin application automatically just to set the option to
> "later".
>
> I +1 this patch, since it looks to be a useful addition for those who
> use the built-in editor.
>
> -Thadeus
>
>
>
> On Thu, Feb 25, 2010 at 1:04 PM, villas  wrote:
> > Hi Alex,
>
> > This is the right place to make your suggestion.  I am sorry that no
> > one commented,  but this may mean that the group didn't see the
> > benefit of the patch very clearly.
>
> > However,  It would be a shame if someone goes to the trouble of
> > submitting a patch and didn't get a reply.  I hope others may also get
> > time to comment and, better still, try it out and, if they like it,
> > second it.
>
> > Regards,
> > David
>
> > --
> > 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.



[web2py] Limitby not working with Oracle with joins

2010-02-26 Thread SergeyPo
Limitby clause still is not working with Oracle backend when used in
queries that have any kind of join, left or inner.

db.define_table('headers',
SQLField('name', 'string')
)

db.define_table('alarms',
SQLField('header', db.headers),
SQLField('komment', 'string')
)

data = db(db.headers.id == db.alarms.header).select(
db.header.name, db.alarms.komment, limitby=(0, 5)
)

...gives Oracle error "wrong identifier 'alarms'.'headers'

But in fact this is not matter of wrong fields, problem is with
limitby construction.

Queries using left join also give error, but another one. In both
cases error message is quite irrelevant to real problem. E.g. I need a
pretty complex query with groupby, count and left join... Error
message in this case will be 'this is not valid groupby clause'.
Obviously, problem is in aliases that are used for nested queries
required by Oracle to limit rows in result set.

Any help with DAL or workarounds please! I am ready to help with
testing.

-- 
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] Limitby not working with Oracle with joins

2010-02-26 Thread Thadeus Burgess
please print the output of

db(db.headers.id == db.alarms.header)._select(db.header.name,
db.alarms.komment, limitby=(0,5))



-Thadeus





On Fri, Feb 26, 2010 at 12:00 PM, SergeyPo  wrote:
> Limitby clause still is not working with Oracle backend when used in
> queries that have any kind of join, left or inner.
>
> db.define_table('headers',
>    SQLField('name', 'string')
> )
>
> db.define_table('alarms',
>    SQLField('header', db.headers),
>    SQLField('komment', 'string')
> )
>
> data = db(db.headers.id == db.alarms.header).select(
>    db.header.name, db.alarms.komment, limitby=(0, 5)
> )
>
> ...gives Oracle error "wrong identifier 'alarms'.'headers'
>
> But in fact this is not matter of wrong fields, problem is with
> limitby construction.
>
> Queries using left join also give error, but another one. In both
> cases error message is quite irrelevant to real problem. E.g. I need a
> pretty complex query with groupby, count and left join... Error
> message in this case will be 'this is not valid groupby clause'.
> Obviously, problem is in aliases that are used for nested queries
> required by Oracle to limit rows in result set.
>
> Any help with DAL or workarounds please! I am ready to help with
> testing.
>
> --
> 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] Re: web2py on EC2

2010-02-26 Thread Oatman
Massimo,

I'm pretty excited about migrating my app to EC2, however I'm confused
about your package selection choice in setup-web2py-ubuntu.sh:
It installs emacs!

Why the devil does emacs need to be installed? That mess is huge!

Thanks for all your help so far(via the web2py book and myriad
articles and posts),
Tris

-- 
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] Re: zen html

2010-02-26 Thread Dragonfyre13
Even better!

http://zen-coding.ru/demo/

That is a demo of zenhtml running against editarea, the default editor
in web2py. Putting zenhtml with our editarea would be pure awesome.

I'd love to see the next version of web2py include zenhtml and zencss
included in the next version of web2py, and it doesn't look difficult
to throw in there.
On Feb 25, 8:13 pm, mdipierro  wrote:
> cool. thanks.
>
> On Feb 25, 9:49 am, selecta  wrote:
>
>
>
> > Sometimes you still have to write html in web2py which is annoying. It
> > might not be new to all of you but I just discovered zen html that
> > really speeds up the process.
> > In my example i customized the zen key to ctrl + z
>
> > What it does:
>
> > type
> > div.box
> > and you get
> > 
> > with you cursor in the middle of the divs ready to type :)
>
> > even better
> > table>tr*3>td
> > and you get
> > 
> >         
> >                 
> >         
> >         
> >                 
> >         
> >         
> >                 
> >         
> > 
>
> > there are plugins for vim, emacs, textmate ...I love it, you might
> > too, check it out
>
> > here is a vid showing zen htmlhttp://vimeo.com/7405114
>
> > and here the projecthttp://code.google.com/p/zen-coding/
>
> > I usehttp://www.vim.org/scripts/script.php?script_id=2981
> > just dropped the plugin into .vim/ftplugin/html/ and edited the
> > shortcut to something convenient
> > :)

-- 
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] [1/2 OT] Help with jquery and ajax

2010-02-26 Thread Jose
I have the following code





{{for r in registros:}}
{{=r.nombre}}
{{u=URL(r=request, c='default', f='download', args=[r.imagen])}}

[Marcas]

{{=IMG(_src=u, _border=0, _alt=r.nombre, _title=r.nombre)}}
{{=r.descripcion}}

{{=DIV(_id='marcas%d'%r.id)}}
{{pass}}

What it does is that for each product line can show brands marketed.
Clicking [Marcas] brands are loaded using ajax, and displayed-hide
function with slideToggle ()

This is tested and works well with: Opera, Konqueror, IE, Chrome, but
Firefox does not. In Firefox by clicking on [Marcas] are displayed
correctly, but when you click again not hide.

Any idea what is wrong.

Jose

-- 
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] [1/2 OT] Help with jquery and ajax

2010-02-26 Thread Thadeus Burgess
try it in firebug.

-Thadeus





On Fri, Feb 26, 2010 at 11:24 AM, Jose  wrote:
> I have the following code
>
> 
>    
> 
>
> {{for r in registros:}}
> {{=r.nombre}}
> {{u=URL(r=request, c='default', f='download', args=[r.imagen])}}
>
> [Marcas]
>
> {{=IMG(_src=u, _border=0, _alt=r.nombre, _title=r.nombre)}}
> {{=r.descripcion}}
>
> {{=DIV(_id='marcas%d'%r.id)}}
> {{pass}}
>
> What it does is that for each product line can show brands marketed.
> Clicking [Marcas] brands are loaded using ajax, and displayed-hide
> function with slideToggle ()
>
> This is tested and works well with: Opera, Konqueror, IE, Chrome, but
> Firefox does not. In Firefox by clicking on [Marcas] are displayed
> correctly, but when you click again not hide.
>
> Any idea what is wrong.
>
> Jose
>
> --
> 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 on EC2

2010-02-26 Thread Thadeus Burgess
Take a look at my slice article that goes about the process step by
step. This way you can only install exactly what you need.

http://www.web2pyslices.com/main/slices/take_slice/14

-Thadeus





On Fri, Feb 26, 2010 at 10:46 AM, Oatman  wrote:
> Massimo,
>
> I'm pretty excited about migrating my app to EC2, however I'm confused
> about your package selection choice in setup-web2py-ubuntu.sh:
> It installs emacs!
>
> Why the devil does emacs need to be installed? That mess is huge!
>
> Thanks for all your help so far(via the web2py book and myriad
> articles and posts),
> Tris
>
> --
> 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] Re: [1/2 OT] Help with jquery and ajax

2010-02-26 Thread Jose


On 26 feb, 18:50, Thadeus Burgess  wrote:
> try it in firebug.
>

It works. There was an error, apparently some browsers allow.

I changed it:

[Marcas]

 for this:

{{div_id='marcas%d'%r.id}}
{{div_id2='#%s'%div_id}}
[Marcas]

Jose

-- 
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: crud delete weird behavior (on GAE at least)

2010-02-26 Thread Miguel Goncalves
Hi

I just downloaded the new version (1.75.5) and it is still happening :(

-Miguel


On Fri, Feb 26, 2010 at 12:12 AM, mdipierro  wrote:

> I am a bit confused myself and I have low bandwidth to search the
> thread. Please let me know if there is a problem still.
>
> On Feb 26, 2:03 am, Miguel Goncalves 
> wrote:
> > I just saw that 1.75.5 is out.
> > Since it has : "fixed problem with GAE deleted by id (thanks what_ho)"
> >
> > Do you think it is related or is this to fix the count vs len issue?
> >
> > In any case I will try it tomorrow morning.
> >
> > Thanks
> > Miguel
> >
> > On Thu, Feb 25, 2010 at 3:33 PM, Miguel Goncalves <
> goncalvesmig...@gmail.com
> >
> > > wrote:
> > > Hi
> >
> > > I attached a modified "welcome" application that reproduces the
> problem.
> >
> > > To repro:
> > > - create a user
> > > - login
> > > - click on the "list Stats" link (top left of the page)
> > > - add few stats. You will see the stats you add get listed on the same
> > > page.
> > > - click on the link "Delete stat"
> > > You should now see the error.
> >
> > > Thanks
> > > Miguel
> >
> > > On Tue, Feb 23, 2010 at 8:32 PM, mdipierro  >wrote:
> >
> > >> I think:
> >
> > >> 1. Run "appcfg.py vacuum_indexes your_app_dir/"
> > >> 2. Run "appcfg.py update_indexes your_app_dir/"
> >
> > >> On Feb 23, 10:23 pm, Miguel Goncalves 
> > >> wrote:
> > >> > How do I do that?
> >
> > >> > On Tue, Feb 23, 2010 at 7:09 PM, mdipierro  >
> > >> wrote:
> > >> > > I would try delete and rebuild indices.
> >
> > >> > > On Feb 23, 7:54 pm, Miguel Goncalves 
> > >> > > wrote:
> > >> > > > Yes I tried to upload it to GAE but I ran into the missing
> indexes
> > >> issue.
> > >> > > So
> > >> > > > I was trying to run the app locally to generate the required
> indexes
> > >> and
> > >> > > be
> > >> > > > able to run on the live GAE. :(
> >
> > >> > > > I have the issue on the dev server. This used to work and I have
> no
> > >> clue
> > >> > > > what could have broken it. I believe the only thing I did was to
> > >> update
> > >> > > GAE
> > >> > > > to the latest sdk.
> >
> > >> > > > Debugging the app a little bit further I found the place where
> the
> > >> > > exception
> > >> > > > is raised:
> >
> > >> > > > class Table
> > >> > > >  def __delitem__(self, key):
> > >> > > > if not str(key).isdigit() or not self._db(self.id ==
> > >> > > key).delete():
> > >> > > > raise SyntaxError, 'No such record: %s' % key
> >
> > >> > > > However the table does contain a record equal to key.
> > >> > > > What  gives?
> >
> > >> > > > Thanks
> > >> > > > Miguel
> >
> > >> > > > On Tue, Feb 23, 2010 at 11:04 AM, Wes James <
> compte...@gmail.com>
> > >> wrote:
> > >> > > > > Have you uploaded your app to gae and tested it there?
> >
> > >> > > > > -wes
> >
> > >> > > > > On Tue, Feb 23, 2010 at 10:57 AM, Miguel Goncalves
> > >> > > > >  wrote:
> > >> > > > > > Anybody run into a similar issue?
> > >> > > > > > I cannot seem to figure it out. :(
> >
> > >> > > > > > Thanks
> > >> > > > > > -Miguel
> >
> > >> > > > > > On Mon, Feb 22, 2010 at 6:09 PM, Miguel <
> > >> goncalvesmig...@gmail.com>
> > >> > > > > wrote:
> >
> > >> > > > > >> Hi
> >
> > >> > > > > >> I implemented the following function to delete an entry in
> a
> > >> db:
> >
> > >> > > > > >> @auth.requires_login()
> > >> > > > > >> def DeleteSite():
> > >> > > > > >>msg = T("Cannot delete specified record.")
> > >> > > > > >>try:
> > >> > > > > >>record_id = request.vars['id']
> > >> > > > > >>next_page = request.vars['next']
> > >> > > > > >>except:
> > >> > > > > >>response.flash = msg
> > >> > > > > >>return dict( message=msg)
> >
> > >> > > > > >>if record_id is None or next_page is None or
> > >> len(next_page)
> > >> > > == 0:
> > >> > > > > >>response.flash = msg
> > >> > > > > >>return dict( message=msg)
> >
> > >> > > > > >>crud.delete(db.sites,record_id,
> > >> > > next=URL(r=request,f=next_page))
> >
> > >> > > > > >> It gets invoked like this (local server on GAE):
> >
> > >>http://127.0.0.1:8081/mlinks/default/DeleteSite?id=388&next=MySites
> >
> > >> > > > > >> This used to work nicely however now when this gets
> invoked,
> > >> the
> > >> > > item
> > >> > > > > >> gets deleted from the database BUT I get a ticket error:
> >
> > >> > > > > >> Error traceback
> >
> > >> > > > > >> Traceback (most recent call last):
> > >> > > > > >>  File "C:\web2py\gluon\restricted.py", line 173, in
> restricted
> > >> > > > > >>exec ccode in environment
> > >> > > > > >>  File "C:\web2py\applications\mlinks/controllers/
> > >> > > > > >> default.py:DeleteSite", line 164, in 
> > >> > > > > >>  File "C:\web2py\gluon\globals.py", line 96, in 
> > >> > > > > >>self._caller = lambda f: f()
> > >> > > > > >>  File "C:\web2py\gluon\tools.py", line 1848, in f
> > >> > > > > >>return action(*a, **b)
> > >> > > > > >>  File 

Re: [web2py] Re: web2py on EC2

2010-02-26 Thread Kuba Kucharski
although the script should be changed.
especially there should be no apt-get upgrade inside.. this may do a
lot of harm if someone doesn't read the script before executing

-- 
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] Re: strange traceback from db select's cache.disk with apache2 and wsgi

2010-02-26 Thread szimszon
This is the cached select which caused the trouble:

SELECT invoice.id, invoice.seller_id, invoice.number, invoice.date,
invoice.document, invoice.invoicedata, seller.id, seller.name,
seller.address, seller.email, seller.phone, seller.description FROM
invoice, seller WHERE ((invoice.id>0 AND invoice.seller_id=seller.id)
AND invoice.id=370) ORDER BY seller.name;

On febr. 26, 16:22, szimszon  wrote:
> Error traceback
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 173, in restricted
>     exec ccode in environment
>   File "applications/raktar/compiled/controllers_lista_szamla.py",
> line 360, in 
>   File "gluon/globals.py", line 96, in 
>     self._caller = lambda f: f()
>   File "gluon/tools.py", line 1850, in f
>     return action(*a, **b)
>   File "applications/raktar/compiled/controllers_lista_szamla.py",
> line 74, in szamla
>   File "gluon/sql.py", line 3048, in select
>     rows = cache_model(key, lambda : response(query), time_expire)
>   File "gluon/cache.py", line 305, in __call__
>     storage[key] = (time.time(), value)
>   File "/usr/lib/python2.5/shelve.py", line 123, in __setitem__
>     p.dump(value)
>   File "/usr/lib/python2.5/copy_reg.py", line 69, in _reduce_ex
>     raise TypeError, "can't pickle %s objects" % base.__name__
> TypeError: can't pickle buffer objects

-- 
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] Re: strange traceback from db select's cache.disk with apache2 and wsgi

2010-02-26 Thread szimszon
The table has upload field and blob to hold file. Can it cause the
problem?

On febr. 26, 21:22, szimszon  wrote:
> This is the cached select which caused the trouble:
>
> SELECT invoice.id, invoice.seller_id, invoice.number, invoice.date,
> invoice.document, invoice.invoicedata, seller.id, seller.name,
> seller.address, seller.email, seller.phone, seller.description FROM
> invoice, seller WHERE ((invoice.id>0 AND invoice.seller_id=seller.id)
> AND invoice.id=370) ORDER BY seller.name;
>
> On febr. 26, 16:22, szimszon  wrote:
>
>
>
> > Error traceback
>
> > Traceback (most recent call last):
> >   File "gluon/restricted.py", line 173, in restricted
> >     exec ccode in environment
> >   File "applications/raktar/compiled/controllers_lista_szamla.py",
> > line 360, in 
> >   File "gluon/globals.py", line 96, in 
> >     self._caller = lambda f: f()
> >   File "gluon/tools.py", line 1850, in f
> >     return action(*a, **b)
> >   File "applications/raktar/compiled/controllers_lista_szamla.py",
> > line 74, in szamla
> >   File "gluon/sql.py", line 3048, in select
> >     rows = cache_model(key, lambda : response(query), time_expire)
> >   File "gluon/cache.py", line 305, in __call__
> >     storage[key] = (time.time(), value)
> >   File "/usr/lib/python2.5/shelve.py", line 123, in __setitem__
> >     p.dump(value)
> >   File "/usr/lib/python2.5/copy_reg.py", line 69, in _reduce_ex
> >     raise TypeError, "can't pickle %s objects" % base.__name__
> > TypeError: can't pickle buffer objects

-- 
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] Iterate through form input

2010-02-26 Thread minh
Hi,

I want to make a page where users can enter e-mails to send an invite.
There will be an array of input boxes (1 e-mail each box) and a send
button.

I was wondering what the best way to generate the form dynamically
was... in case the user wanted to add more e-mails.

Also, is there a way to iterate through the form elements so I don't
have to worry about number/name of input fields?

Thanks,
Minh

-- 
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] Strategy for working with an existing database

2010-02-26 Thread BrendanC
I have an existing test db that I was using with Rails, so it conforms
to the basic requirements re PK ID's etc. Can I use this in web2py
without re coding the table defs etc. What is the best way to do this?

I assume this comes up a lot, but I don't see this mentioned in the
docs.

TIA,
Brendan

-- 
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 on EC2

2010-02-26 Thread Thadeus Burgess
Agreed, this is why I do not recommend the script, it does alot of
things that don't seem necessary to me.

-Thadeus





On Fri, Feb 26, 2010 at 2:14 PM, Kuba Kucharski
 wrote:
> although the script should be changed.
> especially there should be no apt-get upgrade inside.. this may do a
> lot of harm if someone doesn't read the script before executing
>
> --
> 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] Iterate through form input

2010-02-26 Thread Thadeus Burgess
if they all have the same name you will receive it as a list in
request.vars as the name

You will need to use jQuery to dynamically add more fields.

Also, you could use a textarea instead and have them press enter, and
then split the string on '\n'

So considering the following html




This will be serialized into

www.example.com?hi=hello&hi=world

Which will be parsed by web2py into request.vars like so.

request.vars.hi = ['hello', 'world']

-Thadeus





On Fri, Feb 26, 2010 at 2:50 PM, minh  wrote:
> Hi,
>
> I want to make a page where users can enter e-mails to send an invite.
> There will be an array of input boxes (1 e-mail each box) and a send
> button.
>
> I was wondering what the best way to generate the form dynamically
> was... in case the user wanted to add more e-mails.
>
> Also, is there a way to iterate through the form elements so I don't
> have to worry about number/name of input fields?
>
> Thanks,
> Minh
>
> --
> 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] Strategy for working with an existing database

2010-02-26 Thread Thadeus Burgess
As long as it has a primary key of id then you are good.

The first thing you will need to do is fake_migrate=True so web2py
will generate the .table files.

So define you db.define_table statements exactly like your existing database.

make sure to pass fake_migrate=True to these tables

db.define_table('hi', Field('hello', default='world'), fake_migrate=True)

Run appadmin once, this will generate your .table files that web2py
uses to keep track of migrations.

Then remove fake_migrate, or set it to False. You will now be able to
use the table.

If you have legacy databases that have primary keys other than ``id``
you will need to use KeyedTables

-Thadeus





On Fri, Feb 26, 2010 at 2:56 PM, BrendanC  wrote:
> isting test db that I was using with Rails, so it conforms
> to the basic require

-- 
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] Does fake_migrate work?

2010-02-26 Thread villas
There are quite a few postings about this but I have never exactly
understood how this is supposed to work.  My expectation is that
fake_migrate should work alongside migrate like this:

1. If migrate = True,  fake_migrate = True:   DB  and .table files are
both modified/migrated.

2. If migrate = True,  fake_migrate = False:  DB  modified but .table
files are not.

3. If migrate = False,  fake_migrate = True:  DB not modified but
the .table files are (to correspond with the model).

4. If migrate = False,  fake_migrate = False:  Nothing is modified.

Notes
a. You always get an exception if Web2py cannot get the DB to
correspond with the .table files.  In that case you have to fiddle
around and get the two singing off the same sheet.

b. There is no way of creating a model or a .table file from an
existing DB.  If you search hard you'll find some hacked code that
gives a head start,  but really it's something you have to do by hand.

Now,  having written the above,  I have two questions:

1. Are my expectations correct?  (e.g. I think I'm wrong about 1?).

2. Why doesn't 3 seem to work?   I cannot get fake_migrate to create
a .table file.  If it does not, could we please have a function that
does so?

Regards,
-- David

-- 
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] Re: Strategy for working with an existing database

2010-02-26 Thread villas
What a coincidence -- I literally just made a posting about the very
same thing!

@Thadeus, I will try again what you have said here,  but I find it
rather confusing.

Regards, D

-- 
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: Strategy for working with an existing database

2010-02-26 Thread Thadeus Burgess
I will clarify on your post as well


-Thadeus





On Fri, Feb 26, 2010 at 3:38 PM, villas  wrote:
> What a coincidence -- I literally just made a posting about the very
> same thing!
>
> @Thadeus, I will try again what you have said here,  but I find it
> rather confusing.
>
> Regards, D
>
> --
> 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] Re: Iterate through form input

2010-02-26 Thread minh
I have something like this:

form = FORM('Emails:', BR(),
INPUT(_name='email',
requires=IS_NULL_OR(IS_EMAIL())), BR(),
INPUT(_name='email',
requires=IS_NULL_OR(IS_EMAIL())), BR(),
INPUT(_name='email',
requires=IS_NULL_OR(IS_EMAIL())), BR(),
INPUT(_name='email',
requires=IS_NULL_OR(IS_EMAIL())), BR(),
INPUT(_name='email',
requires=IS_NULL_OR(IS_EMAIL())), BR(),
'Message:', BR(),
TEXTAREA(_name='message'), BR(),
INPUT(_type='submit', _value='Invite'))

However, it seems to crash if I have multiple elements named 'email'.
It works fine if I name them email1, email2, etc. This is the error:

Error traceback

Traceback (most recent call last):
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\restricted.py", line 173, in restricted
exec ccode in environment
  File "C:/Documents and Settings/minh/My Documents/InvestP2P/
applications/investp2p/controllers/loans.py", line 209, in 
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\globals.py", line 96, in 
self._caller = lambda f: f()
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\tools.py", line 1848, in f
return action(*a, **b)
  File "C:/Documents and Settings/minh/My Documents/InvestP2P/
applications/investp2p/controllers/loans.py", line 200, in
invite_lenders
if form.accepts(request.vars, session):
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\html.py", line 1267, in accepts
status = self._traverse(status)
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\html.py", line 449, in _traverse
newstatus = c._traverse(status) and newstatus
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\html.py", line 456, in _traverse
newstatus = self._validate()
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\html.py", line 1074, in _validate
(value, errors) = validator(value)
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\validators.py", line 2055, in __call__
return self.other(value)
  File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
\validators.py", line 774, in __call__
match = self.regex.match(value)
TypeError: expected string or buffer



On Feb 26, 1:02 pm, Thadeus Burgess  wrote:
> if they all have the same name you will receive it as a list in
> request.vars as the name
>
> You will need to use jQuery to dynamically add more fields.
>
> Also, you could use a textarea instead and have them press enter, and
> then split the string on '\n'
>
> So considering the following html
>
> 
> 
>
> This will be serialized into
>
> www.example.com?hi=hello&hi=world
>
> Which will be parsed by web2py into request.vars like so.
>
> request.vars.hi = ['hello', 'world']
>
> -Thadeus
>
> On Fri, Feb 26, 2010 at 2:50 PM, minh  wrote:
> > Hi,
>
> > I want to make a page where users can enter e-mails to send an invite.
> > There will be an array of input boxes (1 e-mail each box) and a send
> > button.
>
> > I was wondering what the best way to generate the form dynamically
> > was... in case the user wanted to add more e-mails.
>
> > Also, is there a way to iterate through the form elements so I don't
> > have to worry about number/name of input fields?
>
> > Thanks,
> > Minh
>
> > --
> > 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.



[web2py] Re: Iterate through form input

2010-02-26 Thread minh
I forgot to mention, the form loads fine... I get the error on submit.

On Feb 26, 1:58 pm, minh  wrote:
> I have something like this:
>
>         form = FORM('Emails:', BR(),
>                     INPUT(_name='email',
> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>                     INPUT(_name='email',
> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>                     INPUT(_name='email',
> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>                     INPUT(_name='email',
> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>                     INPUT(_name='email',
> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>                     'Message:', BR(),
>                     TEXTAREA(_name='message'), BR(),
>                     INPUT(_type='submit', _value='Invite'))
>
> However, it seems to crash if I have multiple elements named 'email'.
> It works fine if I name them email1, email2, etc. This is the error:
>
> Error traceback
>
> Traceback (most recent call last):
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \restricted.py", line 173, in restricted
>     exec ccode in environment
>   File "C:/Documents and Settings/minh/My Documents/InvestP2P/
> applications/investp2p/controllers/loans.py", line 209, in 
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \globals.py", line 96, in 
>     self._caller = lambda f: f()
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \tools.py", line 1848, in f
>     return action(*a, **b)
>   File "C:/Documents and Settings/minh/My Documents/InvestP2P/
> applications/investp2p/controllers/loans.py", line 200, in
> invite_lenders
>     if form.accepts(request.vars, session):
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \html.py", line 1267, in accepts
>     status = self._traverse(status)
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \html.py", line 449, in _traverse
>     newstatus = c._traverse(status) and newstatus
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \html.py", line 456, in _traverse
>     newstatus = self._validate()
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \html.py", line 1074, in _validate
>     (value, errors) = validator(value)
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \validators.py", line 2055, in __call__
>     return self.other(value)
>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
> \validators.py", line 774, in __call__
>     match = self.regex.match(value)
> TypeError: expected string or buffer
>
> On Feb 26, 1:02 pm, Thadeus Burgess  wrote:
>
> > if they all have the same name you will receive it as a list in
> > request.vars as the name
>
> > You will need to use jQuery to dynamically add more fields.
>
> > Also, you could use a textarea instead and have them press enter, and
> > then split the string on '\n'
>
> > So considering the following html
>
> > 
> > 
>
> > This will be serialized into
>
> >www.example.com?hi=hello&hi=world
>
> > Which will be parsed by web2py into request.vars like so.
>
> > request.vars.hi = ['hello', 'world']
>
> > -Thadeus
>
> > On Fri, Feb 26, 2010 at 2:50 PM, minh  wrote:
> > > Hi,
>
> > > I want to make a page where users can enter e-mails to send an invite.
> > > There will be an array of input boxes (1 e-mail each box) and a send
> > > button.
>
> > > I was wondering what the best way to generate the form dynamically
> > > was... in case the user wanted to add more e-mails.
>
> > > Also, is there a way to iterate through the form elements so I don't
> > > have to worry about number/name of input fields?
>
> > > Thanks,
> > > Minh
>
> > > --
> > > 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.



[web2py] Re: persistent background process

2010-02-26 Thread Michael Toomim
I got this to work by using @reboot cron.  It works great, and super
simple.  Cross-platform, needs no external daemons.

The trick was that web2py wasn't shutting down when my script was
running, because I had a try-catch that was catching the
KeyboardInterrupt exception.  So here's what I did:

In cron/crontab:

   @reboot toomim  *applications/init/cron/background_work.py

(Thanks to achipa and massimo for fixing @reboot recently!)
In cron/background_work.py:

import time, sys, commands, datetime

# Lock the database so we don't accidentally run two background
# processes at the same time, e.g. if we run web2py twice by
accident
if not db.executesql('select pg_try_advisory_lock(1);')[0][0]:
logging.debug('CRON: FAILED to get background process lock')
raise Exception('Somebody else is running background
processes')
logging.debug('CRON: got lock')


count = 0
while True:
count += 1
logging.debug('Sleeping for the %dth time' % count)
time.sleep(10)
try:
logging.debug('Processing launch queue')
process_launch_queue()
logging.debug('Processing bonus queue')
process_bonus_queue()
except KeyboardInterrupt as e:
logging.debug('Someone killed us.')
raise
except:
logging.debug("Error in background process: %s" %
sys.exc_info()[0])

Note that I explicitly catch the KeyboardInterrupt and re-raise it so
the script dies.  If you kill web2py with some other type of exception
you might need to put it in there too.

The other trick is that print statements and exceptions aren't
displayed at the console because this is run as a separate python
process.  So you need to use logging.debug from log.py.  I don't
remember where I got that file...

On Jan 3, 1:57 pm, Richard  wrote:
> I was doing that but sometimes the process crashed or was killed by my
> hosting provider, so I need a way to continue it automatically. Also I
> may want to execute a number of background tasks in parallel. And it
> uses extra resources that aren't needed, which is a problem on my
> hosting where I am reaching the limits.
>
> Michael, are you looking for a particular platform solution or cross
> platform?
>
> On Jan 4, 5:23 am, mdipierro  wrote:
>
>
>
> > I normally just start a separate web2py process.
>
> > python web2py.py -S app -M -S thescript
>
> > On Jan 3, 11:58 am, Michael Toomim  wrote:
>
> > > Great!  I am also trying to implement this.  Richard and Auden, have
> > > you gotten anything working yet?  How about we share solutions?
>
> > > My current difficulty is figuring out where to create thepersistent
> > > background thread.
> > >   - If I spawn it in a controller or model file will it be limited to
> > > 10 seconds?
> > >   - If I run it in a periodic cron there will be a delay and I will
> > > need to handle the case of multiple threads running simultaneously
> > >   - If I use @reboot cron, it prevents web2py from shutting down (it
> > > seems to wait for my thread to quit, which does not know to quit)
>
> > > Any ideas on these problems?  It would be great to have a general task
> > > queue in web2py, like the one on GAE.  Although I've never learned how
> > > to use the GAE one, perhaps what we're making could be easier to use.
>
> > > On Jan 3, 8:06 am, mdipierro  wrote:
>
> > > > This is what I would do:
>
> > > > db.define_table('queue',Field('status'),Field('descr'))
>
> > > > In actions
>
> > > > db.queue.insert(status='PENDING',descr='whatever')
>
> > > > In your own scrips that you can run via CRON or via background process
>
> > > > while True:
> > > >     tasks = db(db.queue.status=='PENDING').select(limitby=(0,10)).first
> > > > ()
> > > >     if task:
> > > >         task.update_record(status='PROCESSING')
> > > >         db.commit()
> > > >         try:
> > > >              #process task
> > > >              task.update_record(status='COMPLETED')
> > > >         except:
> > > >              task.update_record(status='FAILED')
> > > >         db.commit()
> > > >     else:
> > > >         sleep(10) # retry in 10 seconds
>
> > > > On Jan 3, 7:28 am, Richard  wrote:
>
> > > > > I haven't implemented this yet, but my plan on Linux to keep a
> > > > > background process running is:
>
> > > > > - Define a task table, which is checked on every request
> > > > > - If the task table is empty then start the background task with
> > > > > subprocess and store the pid in the task table
> > > > > - If the task table has an entry but its pid is not active (not in /
> > > > > proc) then restart the background task and update the pid
> > > > > - Else the task is running fine
>
> > > > > Perhaps you could adapt that to your needs, assuming you are using
> > > > > Linux.
>
> > > > > Richard
>
> > > > > On Dec 30 2009, 3:26 pm, Auden RovelleQuartz 
> > > > > wrote:
>
> > > > > > any simple example on how to create apersistentbackground process
> > > > > > that r

[web2py] can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread snfctech
apache2 fedora10 web2py1.75.5

I set up my web2py.conf virtual host file per the instructions on
p285-288 of the web2py book (2nd edition).  The main differences from
the examples are that I'm running Fedora10 and serving web2py on port
8080 for access over a LAN.  I also removed "display-name=%{GROUP}"
from the WSGIDaemonProcess directive, per a thread I found on this
group.

I can hit the welcome app fine from other machines by hitting
http://myserverIP:8080.  When I click on the link for the
administrative interface, I get a 403 error.  When I hit
https://myserverIP:8080/admin I get a 303 error "The connection to
myserverIP:8080 was interrupted while the page was loading."

I'm pretty stuck at this point.  Any help would be greatly
appreciated.

Here is my web2py.conf:



ServerName web2py.order-system.com
WSGIDaemonProcess web2py user=apache group=apache
WSGIProcessGroup web2py
WSGIScriptAlias / /var/www/web2py/wsgihandler.py


AllowOverride None
Order Allow,Deny
Deny from all

Allow from all



AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
static/$2


Order Allow,Deny
Allow from all



Deny from all



Deny from all


ErrorLog logs/web2py-error_log
CustomLog logs/web2py-access_log common



LoadModule ssl_module modules/mod_ssl.so
NameVirtualHost *:443



ServerName web2py.order-system.com
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/server.crt
SSLCertificateKeyFile /etc/httpd/ssl/server.key

WSGIProcessGroup web2py

WSGIScriptAlias / /var/www/web2py/wsgihandler.py


AllowOverride None
Order Allow,Deny
Deny from all

Allow from all



AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
static/$2


Order Allow,Deny
Allow from all


ErrorLog logs/web2py-error_log
CustomLog logs/web2py-access_log common












-- 
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] Re: persistent background process

2010-02-26 Thread Michael Toomim
Oh yeah, and that database lock line only works with postgresql.  You
might try file locking if you're not using it.

On Feb 26, 2:05 pm, Michael Toomim  wrote:
> I got this to work by using @reboot cron.  It works great, and super
> simple.  Cross-platform, needs no external daemons.
>
> The trick was that web2py wasn't shutting down when my script was
> running, because I had a try-catch that was catching the
> KeyboardInterrupt exception.  So here's what I did:
>
> In cron/crontab:
>
>   �...@reboot toomim  *applications/init/cron/background_work.py
>
> (Thanks to achipa and massimo for fixing @reboot recently!)
> In cron/background_work.py:
>
>     import time, sys, commands, datetime
>
>     # Lock the database so we don't accidentally run two background
>     # processes at the same time, e.g. if we run web2py twice by
> accident
>     if not db.executesql('select pg_try_advisory_lock(1);')[0][0]:
>         logging.debug('CRON: FAILED to get background process lock')
>         raise Exception('Somebody else is running background
> processes')
>     logging.debug('CRON: got lock')
>
>     count = 0
>     while True:
>         count += 1
>         logging.debug('Sleeping for the %dth time' % count)
>         time.sleep(10)
>         try:
>             logging.debug('Processing launch queue')
>             process_launch_queue()
>             logging.debug('Processing bonus queue')
>             process_bonus_queue()
>         except KeyboardInterrupt as e:
>             logging.debug('Someone killed us.')
>             raise
>         except:
>             logging.debug("Error in background process: %s" %
> sys.exc_info()[0])
>
> Note that I explicitly catch the KeyboardInterrupt and re-raise it so
> the script dies.  If you kill web2py with some other type of exception
> you might need to put it in there too.
>
> The other trick is that print statements and exceptions aren't
> displayed at the console because this is run as a separate python
> process.  So you need to use logging.debug from log.py.  I don't
> remember where I got that file...
>
> On Jan 3, 1:57 pm, Richard  wrote:
>
>
>
> > I was doing that but sometimes the process crashed or was killed by my
> > hosting provider, so I need a way to continue it automatically. Also I
> > may want to execute a number of background tasks in parallel. And it
> > uses extra resources that aren't needed, which is a problem on my
> > hosting where I am reaching the limits.
>
> > Michael, are you looking for a particular platform solution or cross
> > platform?
>
> > On Jan 4, 5:23 am, mdipierro  wrote:
>
> > > I normally just start a separate web2py process.
>
> > > python web2py.py -S app -M -S thescript
>
> > > On Jan 3, 11:58 am, Michael Toomim  wrote:
>
> > > > Great!  I am also trying to implement this.  Richard and Auden, have
> > > > you gotten anything working yet?  How about we share solutions?
>
> > > > My current difficulty is figuring out where to create thepersistent
> > > > background thread.
> > > >   - If I spawn it in a controller or model file will it be limited to
> > > > 10 seconds?
> > > >   - If I run it in a periodic cron there will be a delay and I will
> > > > need to handle the case of multiple threads running simultaneously
> > > >   - If I use @reboot cron, it prevents web2py from shutting down (it
> > > > seems to wait for my thread to quit, which does not know to quit)
>
> > > > Any ideas on these problems?  It would be great to have a general task
> > > > queue in web2py, like the one on GAE.  Although I've never learned how
> > > > to use the GAE one, perhaps what we're making could be easier to use.
>
> > > > On Jan 3, 8:06 am, mdipierro  wrote:
>
> > > > > This is what I would do:
>
> > > > > db.define_table('queue',Field('status'),Field('descr'))
>
> > > > > In actions
>
> > > > > db.queue.insert(status='PENDING',descr='whatever')
>
> > > > > In your own scrips that you can run via CRON or via background process
>
> > > > > while True:
> > > > >     tasks = 
> > > > > db(db.queue.status=='PENDING').select(limitby=(0,10)).first
> > > > > ()
> > > > >     if task:
> > > > >         task.update_record(status='PROCESSING')
> > > > >         db.commit()
> > > > >         try:
> > > > >              #process task
> > > > >              task.update_record(status='COMPLETED')
> > > > >         except:
> > > > >              task.update_record(status='FAILED')
> > > > >         db.commit()
> > > > >     else:
> > > > >         sleep(10) # retry in 10 seconds
>
> > > > > On Jan 3, 7:28 am, Richard  wrote:
>
> > > > > > I haven't implemented this yet, but my plan on Linux to keep a
> > > > > > background process running is:
>
> > > > > > - Define a task table, which is checked on every request
> > > > > > - If the task table is empty then start the background task with
> > > > > > subprocess and store the pid in the task table
> > > > > > - If the task table has an entry but its pid is not active (not in /
> > > > > > proc) then rest

Re: [web2py] Does fake_migrate work?

2010-02-26 Thread Thadeus Burgess
How web2py performs migrations:

Web2py takes your db.define_table statement, and stores a pickle of
its structure. These files are saved in
databases/..table Web2py takes this
structure that is saved on the filesystem and loads it up when you
perform db.define_table. If your db.define_table is different than the
pickled file, web2py will perform a migration on the database,
executing the necessary SQL. Web2py assumes the database is in the
format of the .table files. Therefore if your .table files ever come
out of sync of your database (such as can happen in a multi-developer
environment), web2py will attempt to perform migrations that are
invalid. (hence the need for fake_migrate)

So to start here are some definitions

Keyword arguments:
migrate -- Specifies if web2py should perform migrations on the
underlying database. This includes the creation/deletion of tables,
creation/addition/alteration/removal of columns. Web2py compares the
.table pickle with the define_table statements to figure out the
migration scheme. (Default True)
fake_migrate -- Regenerates .table files to look exactly like your
db.define_table statement, regardless of the state of the database.
Migrations WILL NOT be performed if this is True (default False).

So this is what happens when you specify the following options

migrate = True, fake_migrate = False

Web2py will migrate the database if your define_table statement
differs from the pickle file.

migrate = False, fake_migrate = False

Web2py will not migrate the database, it assumes that your
db.define_table statement looks exactly like the database. If you do
alter anything without migrations, and the SQL is incorrect it will
through a OperationalError.
This is the recommended setting for production, since there is no
overhead of web2py needing to read the pickle files from the
filesystem. (pickle files are locked when written to)

migrate = True, fake_migrate = True
migrate = False, fake_migrate = True

Web2py will regenerate your .table files. Migrations will not be
performed since it is "faking" a migrate on the pickle files, and not
the database. This is also useful if you would like to see the SQL
that will be generated from a migrate via sql.log before actually
performing the migration.

-Thadeus





On Fri, Feb 26, 2010 at 3:35 PM, villas  wrote:
> There are quite a few postings about this but I have never exactly
> understood how this is supposed to work.  My expectation is that
> fake_migrate should work alongside migrate like this:
>
> 1. If migrate = True,  fake_migrate = True:   DB  and .table files are
> both modified/migrated.
>
> 2. If migrate = True,  fake_migrate = False:  DB  modified but .table
> files are not.
>
> 3. If migrate = False,  fake_migrate = True:  DB not modified but
> the .table files are (to correspond with the model).
>
> 4. If migrate = False,  fake_migrate = False:  Nothing is modified.
>
> Notes
> a. You always get an exception if Web2py cannot get the DB to
> correspond with the .table files.  In that case you have to fiddle
> around and get the two singing off the same sheet.
>
> b. There is no way of creating a model or a .table file from an
> existing DB.  If you search hard you'll find some hacked code that
> gives a head start,  but really it's something you have to do by hand.
>
> Now,  having written the above,  I have two questions:
>
> 1. Are my expectations correct?  (e.g. I think I'm wrong about 1?).
>
> 2. Why doesn't 3 seem to work?   I cannot get fake_migrate to create
> a .table file.  If it does not, could we please have a function that
> does so?
>
> Regards,
> -- David
>
> --
> 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: Iterate through form input

2010-02-26 Thread Thadeus Burgess
Unfortunately you will not be able to "add" fields when using FORM.
You will have to iterate over the request.vars manually.

-Thadeus





On Fri, Feb 26, 2010 at 3:59 PM, minh  wrote:
> I forgot to mention, the form loads fine... I get the error on submit.
>
> On Feb 26, 1:58 pm, minh  wrote:
>> I have something like this:
>>
>>         form = FORM('Emails:', BR(),
>>                     INPUT(_name='email',
>> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>>                     INPUT(_name='email',
>> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>>                     INPUT(_name='email',
>> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>>                     INPUT(_name='email',
>> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>>                     INPUT(_name='email',
>> requires=IS_NULL_OR(IS_EMAIL())), BR(),
>>                     'Message:', BR(),
>>                     TEXTAREA(_name='message'), BR(),
>>                     INPUT(_type='submit', _value='Invite'))
>>
>> However, it seems to crash if I have multiple elements named 'email'.
>> It works fine if I name them email1, email2, etc. This is the error:
>>
>> Error traceback
>>
>> Traceback (most recent call last):
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \restricted.py", line 173, in restricted
>>     exec ccode in environment
>>   File "C:/Documents and Settings/minh/My Documents/InvestP2P/
>> applications/investp2p/controllers/loans.py", line 209, in 
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \globals.py", line 96, in 
>>     self._caller = lambda f: f()
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \tools.py", line 1848, in f
>>     return action(*a, **b)
>>   File "C:/Documents and Settings/minh/My Documents/InvestP2P/
>> applications/investp2p/controllers/loans.py", line 200, in
>> invite_lenders
>>     if form.accepts(request.vars, session):
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \html.py", line 1267, in accepts
>>     status = self._traverse(status)
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \html.py", line 449, in _traverse
>>     newstatus = c._traverse(status) and newstatus
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \html.py", line 456, in _traverse
>>     newstatus = self._validate()
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \html.py", line 1074, in _validate
>>     (value, errors) = validator(value)
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \validators.py", line 2055, in __call__
>>     return self.other(value)
>>   File "C:\Documents and Settings\minh\My Documents\InvestP2P\gluon
>> \validators.py", line 774, in __call__
>>     match = self.regex.match(value)
>> TypeError: expected string or buffer
>>
>> On Feb 26, 1:02 pm, Thadeus Burgess  wrote:
>>
>> > if they all have the same name you will receive it as a list in
>> > request.vars as the name
>>
>> > You will need to use jQuery to dynamically add more fields.
>>
>> > Also, you could use a textarea instead and have them press enter, and
>> > then split the string on '\n'
>>
>> > So considering the following html
>>
>> > 
>> > 
>>
>> > This will be serialized into
>>
>> >www.example.com?hi=hello&hi=world
>>
>> > Which will be parsed by web2py into request.vars like so.
>>
>> > request.vars.hi = ['hello', 'world']
>>
>> > -Thadeus
>>
>> > On Fri, Feb 26, 2010 at 2:50 PM, minh  wrote:
>> > > Hi,
>>
>> > > I want to make a page where users can enter e-mails to send an invite.
>> > > There will be an array of input boxes (1 e-mail each box) and a send
>> > > button.
>>
>> > > I was wondering what the best way to generate the form dynamically
>> > > was... in case the user wanted to add more e-mails.
>>
>> > > Also, is there a way to iterate through the form elements so I don't
>> > > have to worry about number/name of input fields?
>>
>> > > Thanks,
>> > > Minh
>>
>> > > --
>> > > 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, visi

Re: [web2py] can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread Thadeus Burgess
Have you taken a look at your error logs for VirtualHost 443 ?

It might give a clue as to what is going wrong. I am thinking it is an
issue with the certificate?

-Thadeus





On Fri, Feb 26, 2010 at 4:06 PM, snfctech  wrote:
> retty stuck at this point.  Any help would be greatly
> appre

-- 
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] Re: can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread snfctech
Hi, Thadeus.  Thanks for your prompt reply.

I get

[error] [client 192.168.1.63] client denied by server configuration: /
var/www/web2py/wsgihandler.py, referer: 
http://192.168.1.8:8080/welcome/default/index

when I hit http://192.168.1.8:8080/admin/default/index, and nothing
when I hit https://192.168.1.8:8080/admin.  Although I do get some
garbage in the access log:

192.168.1.63 - - [26/Feb/2010:14:20:07 -0800] "\x80R\x01\x03" 303 66



On Feb 26, 2:12 pm, Thadeus Burgess  wrote:
> Have you taken a look at your error logs for VirtualHost 443 ?
>
> It might give a clue as to what is going wrong. I am thinking it is an
> issue with the certificate?
>
> -Thadeus
>
> On Fri, Feb 26, 2010 at 4:06 PM, snfctech  wrote:
> > retty stuck at this point.  Any help would be greatly
> > appre

-- 
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: can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread Thadeus Burgess
Well for one, https://ip:8080 is not a valid VirtualHost, since your
VirtualHost is configured to run on port 443, not 8080. Aside from
this, http and https have to run on separate ports.

Honestly I have always had problems getting web2py running on rpm
based distributions (redhat, fedora, etc.), I kept running into the
same weird issues, my configuration was fine but the way httpd works
kept screwing with it. I finally gave up and switched to Ubuntu and it
worked perfectly first try... though I do realize you probably need to
use fedora.

Aside from attempting to access the wrong port for https, your
configuration looks almost exactly like mine.

Are there other VirtualHosts that could be conflicting, such as
default or others?

-Thadeus





On Fri, Feb 26, 2010 at 4:23 PM, snfctech  wrote:
> Hi, Thadeus.  Thanks for your prompt reply.
>
> I get
>
> [error] [client 192.168.1.63] client denied by server configuration: /
> var/www/web2py/wsgihandler.py, referer: 
> http://192.168.1.8:8080/welcome/default/index
>
> when I hit http://192.168.1.8:8080/admin/default/index, and nothing
> when I hit https://192.168.1.8:8080/admin.  Although I do get some
> garbage in the access log:
>
> 192.168.1.63 - - [26/Feb/2010:14:20:07 -0800] "\x80R\x01\x03" 303 66
>
>
>
> On Feb 26, 2:12 pm, Thadeus Burgess  wrote:
>> Have you taken a look at your error logs for VirtualHost 443 ?
>>
>> It might give a clue as to what is going wrong. I am thinking it is an
>> issue with the certificate?
>>
>> -Thadeus
>>
>> On Fri, Feb 26, 2010 at 4:06 PM, snfctech  wrote:
>> > retty stuck at this point.  Any help would be greatly
>> > appre
>
> --
> 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] Re: can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread Dragonfyre13
It looks like you're denying access to the admin dir in the apache
conf.


Deny from all


What it's setup to do is go to https://yourserver/admin

port 8080 has admin disabled, which (per the security gremlin in me)
is accurate behavior since it's not an encrypted connection. Port 443
is the std port for https, so there's no need to specify a port when
hitting that with a web browser.

On Feb 26, 4:06 pm, snfctech  wrote:
> apache2 fedora10 web2py1.75.5
>
> I set up my web2py.conf virtual host file per the instructions on
> p285-288 of the web2py book (2nd edition).  The main differences from
> the examples are that I'm running Fedora10 and serving web2py on port
> 8080 for access over a LAN.  I also removed "display-name=%{GROUP}"
> from the WSGIDaemonProcess directive, per a thread I found on this
> group.
>
> I can hit the welcome app fine from other machines by 
> hittinghttp://myserverIP:8080.  When I click on the link for the
> administrative interface, I get a 403 error.  When I 
> hithttps://myserverIP:8080/adminI get a 303 error "The connection to
> myserverIP:8080 was interrupted while the page was loading."
>
> I'm pretty stuck at this point.  Any help would be greatly
> appreciated.
>
> Here is my web2py.conf:
>
> 
>
>         ServerName web2py.order-system.com
>         WSGIDaemonProcess web2py user=apache group=apache
>         WSGIProcessGroup web2py
>         WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>         
>                 AllowOverride None
>                 Order Allow,Deny
>                 Deny from all
>                 
>                         Allow from all
>                 
>         
>
>         AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
> static/$2
>
>         
>                 Order Allow,Deny
>                 Allow from all
>         
>
>         
>                 Deny from all
>         
>
>         
>                 Deny from all
>         
>
>         ErrorLog logs/web2py-error_log
>         CustomLog logs/web2py-access_log common
>
> 
>
> LoadModule ssl_module modules/mod_ssl.so
> NameVirtualHost *:443
>
> 
>
>         ServerName web2py.order-system.com
>         SSLEngine on
>         SSLCertificateFile /etc/httpd/ssl/server.crt
>         SSLCertificateKeyFile /etc/httpd/ssl/server.key
>
>         WSGIProcessGroup web2py
>
>         WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>         
>                 AllowOverride None
>                 Order Allow,Deny
>                 Deny from all
>                 
>                         Allow from all
>                 
>         
>
>         AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
> static/$2
>
>         
>                 Order Allow,Deny
>                 Allow from all
>         
>
>         ErrorLog logs/web2py-error_log
>         CustomLog logs/web2py-access_log common
>
> 

-- 
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] can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread Tim Alexander
Not sure why this isn't going through off the google groups page, but I'll
just reply via email.

The problem centers around the port you're hitting it on. You have admin
access disabled on 8080 via the below lines:

   
   Deny from all
   

that's why http://myserverIP:8080 doesn't work when clicking on the link.
The reason https://myserverIP:8080/admin doesn't work, is because you're
trying to access the http port via https. To visit myserverIP on port 443,
go to https://myserverIP/admin since https defaults to port 443 on all
current browsers. If you want to specify a port, feel free to do
https://myserverIP:443/admin 

Either of those will get you in. Also, shouldn't be any issues just doing
everything over https, via https://myserverIP/ that's how I'm currently
running everything.

On Fri, Feb 26, 2010 at 4:06 PM, snfctech  wrote:

> apache2 fedora10 web2py1.75.5
>
> I set up my web2py.conf virtual host file per the instructions on
> p285-288 of the web2py book (2nd edition).  The main differences from
> the examples are that I'm running Fedora10 and serving web2py on port
> 8080 for access over a LAN.  I also removed "display-name=%{GROUP}"
> from the WSGIDaemonProcess directive, per a thread I found on this
> group.
>
> I can hit the welcome app fine from other machines by hitting
> http://myserverIP:8080.  When I click on the link for the
> administrative interface, I get a 403 error.  When I hit
> https://myserverIP:8080/admin I get a 303 error "The connection to
> myserverIP:8080 was interrupted while the page was loading."
>
> I'm pretty stuck at this point.  Any help would be greatly
> appreciated.
>
> Here is my web2py.conf:
>
> 
>
>ServerName web2py.order-system.com
>WSGIDaemonProcess web2py user=apache group=apache
>WSGIProcessGroup web2py
>WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>
>AllowOverride None
>Order Allow,Deny
>Deny from all
>
>Allow from all
>
>
>
>AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
> static/$2
>
>
>Order Allow,Deny
>Allow from all
>
>
>
>Deny from all
>
>
>
>Deny from all
>
>
>ErrorLog logs/web2py-error_log
>CustomLog logs/web2py-access_log common
>
> 
>
> LoadModule ssl_module modules/mod_ssl.so
> NameVirtualHost *:443
>
> 
>
>ServerName web2py.order-system.com
>SSLEngine on
>SSLCertificateFile /etc/httpd/ssl/server.crt
>SSLCertificateKeyFile /etc/httpd/ssl/server.key
>
>WSGIProcessGroup web2py
>
>WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>
>AllowOverride None
>Order Allow,Deny
>Deny from all
>
>Allow from all
>
>
>
>AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
> static/$2
>
>
>Order Allow,Deny
>Allow from all
>
>
>ErrorLog logs/web2py-error_log
>CustomLog logs/web2py-access_log common
>
> 
>
>
>
>
>
>
>
>
>
>
> --
> 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 Scalability and demos

2010-02-26 Thread Alfonso de la Guarda
Massimo,

I will try to make some tests about performance, however: what is
about big 'sites' which currently are using web2py, any information?
By the way, i have read about a trip to Argentina in september for a
conference, maybe you can stop in Peru.


Saludos,


Alfonso de la Guarda
Centro Open Source(COS)
http://www.cos-la.net
http://alfonsodg.net
   Telef. 991935157
1024D/B23B24A4
5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4



On Thu, Feb 25, 2010 at 23:36, mdipierro  wrote:
> In general the bottleneck is the database access. The web2py DAL adds
> negligible overhead to that
>
>   http://web2py.com/AlterEgo/default/show/76
>
> People have tested web2py vs Pylons (which people says it is faster
> than Django and reddit.com uses it):
>
>   http://www.mail-archive.com/web2py@googlegroups.com/msg04120.html
>
> (these kind of results really depend on the app).
>
> If you use the internal web server, web2py  uses cherrypy's which is
> faster than the others python ones.
>
>   http://www.rkblog.rk.edu.pl/w/p/simple-python-frameworks-benchmark/
>
> (this is going to change since Tim wrote Rocket that is better than
> Cherrypy's and we are about to move to it).
>
> It would be nice to run more benchmarks.
>
> Massimo
>
> On Feb 25, 8:42 pm, Alfonso de la Guarda  wrote:
>> Hello,
>>
>> Right now, i have a costumer in the news business in my country which
>> expect, at least, 50 hits by day in their website.  Currently they
>> are using django as web framework but i wanna move some new apps to
>> web2py.  The questions are:
>>
>> How can I convince them to agree to take the course for new projects web2py?
>> There are statistics from sites with similar traffic web2py currently 
>> employing?
>> There is documentation of performance benchmarks among web2py, django,
>> ROR or PHP?
>> Someone has information, or has gone through the same problem?
>>
>> (A clarification: we have now developed small applications, but in
>> this case we speak of a large number of hits per day and that means
>> making a decision technically supported)
>>
>> Thanks in advance,
>>
>> 
>> Alfonso de la Guarda
>> Centro Open Source(COS)http://www.cos-la.nethttp://alfonsodg.net
>>    Telef. 991935157
>> 1024D/B23B24A4
>> 5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4
>
> --
> 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] can't get SSL/admin working on LAN (apache + mod_wsgi)

2010-02-26 Thread Thadeus Burgess
His


   Deny from all


Statement is correct. Remember he is using port 8080 as a substitute
for port 80. SO he does not want access to admin under https, hence
the Deny  from all in the HTTP Vritualhost.

This is why his SSL VirtualHost does not have this statement, since
its ssl it allows access to /admin. The problem is he has mapped it to
port 443 (which is the standard, so you don't have to specify port)
but trying to access it at

https://exmaple.com:8080 which is incorrect it should not have the
:8080 in it OR he should remap SSL to another port aside from 8080
which is already being used by the first virtualhost declaration.

-Thadeus





On Fri, Feb 26, 2010 at 4:21 PM, Tim Alexander  wrote:
> Not sure why this isn't going through off the google groups page, but I'll
> just reply via email.
> The problem centers around the port you're hitting it on. You have admin
> access disabled on 8080 via the below lines:
>
>        
>                Deny from all
>        
> that's why http://myserverIP:8080 doesn't work when clicking on the link.
> The reason https://myserverIP:8080/admin doesn't work, is because you're
> trying to access the http port via https. To visit myserverIP on port 443,
> go to https://myserverIP/admin since https defaults to port 443 on all
> current browsers. If you want to specify a port, feel free to
> do https://myserverIP:443/admin
> Either of those will get you in. Also, shouldn't be any issues just doing
> everything over https, via https://myserverIP/ that's how I'm currently
> running everything.
> On Fri, Feb 26, 2010 at 4:06 PM, snfctech  wrote:
>>
>> apache2 fedora10 web2py1.75.5
>>
>> I set up my web2py.conf virtual host file per the instructions on
>> p285-288 of the web2py book (2nd edition).  The main differences from
>> the examples are that I'm running Fedora10 and serving web2py on port
>> 8080 for access over a LAN.  I also removed "display-name=%{GROUP}"
>> from the WSGIDaemonProcess directive, per a thread I found on this
>> group.
>>
>> I can hit the welcome app fine from other machines by hitting
>> http://myserverIP:8080.  When I click on the link for the
>> administrative interface, I get a 403 error.  When I hit
>> https://myserverIP:8080/admin I get a 303 error "The connection to
>> myserverIP:8080 was interrupted while the page was loading."
>>
>> I'm pretty stuck at this point.  Any help would be greatly
>> appreciated.
>>
>> Here is my web2py.conf:
>>
>> 
>>
>>        ServerName web2py.order-system.com
>>        WSGIDaemonProcess web2py user=apache group=apache
>>        WSGIProcessGroup web2py
>>        WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>>
>>        
>>                AllowOverride None
>>                Order Allow,Deny
>>                Deny from all
>>                
>>                        Allow from all
>>                
>>        
>>
>>        AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
>> static/$2
>>
>>        
>>                Order Allow,Deny
>>                Allow from all
>>        
>>
>>        
>>                Deny from all
>>        
>>
>>        
>>                Deny from all
>>        
>>
>>        ErrorLog logs/web2py-error_log
>>        CustomLog logs/web2py-access_log common
>>
>> 
>>
>> LoadModule ssl_module modules/mod_ssl.so
>> NameVirtualHost *:443
>>
>> 
>>
>>        ServerName web2py.order-system.com
>>        SSLEngine on
>>        SSLCertificateFile /etc/httpd/ssl/server.crt
>>        SSLCertificateKeyFile /etc/httpd/ssl/server.key
>>
>>        WSGIProcessGroup web2py
>>
>>        WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>>
>>        
>>                AllowOverride None
>>                Order Allow,Deny
>>                Deny from all
>>                
>>                        Allow from all
>>                
>>        
>>
>>        AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/
>> static/$2
>>
>>        
>>                Order Allow,Deny
>>                Allow from all
>>        
>>
>>        ErrorLog logs/web2py-error_log
>>        CustomLog logs/web2py-access_log common
>>
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> 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...@

[web2py] Cron issue with recent web2py?

2010-02-26 Thread Iceberg
Well, I didn't have enough investigation yet, just posting a quick
question here.

Does anybody else who, upgraded to recent 1.75.x version of web2py,
running it in on Windows, and notice that it starts 5 more python
processes at the beginning of every minute, last for about 10 seconds?
During that 10 seconds, my CPU usage percentage reaches 100%, and even
slow to react normal use. I can tolerant that on my laptop with
WindowsXP as a developing environment, don't know yet whether it will
be same on my linux production server.

Of course, when using web2py -N is merely a workaround, I tried that.
But that is not a real solution to the problem. :-/

Regards,
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.



[web2py] Re: Does fake_migrate work?

2010-02-26 Thread villas
@Thadeus,  Thanks for such a comprehensive and helpful answer.

I did get fake_migrate to work eventually,  I had been blocking it
with another problem in my code.  That aside, part of my confusion was
that the latter two combinations you mention do the same. I suppose
one simply has to remember that fake_migrate is given precedence when
True.

Much appreciated!  D

-- 
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] Bug and fix in appadmin.py 's ccache()

2010-02-26 Thread Iceberg
Recent web2py contains a cache statistics page in appadmin. That is
good!

But so far, the total Hit Ratio is calculated as:
  total['ratio'] = (ram['ratio'] + disk['ratio']) / 2

that doesn't feel right. Think about that when a scenario only uses
cache.ram or only uses cache.disk, then the total ratio is just half
of the actual value! Doesn't make sense.

Should change to:
try:
total['ratio'] = total['hits'] * 100 / (total['hits'] +
total['misses'])
except:
total['ratio'] = 0


Regards,
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.



Re: [web2py] Cron issue with recent web2py?

2010-02-26 Thread Thadeus Burgess
I am running linux, development trunk and do not receive this. Perhaps
a windows only issue?
-Thadeus





On Fri, Feb 26, 2010 at 7:50 PM, Iceberg  wrote:
> Well, I didn't have enough investigation yet, just posting a quick
> question here.
>
> Does anybody else who, upgraded to recent 1.75.x version of web2py,
> running it in on Windows, and notice that it starts 5 more python
> processes at the beginning of every minute, last for about 10 seconds?
> During that 10 seconds, my CPU usage percentage reaches 100%, and even
> slow to react normal use. I can tolerant that on my laptop with
> WindowsXP as a developing environment, don't know yet whether it will
> be same on my linux production server.
>
> Of course, when using web2py -N is merely a workaround, I tried that.
> But that is not a real solution to the problem. :-/
>
> Regards,
> 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] Bug and fix in appadmin.py 's ccache()

2010-02-26 Thread Thadeus Burgess
Thanks Iceberg, I did not see this when I originally coded it but you are right!

I sent a patch to Massimo.

-Thadeus





On Fri, Feb 26, 2010 at 8:07 PM, Iceberg  wrote:
> Recent web2py contains a cache statistics page in appadmin. That is
> good!
>
> But so far, the total Hit Ratio is calculated as:
>  total['ratio'] = (ram['ratio'] + disk['ratio']) / 2
>
> that doesn't feel right. Think about that when a scenario only uses
> cache.ram or only uses cache.disk, then the total ratio is just half
> of the actual value! Doesn't make sense.
>
> Should change to:
>    try:
>        total['ratio'] = total['hits'] * 100 / (total['hits'] +
> total['misses'])
>    except:
>        total['ratio'] = 0
>
>
> Regards,
> 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.



[web2py] Re: uWSGI + Cherokee + web2py - a howto.

2010-02-26 Thread Thadeus
What if I want

example.com/app/static
example.com/app2/static

What exact rule do I use for this situation?

On Feb 24, 12:37 am, GrayMatterComputing 
wrote:
> Open theCherokeeAdmin -> General -> Server Permissions. There you
> are :)
>
> Cherokeewill respond in the priority order you have set for the
> virtual servers and behaviors. It will evaluate only the first rule in
> the list that matches. For example, if you had a static content rule
> for the directory "/static" and web2py was the default, a request for
> "example.com/stuff" would pass to web2py, while  "example.com/static/
> stuff" would be evaluated by the static content rule.
>
> On Feb 22, 2:40 pm, Thadeus Burgess  wrote:
>
> > How do you tell what usercherokeegets executed as when the server boots up?
>
> > In my typical installation I have a generic user account (like
> > "servant") that everything server related exists in this home
> > directory, and it owns everything. With Apache I have to chown/mod the
> > files so that www-data can read them.
>
> > I need to use a user account instead of www-data since mercurial is 
> > involved.
>
> > As far as static file streaming, doescherokeeintercept web2py file serving?
>
> > Is there a way to tellcherokeeto serve all requests to the "static"
> > folder without even going through web2py?
>
> > -Thadeus
>
> > On Fri, Feb 5, 2010 at 4:45 AM, Ivan P  wrote:
> > > Sorry for the delayed response.
> > > I think that usually means that your permissions are not set. Make
> > > sure thatuwsgiis running under the same user that owns your web2py
> > > directory. The error is unknown cause web2py cannot open the error
> > > file, because it cannot write it to disc.
>
> > > On Jan 27, 3:56 pm, Adi  wrote:
> > >> Hi Ivan,
>
> > >> I followed this howto, and when I try to access the application I get
> > >> an internal error thrown by web2py:
> > >> Ticket issued: unknown
>
> > >> Any idea how to read contents of this ticket to debug?
>
> > >> On Jan 15, 3:14 am, Ivan P  wrote:
>
> > >> > Inspired by Phyo Arkar's howto on setting up web2py withCherokeeand
> > >> > FCGI I tried the setup, but was somewhat unsatisfied with the fcgi
> > >> > method and decided to tryuWSGI. I am happy I did so, since it proved
> > >> > to be real easy anduWSGIis a real powerhouse and deserves attention
> > >> > of the whole python webdev community. On to the howto.
>
> > >> > I. Compile from source and run the latestuWSGI, 0.9.3 in my case
> > >> > (available herehttp://projects.unbit.it/uwsgi/wiki).
> > >> > 1. Download the source from and unzip.
>
> > >> > 2. To compile you must install packages python-dev and libxml2-dev (at
> > >> > least thats what they are called on a debian-based system)
>
> > >> > 3. When compiling simply run pick a makefile which matches your OS and
> > >> > python version and run something like "make -f Makefile.Linux.Py26".
> > >> > This produces only one executable named uwsgi26, where 26 is my python
> > >> > version. You can put it in /usr/local/bin.
>
> > >> > 5. To run it, you have two options:
>
> > >> > 5a) Create an xml file and call it, for example, config.xml. Put
> > >> > something like this in it:
> > >> > 
> > >> >     /var/web2py/
> > >> >     
> > >> >     wsgihandler
> > >> >     
> > >> > 
> > >> > In this file "pythonpath" is where your web2py directory is and
> > >> > "script" is the file you want to run, in this case its web2py's
> > >> > "wsgihandler.py". Now runuWSGIlike this, but replace "www-data" with
> > >> > the owner of your web2py directory, if its the same as your current
> > >> > user omit the sudo command:
> > >> > sudo -u www-data uwsgi26 -s /tmp/uwsgi.sock -C -x config.xml
> > >> > Why you need to change user is because web2py writes things (session
> > >> > data for example) to disc during execution, so theuwsgiprocess,
> > >> > which runs the web2py code, has to be the owner of the directories
> > >> > that contain the framework. Note thatuwsginow opened a socket we
> > >> > called "/tmp/uwsgi.sock" About other options consult theuwsgimanual
> > >> > or "uwsgi-h".
>
> > >> > 5b) You can omit the xml file and pass all the info via command line,
> > >> > doing that is easy, so consult theuwsgidocs :)
>
> > >> > II. Setting upcherokee(0.99.37 in my case).
> > >> > 1. Install it, runcherokee-admin, go to localhost:9090
>
> > >> > 2. Open "Information Sources" and create a new one with these
> > >> > parameters:
> > >> > Nick: web2py
> > >> > Connection: /tmp/uwsgi.sock
> > >> > Interpreter: uwsgi26 -s /tmp/uwsgi.sock -C -x /path/to/config.xml
> > >> > The interpreter line is why it is a good idea to have your web2py
> > >> > source owned by www-data or theCherokeeserver's user - whencherokee
> > >> > runs it, you can be sure that owners of the sources and process match.
> > >> > And of  course put the correct path in.
>
> > >> > 3. Go to "Virtual Servers" and edit the default one, or you can create
> > >> > a new one, but make sure you give it a domain name to avoid conf

[web2py] Re: Recaptcha doesn't play nice with crud

2010-02-26 Thread hamdy.a.farag
Hi

The reason for this is that any field added to a form needs to be
added b4 if form.accepts() so that validation can work , otherwise
validation will not work
in case of "crud" , accepting form is already done for you in web2py's
code and actually b4 inserting the new field
and thus validation will not work

-- 
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] Is 'source' a reserved word?

2010-02-26 Thread Joe Barnhart
I dusted off some wiki code I was playing with awhile ago and tried it under
the latest version of web2py.  I'm getting KeyError exceptions on the string
"source" which I used as a variable name.  Has there been some reserved
words added to web2py?  It is not an insurmountable problem to change the
variable names, but it occurs in a bunch of places and will be tedious.

I realize I may be barking up the wrong tree.  Perhaps it is Python which
now considers the string 'source' as special...

Sample traceback:

Traceback (most recent call last):
  File "/Users/joeb/Work/web2py/gluon/restricted.py", line 173, in restricted
exec ccode in environment
  File "/Users/joeb/Work/web2py/applications/wiki/controllers/default.py"
,
line 147, in 
  File "/Users/joeb/Work/web2py/gluon/globals.py", line 96, in 
self._caller = lambda f: f()
  File "/Users/joeb/Work/web2py/applications/wiki/controllers/default.py"
,
line 45, in edit
src=db(db.source.uuid==page.source_uuid).select()[0]
  File "/Users/joeb/Work/web2py/gluon/sql.py", line 1295, in __getattr__
return dict.__getitem__(self,key)
KeyError: 'source'

-- 
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] Is 'source' a reserved word?

2010-02-26 Thread Jonathan Lundell
On Feb 26, 2010, at 11:43 PM, Joe Barnhart wrote:

> I dusted off some wiki code I was playing with awhile ago and tried it under 
> the latest version of web2py.  I'm getting KeyError exceptions on the string 
> "source" which I used as a variable name.  Has there been some reserved words 
> added to web2py?  It is not an insurmountable problem to change the variable 
> names, but it occurs in a bunch of places and will be tedious.
> 
> I realize I may be barking up the wrong tree.  Perhaps it is Python which now 
> considers the string 'source' as special...

Pythin is saying that it's not finding 'source' as a key. Do you have a table 
named 'source'?

> 
> Sample traceback:
> 
> Traceback (most recent call last):
>   File "/Users/joeb/Work/web2py/gluon/restricted.py", line 173, in restricted
> 
> exec ccode in environment
>   File "/Users/joeb/Work/web2py/applications/wiki/controllers/default.py", 
> line 147, in 
> 
>   File "/Users/joeb/Work/web2py/gluon/globals.py", line 96, in 
> 
> self._caller = lambda f: f()
> 
>   File "/Users/joeb/Work/web2py/applications/wiki/controllers/default.py", 
> line 45, in edit
> 
> src=db(db.source.uuid==page.source_uuid).select()[0]
> 
>   File "/Users/joeb/Work/web2py/gluon/sql.py", line 1295, in __getattr__
> 
> return dict.__getitem__(self,key)
> 
> KeyError: 'source'
> 
> 
> -- 
> 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.