Massimo Di Pierro | 1 Sep 01:16 2011
Picon

Re: GAE select all does not iterate

I am not sure where you are printing to (console, logs, html page) but
one problem may be that if you view the output into an HTML document
rows are displayed as <Row {...}> and your browser thinks this is a
tag, does not understand it and makes it invisible.

On Aug 31, 11:19 am, Arbie Samong <phek...@...> wrote:
> Update: Following christian's example, it seems that looping over the
> Rows object in controller does nothing, but looping over it on the
> view is working.
>
> My controllers and models are almost exactly the same, at least the
> fields that are affected. I am testing on localhost:8080 first,
> although same results in GAE production. I print out stuff on
> localhost:8080, it works although it breaks the page and displays
> withing <pre> tags (ala php die ;-P), so I can see variables. I can
> see the Rows object and the fetched records, but when I iterate over
> them nothing happens.
>
> # controller
> profiles =
> db(db.userprofile.created).select(orderby=~db.userprofile.created,
> limitby=(0,20))
> print profiles # no problem, I see the profiles object
> print len(profiles) # still OK
>
> for profile in profiles:
>   print profile # here nothing happens
>
> # view
> <h1>profiles</h1>
(Continue reading)

Massimo Di Pierro | 1 Sep 01:18 2011
Picon

Re: How can i create my own CAS provider?

def user(): return dict(form=auth())

exposes the CAS provider. There is nothing special to do as long as
the consumer run on the same domain.

On Aug 31, 1:38 pm, nekrox <nek...@...> wrote:
> I have some apps and use the same database for share a auth system. I
> prefer to use CAS and have my own provider for my apps, but do not
> quite understand how to do as the documentation says, someone will
> have an example?
>
> Regards

Massimo Di Pierro | 1 Sep 01:39 2011
Picon

Re: testing scheduler in windows

Trying to isolate the problem... can any windows user run the
following test for me?

get trunk
cd web2py/gluon
python2.6 meta_scheduler.py

(python 2.7 should be ok too)
you should get the following text repeated ...
--- begin ----
starting task
task started
thum
thum
thum
thum
thum
reporting task
--- end ---
after a few cycles press [ctrl+c]. Do you get a traceback? Do all new
task - reporting task pair up in the output?

Massimo

On Aug 31, 8:45 am, António Ramos <ramstei...@...> wrote:
> the -K option is only for 2.6 but with python  2.6 i have that screenshot
> with error until i break it with ctrl c
> after that the task runs only the first time and not the other 2 as your
> demo on Vimeo
>
(Continue reading)

Noel Villamor | 1 Sep 02:03 2011
Picon

Bug in TR when rendering an array

To reproduce, create a view with the ff contents:

<style type="text/css">
td {
border-width: 5px;
border-color: #000080;
border-style: solid;
}
</style>

{{arr=['second','third']}}
{{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}

HTML result:

<table>
<tbody>
<tr>
<td>first</td>
<td></td>       <-- This extra td should not be here
<td>second</td>
<td>third</td>
</tr>
</tbody>
</table>

Remarks:

The bug does not show if there is no TD before the TD array. Thus, the
following is OK.
(Continue reading)

Anthony | 1 Sep 02:10 2011
Picon

Re: testing scheduler in windows

On Windows 7 with Python 2.7, I get an immediate traceback, and then the thum's start -- but it just keeps going without getting to a "reporting task". Here's the entire output (I broke this one after 11 thum's, but ran another one for over 30 thum's):


thumnew task

starting task
Traceback (most recent call last):
  File "meta_scheduler.py", line 140, in <module>
    MetaScheduler().loop()
  File "meta_scheduler.py", line 133, in loop
    self.report_task(task,self.async(task))
  File "meta_scheduler.py", line 56, in async
    p.start()
  File "C:\Python27\lib\multiprocessing\process.py", line 104, in start
    self._popen = Popen(self)
  File "C:\Python27\lib\multiprocessing\forking.py", line 244, in __init__
    dump(process_obj, to_child, HIGHEST_PROTOCOL)
  File "C:\Python27\lib\multiprocessing\forking.py", line 167, in dump
    ForkingPickler(file, protocol).dump(obj)
  File "C:\Python27\lib\pickle.py", line 224, in dump
    self.save(obj)
  File "C:\Python27\lib\pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 419, in save_reduce
    save(state)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
    self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\pickle.py", line 681, in _batch_setitems
    save(v)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\multiprocessing\forking.py", line 40, in dispatcher
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 401, in save_reduce
    save(args)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 548, in save_tuple
    save(element)
  File "C:\Python27\lib\pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 419, in save_reduce
    save(state)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\multiprocessing\forking.py", line 347, in main
  File "C:\Python27\lib\pickle.py", line 681, in _batch_setitems
        self = load(from_parent)
save(v)
  File "C:\Python27\lib\pickle.py", line 1378, in load
  File "C:\Python27\lib\pickle.py", line 331, in save
        return Unpickler(file).load()
self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 858, in load
  File "C:\Python27\lib\pickle.py", line 419, in save_reduce
    save(state)
  File "C:\Python27\lib\pickle.py", line 286, in save
    dispatch[key](self)
      File "C:\Python27\lib\pickle.py", line 880, in load_eof
f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
    raise EOFError
EOFError
self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\pickle.py", line 681, in _batch_setitems
    save(v)
  File "C:\Python27\lib\pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 396, in save_reduce
    save(cls)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 748, in save_global
    (obj, module, name))
pickle.PicklingError: Can't pickle <type 'thread.lock'>: it's not found as thread.lock
thum
thum
thum
thum
thum
thum
thum
thum
thum
thum
thum
^C


Anthony


On Wednesday, August 31, 2011 7:39:51 PM UTC-4, Massimo Di Pierro wrote:
Trying to isolate the problem... can any windows user run the
following test for me?

get trunk
cd web2py/gluon
python2.6 meta_scheduler.py

(python 2.7 should be ok too)
you should get the following text repeated ...
--- begin ----
starting task
task started
thum
thum
thum
thum
thum
reporting task
--- end ---
after a few cycles press [ctrl+c]. Do you get a traceback? Do all new
task - reporting task pair up in the output?

Massimo

On Aug 31, 8:45 am, António Ramos <ramst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> the -K option is only for 2.6 but with python  2.6 i have that screenshot
> with error until i break it with ctrl c
> after that the task runs only the first time and not the other 2 as your
> demo on Vimeo
>
> Thanks
>
> 2011/8/31 Massimo Di Pierro <massimo....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
>
>
>
>
>
>
> > Did the previous version work?
>
> > On Aug 31, 4:11 am, António Ramos <ramst... <at> gmail.com> wrote:
> > > i reported the same problem.
> > > Web2py works very well so far except this sheduler.
> > > I have windows 7 machine and python 2.6 and 2.7
>
> > > 2011/8/31 Massimo Di Pierro <massimo....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> > > > Do you have these errors only with the scheduler?
> > > > Does everything else in web2py works well?
>
> > > > I am rewriting the scheduler completely but there seems problems with
> > > > the multiprocessing module.
> > > > I think the problem is due to this:
>
> > > >http://stackoverflow.com/questions/3405397/python-multiprocessing-doe.
> > ..
>
> > > > Massimo
>
> > > > On Aug 30, 11:25 pm, Brian M <bmer... <at> gmail.com> wrote:
> > > > > Similar results with a fresh install of Python 2.7.2 I don't think
> > this
> > > > is
> > > > > just due to a bad python install.
Anthony | 1 Sep 02:18 2011
Picon

Re: Bug in TR when rendering an array

The problem is you are passing a list of TD's to TR instead of individual TD's. Instead, try this:


{{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}} 


Notice the "*" before the list comprehension -- that converts the list to a set of positional arguments.

Anthony


On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote:
To reproduce, create a view with the ff contents:

<style type="text/css">
td {
border-width: 5px;
border-color: #000080;
border-style: solid;
}
</style>

{{arr=['second','third']}}
{{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}


HTML result:

<table>
<tbody>
<tr>
<td>first</td>
<td></td>       <-- This extra td should not be here
<td>second</td>
<td>third</td>
</tr>
</tbody>
</table>


Remarks:

The bug does not show if there is no TD before the TD array. Thus, the
following is OK.
{{=TABLE(TR([TD(x) for x in arr]))}}

Noel Villamor | 1 Sep 02:31 2011
Picon

Re: Bug in TR when rendering an array


Just when I thought I have helped find a bug, I am faced with the
revelation that I need to hone my python some more. He he he.

Thanks Anthony.

On Sep 1, 12:18 pm, Anthony <abasta...@...> wrote:
> The problem is you are passing a list of TD's to TR instead of individual
> TD's. Instead, try this:
>
> {{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}}
>
> Notice the "*" before the list comprehension -- that converts the list to a
> set of positional arguments.
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote:
>
> > To reproduce, create a view with the ff contents:
>
> > <style type="text/css">
> > td {
> > border-width: 5px;
> > border-color: #000080;
> > border-style: solid;
> > }
> > </style>
>
> > {{arr=['second','third']}}
> > {{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}
>
> > HTML result:
>
> > <table>
> > <tbody>
> > <tr>
> > <td>first</td>
> > <td></td>       <-- This extra td should not be here
> > <td>second</td>
> > <td>third</td>
> > </tr>
> > </tbody>
> > </table>
>
> > Remarks:
>
> > The bug does not show if there is no TD before the TD array. Thus, the
> > following is OK.
> > {{=TABLE(TR([TD(x) for x in arr]))}}

Noel Villamor | 1 Sep 02:50 2011
Picon

Re: Bug in TR when rendering an array


By the way, the reason why I stumbled on this is because I wanted to
add a fourth TD to my test case.

{{=TABLE(TR(TD('first'),*[TD(x) for x in arr],TD('fourth')))}}
or more simply
{{=TABLE(TR(TD('first'),*arr,TD('fourth')))}}

But, this results to
SyntaxError: only named arguments may follow *expression

The syntax appears reasonable to me. Perhaps in the future, developers
would consider allowing this.

On Sep 1, 12:31 pm, Noel Villamor <noe...@...> wrote:
> Just when I thought I have helped find a bug, I am faced with the
> revelation that I need to hone my python some more. He he he.
>
> Thanks Anthony.
>
> On Sep 1, 12:18 pm, Anthony <abasta...@...> wrote:
>
>
>
>
>
>
>
> > The problem is you are passing a list of TD's to TR instead of individual
> > TD's. Instead, try this:
>
> > {{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}}
>
> > Notice the "*" before the list comprehension -- that converts the list to a
> > set of positional arguments.
>
> > Anthony
>
> > On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote:
>
> > > To reproduce, create a view with the ff contents:
>
> > > <style type="text/css">
> > > td {
> > > border-width: 5px;
> > > border-color: #000080;
> > > border-style: solid;
> > > }
> > > </style>
>
> > > {{arr=['second','third']}}
> > > {{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}
>
> > > HTML result:
>
> > > <table>
> > > <tbody>
> > > <tr>
> > > <td>first</td>
> > > <td></td>       <-- This extra td should not be here
> > > <td>second</td>
> > > <td>third</td>
> > > </tr>
> > > </tbody>
> > > </table>
>
> > > Remarks:
>
> > > The bug does not show if there is no TD before the TD array. Thus, the
> > > following is OK.
> > > {{=TABLE(TR([TD(x) for x in arr]))}}

Anthony | 1 Sep 02:53 2011
Picon

Re: Bug in TR when rendering an array

By the way, the reason you got the output you did is because TR expects its positional arguments to be TD's, and if they are not, it wraps them in a TD. In your case, your second positional argument was a list, so TR wrapped it in a TD for you (it turned out that your list itself contained two TD's, so they ended up inside another TD).


Anthony

On Wednesday, August 31, 2011 8:31:09 PM UTC-4, Noel Villamor wrote:

Just when I thought I have helped find a bug, I am faced with the
revelation that I need to hone my python some more. He he he.

Thanks Anthony.


On Sep 1, 12:18 pm, Anthony <abas...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The problem is you are passing a list of TD's to TR instead of individual
> TD's. Instead, try this:
>
> {{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}}
>
> Notice the "*" before the list comprehension -- that converts the list to a
> set of positional arguments.
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote:
>
> > To reproduce, create a view with the ff contents:
>
> > <style type="text/css">
> > td {
> > border-width: 5px;
> > border-color: #000080;
> > border-style: solid;
> > }
> > </style>
>
> > {{arr=['second','third']}}
> > {{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}
>
> > HTML result:
>
> > <table>
> > <tbody>
> > <tr>
> > <td>first</td>
> > <td></td>       <-- This extra td should not be here
> > <td>second</td>
> > <td>third</td>
> > </tr>
> > </tbody>
> > </table>
>
> > Remarks:
>
> > The bug does not show if there is no TD before the TD array. Thus, the
> > following is OK.
> > {{=TABLE(TR([TD(x) for x in arr]))}}
Jonathan Lundell | 1 Sep 02:55 2011
Picon

Re: Re: Bug in TR when rendering an array

On Aug 31, 2011, at 5:50 PM, Noel Villamor wrote:

> 
> By the way, the reason why I stumbled on this is because I wanted to
> add a fourth TD to my test case.
> 
> {{=TABLE(TR(TD('first'),*[TD(x) for x in arr],TD('fourth')))}}
> or more simply
> {{=TABLE(TR(TD('first'),*arr,TD('fourth')))}}
> 
> But, this results to
> SyntaxError: only named arguments may follow *expression
> 
> The syntax appears reasonable to me. Perhaps in the future, developers
> would consider allowing this.

You can, I think, supply a list of TDs to TR. The problem in your example is that you had a bare TD followed by a
list of TDs.

Instead of 

{{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}

you could probably have said this:

{{=TABLE(TR([TD('first')] + [TD(x) for x in arr]))}}

> 
> On Sep 1, 12:31 pm, Noel Villamor <noe...@...> wrote:
>> Just when I thought I have helped find a bug, I am faced with the
>> revelation that I need to hone my python some more. He he he.
>> 
>> Thanks Anthony.
>> 
>> On Sep 1, 12:18 pm, Anthony <abasta...@...> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> The problem is you are passing a list of TD's to TR instead of individual
>>> TD's. Instead, try this:
>> 
>>> {{=TABLE(TR(TD('first'),*[TD(x) for x in arr]))}}
>> 
>>> Notice the "*" before the list comprehension -- that converts the list to a
>>> set of positional arguments.
>> 
>>> Anthony
>> 
>>> On Wednesday, August 31, 2011 8:03:48 PM UTC-4, Noel Villamor wrote:
>> 
>>>> To reproduce, create a view with the ff contents:
>> 
>>>> <style type="text/css">
>>>> td {
>>>> border-width: 5px;
>>>> border-color: #000080;
>>>> border-style: solid;
>>>> }
>>>> </style>
>> 
>>>> {{arr=['second','third']}}
>>>> {{=TABLE(TR(TD('first'),[TD(x) for x in arr]))}}
>> 
>>>> HTML result:
>> 
>>>> <table>
>>>> <tbody>
>>>> <tr>
>>>> <td>first</td>
>>>> <td></td>       <-- This extra td should not be here
>>>> <td>second</td>
>>>> <td>third</td>
>>>> </tr>
>>>> </tbody>
>>>> </table>
>> 
>>>> Remarks:
>> 
>>>> The bug does not show if there is no TD before the TD array. Thus, the
>>>> following is OK.
>>>> {{=TABLE(TR([TD(x) for x in arr]))}}


Gmane