[web2py:23655] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov

new testing:

 SERVER KERNEL 
--prints
r8750.04898
r822ini 0.03070 1.60x
--silent
r8750.04914
r822ini 0.03049 1.61x

So I get much more consistent results on this hardware.
While this is obviously not the best perfomance (my weaker box,
with less RAM, troubled with video output 1280x1024,
software 90deg rotation - performs BETTER), that does not matter.
What does - is that I can now be sure that these results are
noise-free so I can safely compare timings from various patches.
Proceeding with writing 'inits v2'.


On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov wrote:
> Ok. Now the confusion is resolved.
> 1) Speed improvements of 70% and up that I reported yesterday are
> really exist. I just reproduced a 3.47 times model speedup and 2.15
> overall speedup for my app (r875 vs r822+inits).
> BUT this app is atypical. I have added some time measuring code there
> so it prints out two lines per each model init. So when I am testing
> perfomance - screen very quickly scrolls up
>
> 2) Simply commenting out two print statements gives me only 1.67
> overall speedup given equal other conditions. I think that processor
> receive additional interrupts from videocard that in turn results in
> more often checks of tasks queue.
>
> 3) I declare all my previous testing results spoiled by noise
> generated by print statement and inappropriate kernel scheduler
> setting.
> I've set up yet another test box with these parameters:
>
> Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
> 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
> but it appeared to be unstable on that hardware (and afterall - it's
> for sound/video processing and 'server' type is more likely to be
> installed on servers).
>
> Will report new testing results (and finally I hope to write
> 'optimised inits ver.2' patch) later today.
>
> On Tue, Jun 9, 2009 at 5:14 AM, mdipierro wrote:
>>
>> Please try launchpad 893. I think it should be faster on GAE.
>> We can do better with lazy tables but at least the validators and
>> calls to getitem are eliminated.
>>
>> Massimo
>>
>> On Jun 8, 1:05 pm, Markus Gritsch  wrote:
>>> On Mon, Jun 8, 2009 at 5:54 PM, mdipierro wrote:
>>>
>>> > the web2py in trunk can execute models 2.5x faster than the current
>>> > stable/production version (requires migrate=False and bytecode
>>> > compiled models).
>>>
>>> Will this speedup also has an effect on GAE?  IMO one uploads no .pyc files?
>>>
>>> Markus
>> >>
>>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23656] Re: web2py perfomance

2009-06-09 Thread Yarko Tymciurak
it might help to have tests in a state that you can ask others to run them;
  a dozen or so other random boxes will help you gain the confidence you
seek I think

On Tue, Jun 9, 2009 at 2:12 AM, Alexey Nezhdanov  wrote:

>
> new testing:
>
>  SERVER KERNEL 
> --prints
> r8750.04898
> r822ini 0.03070 1.60x
> --silent
> r8750.04914
> r822ini 0.03049 1.61x
>
> So I get much more consistent results on this hardware.
> While this is obviously not the best perfomance (my weaker box,
> with less RAM, troubled with video output 1280x1024,
> software 90deg rotation - performs BETTER), that does not matter.
> What does - is that I can now be sure that these results are
> noise-free so I can safely compare timings from various patches.
> Proceeding with writing 'inits v2'.
>
>
> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov
> wrote:
> > Ok. Now the confusion is resolved.
> > 1) Speed improvements of 70% and up that I reported yesterday are
> > really exist. I just reproduced a 3.47 times model speedup and 2.15
> > overall speedup for my app (r875 vs r822+inits).
> > BUT this app is atypical. I have added some time measuring code there
> > so it prints out two lines per each model init. So when I am testing
> > perfomance - screen very quickly scrolls up
> >
> > 2) Simply commenting out two print statements gives me only 1.67
> > overall speedup given equal other conditions. I think that processor
> > receive additional interrupts from videocard that in turn results in
> > more often checks of tasks queue.
> >
> > 3) I declare all my previous testing results spoiled by noise
> > generated by print statement and inappropriate kernel scheduler
> > setting.
> > I've set up yet another test box with these parameters:
> >
> > Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
> > 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
> > but it appeared to be unstable on that hardware (and afterall - it's
> > for sound/video processing and 'server' type is more likely to be
> > installed on servers).
> >
> > Will report new testing results (and finally I hope to write
> > 'optimised inits ver.2' patch) later today.
> >
> > On Tue, Jun 9, 2009 at 5:14 AM, mdipierro
> wrote:
> >>
> >> Please try launchpad 893. I think it should be faster on GAE.
> >> We can do better with lazy tables but at least the validators and
> >> calls to getitem are eliminated.
> >>
> >> Massimo
> >>
> >> On Jun 8, 1:05 pm, Markus Gritsch  wrote:
> >>> On Mon, Jun 8, 2009 at 5:54 PM, mdipierro
> wrote:
> >>>
> >>> > the web2py in trunk can execute models 2.5x faster than the current
> >>> > stable/production version (requires migrate=False and bytecode
> >>> > compiled models).
> >>>
> >>> Will this speedup also has an effect on GAE?  IMO one uploads no .pyc
> files?
> >>>
> >>> Markus
> >> >>
> >>
> >
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23657] Re: jython again

2009-06-09 Thread Fran

On Jun 9, 7:42 am, mdipierro  wrote:
> I know I need to install sqlite-jdbc-3.6.14.2.jar but I have no idea
> what to do with it. help?

May help:
http://wiki.python.org/jython/JythonFaq/InstallingJython#JythoncannotfindyourJavaclass.2Ceventhoughitexistsintheclasspath.

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23658] Re: how to get main web2py directory?

2009-06-09 Thread SergeyPo

When it runs as windows service it shows, well, not python, I was
wrong, it shows the path to that utility that is used to run as
service... I think if request.env.web2py_path always gives realpath to
web2py directory that would be enough.


On Jun 9, 10:44 am, mdipierro  wrote:
> I am not convinced. why should it find applications and not find its
> own path?
> anyway, where do you think it should go?
>
> massimo
>
> On Jun 9, 1:04 am, SergeyPo  wrote:
>
>
>
> > There are problems with these in Windows when web2py is run as
> > service. They show path to python.
> > After many trials I came to this ugly solution:
>
> > import applications.advantage.modules.pathfinder as pathfinder
> > PATH_TO_ME = os.path.dirname( os.path.realpath( pathfinder.__file__ ))
>
> > Here 'pathfinder' is any module, even empty one.
>
> > On Jun 8, 4:41 pm, mdipierro  wrote:
>
> > > request.folder is the path to your app
> > > request.env.web2py_path is the path to web2py
>
> > > On Jun 8, 3:08 am, mika  wrote:
>
> > > > I would like to get the main web2py path, so I could just for example
> > > > add 'applications/my_app/generated_files/1.txt'  to make the complete
> > > > path for file that will be created. Are there some environmetal paths
> > > > or something like this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23659] Login_next

2009-06-09 Thread annet

Massimo,

r992 did not fix the login_next problem.

In db.py I have:

auth.settings.login_url=URL(r=request,c='authentication',f='login')
auth.settings.login_next=URL(r=request,c='core',f='index')
auth.settings.logout_next=URL(r=request,c='default',f='index')

In 1.61.4 the first two worked, in 1.63.5 with r992 ...


When on default/index, I choose login from the menu and login I am
redirected to default/index instead of core/index.


When I expose a function from appadmin, I am redirected to login, when
I login I am redirected to: http://127.0.0.1:8000/admin/default/design/cms,
instead of core/index


I also bookmarked the login page. When I login I am redirect to core/
index. However, when I logout and login again, I am redirected to
default/index.


So only when I login from outside web2py the login_next works
correctly.


I am looking forward to a fix of this problem.

Annet.




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23660] retrieve_username and retrieve_password

2009-06-09 Thread annet

In version 1.61.4 these settings sufficed to retrieve the username and
password:


## mailer
mail=Mail()

## specify your SMPT server
mail.settings.server='smtp.gmail.com:587'

## specify your email address
mail.settings.sender='@gmail.com'

## optional: specify your user name and password for SMTP
mail.settings.login='@gmail.com:...'


In 1.63.5 this in case of retrieve _username results in an error
ticket:

Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/web2py_1_63_5/gluon/
restricted.py", line 107, in restricted
exec ccode in environment
  File "/Library/Python/2.5/site-packages/web2py_1_63_5/applications/
cms/controllers/authentication.py", line 39, in 
  File "/Library/Python/2.5/site-packages/web2py_1_63_5/gluon/
globals.py", line 97, in 
self._caller = lambda f: f()
  File "/Library/Python/2.5/site-packages/web2py_1_63_5/applications/
cms/controllers/authentication.py", line 15, in retrieve_username
return dict(form=auth.retrieve_username())
  File "/Library/Python/2.5/site-packages/web2py_1_63_5/gluon/
tools.py", line 898, in retrieve_username
response.flash = self.messages.function_disabled
NameError: global name 'response' is not defined


... and in case of retrieve_password in a flash: function disabled.


What change in 1.63.5 causes these settings to no longer work.


Kind regards,

Annet


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23661] Re: problem with selfreference left outer join

2009-06-09 Thread Peter Etchells

prints:
SELECT dog.name, dog.name, dog.name FROM LEFT JOIN dog ON
dog.id=dog.father_id LEFT JOIN dog ON dog.id=dog.mother_id;

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23662] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov

You probably right. But I can't give away the project I'm testing it
on and don't yet 'ready' to write a separate one exclusively for
testing.

I'm still fighting with getting stable results even on this box :(

On Tue, Jun 9, 2009 at 11:17 AM, Yarko Tymciurak wrote:
> it might help to have tests in a state that you can ask others to run them;
>   a dozen or so other random boxes will help you gain the confidence you
> seek I think
>
> On Tue, Jun 9, 2009 at 2:12 AM, Alexey Nezhdanov  wrote:
>>
>> new testing:
>>
>>  SERVER KERNEL 
>> --prints
>> r875    0.04898
>> r822ini 0.03070 1.60x
>> --silent
>> r875    0.04914
>> r822ini 0.03049 1.61x
>>
>> So I get much more consistent results on this hardware.
>> While this is obviously not the best perfomance (my weaker box,
>> with less RAM, troubled with video output 1280x1024,
>> software 90deg rotation - performs BETTER), that does not matter.
>> What does - is that I can now be sure that these results are
>> noise-free so I can safely compare timings from various patches.
>> Proceeding with writing 'inits v2'.
>>
>>
>> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov
>> wrote:
>> > Ok. Now the confusion is resolved.
>> > 1) Speed improvements of 70% and up that I reported yesterday are
>> > really exist. I just reproduced a 3.47 times model speedup and 2.15
>> > overall speedup for my app (r875 vs r822+inits).
>> > BUT this app is atypical. I have added some time measuring code there
>> > so it prints out two lines per each model init. So when I am testing
>> > perfomance - screen very quickly scrolls up
>> >
>> > 2) Simply commenting out two print statements gives me only 1.67
>> > overall speedup given equal other conditions. I think that processor
>> > receive additional interrupts from videocard that in turn results in
>> > more often checks of tasks queue.
>> >
>> > 3) I declare all my previous testing results spoiled by noise
>> > generated by print statement and inappropriate kernel scheduler
>> > setting.
>> > I've set up yet another test box with these parameters:
>> >
>> > Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
>> > 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
>> > but it appeared to be unstable on that hardware (and afterall - it's
>> > for sound/video processing and 'server' type is more likely to be
>> > installed on servers).
>> >
>> > Will report new testing results (and finally I hope to write
>> > 'optimised inits ver.2' patch) later today.
>> >
>> > On Tue, Jun 9, 2009 at 5:14 AM, mdipierro
>> > wrote:
>> >>
>> >> Please try launchpad 893. I think it should be faster on GAE.
>> >> We can do better with lazy tables but at least the validators and
>> >> calls to getitem are eliminated.
>> >>
>> >> Massimo
>> >>
>> >> On Jun 8, 1:05 pm, Markus Gritsch  wrote:
>> >>> On Mon, Jun 8, 2009 at 5:54 PM, mdipierro
>> >>> wrote:
>> >>>
>> >>> > the web2py in trunk can execute models 2.5x faster than the current
>> >>> > stable/production version (requires migrate=False and bytecode
>> >>> > compiled models).
>> >>>
>> >>> Will this speedup also has an effect on GAE?  IMO one uploads no .pyc
>> >>> files?
>> >>>
>> >>> Markus
>> >> >>
>> >>
>> >
>>
>>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23663] Re: slides again

2009-06-09 Thread LordMax

Hi

On 7 Giu, 23:13, mdipierro  wrote:
> I did not realize one had to login. I will post it somewehere else
> too, together with source (ppt and keynote) asap.
>

wow.

There's alredy a link?

I would appreciate very much ppt or keynote version.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23664] Delete Content with Security question

2009-06-09 Thread pk

Hi together,

how can I delete a content (row) from the table with a security
question. for example: "Are you sure to delete the project? yes - no"

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23665] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov
Wrote 'optimised inits v2' patch. Tested everything.

Once again I changed my testing pattern a bit.

1) I dumped my own timing tool in favor of much more standard
'ab' (apache benchmark).

2) I decidedly will publish all these results in two main.
I just finished first round of testing. Here are results (reported
values are average request time in milliseconds. If anyone interested
- I'm attaching a full output from my console).
I will do all that testing again and publish same results again so
that the amount of noise in all this will be public and clearly
visible (here I'm fighting with my own temptation to rerun the tests
if timings seem to be 'too away' to me).

First four lines share my app's db.py. Last two require a modified
db.py, but modification is cosmetical - each define_table is put into
separate function and I do db.tablename=create_table_tablename after
each function. Model init time was not measured.

No more words. Dry figures only. Each line represents result of 10k requests.
r87546.025ms
r88221.048ms
inits v.1   18.918ms
inits v.2   18.122ms
inits1+lazyT16.032ms
inits2+lazyT14.391ms

P.S. I'm surprised about last line... Noise?

On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov wrote:
> new testing:
>
>  SERVER KERNEL 
> --prints
> r875    0.04898
> r822ini 0.03070 1.60x
> --silent
> r875    0.04914
> r822ini 0.03049 1.61x
>
> So I get much more consistent results on this hardware.
> While this is obviously not the best perfomance (my weaker box,
> with less RAM, troubled with video output 1280x1024,
> software 90deg rotation - performs BETTER), that does not matter.
> What does - is that I can now be sure that these results are
> noise-free so I can safely compare timings from various patches.
> Proceeding with writing 'inits v2'.
>
>
> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov wrote:
>> Ok. Now the confusion is resolved.
>> 1) Speed improvements of 70% and up that I reported yesterday are
>> really exist. I just reproduced a 3.47 times model speedup and 2.15
>> overall speedup for my app (r875 vs r822+inits).
>> BUT this app is atypical. I have added some time measuring code there
>> so it prints out two lines per each model init. So when I am testing
>> perfomance - screen very quickly scrolls up
>>
>> 2) Simply commenting out two print statements gives me only 1.67
>> overall speedup given equal other conditions. I think that processor
>> receive additional interrupts from videocard that in turn results in
>> more often checks of tasks queue.
>>
>> 3) I declare all my previous testing results spoiled by noise
>> generated by print statement and inappropriate kernel scheduler
>> setting.
>> I've set up yet another test box with these parameters:
>>
>> Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
>> 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
>> but it appeared to be unstable on that hardware (and afterall - it's
>> for sound/video processing and 'server' type is more likely to be
>> installed on servers).
>>
>> Will report new testing results (and finally I hope to write
>> 'optimised inits ver.2' patch) later today.
>>
>> On Tue, Jun 9, 2009 at 5:14 AM, mdipierro wrote:
>>>
>>> Please try launchpad 893. I think it should be faster on GAE.
>>> We can do better with lazy tables but at least the validators and
>>> calls to getitem are eliminated.
>>>
>>> Massimo
>>>
>>> On Jun 8, 1:05 pm, Markus Gritsch  wrote:
 On Mon, Jun 8, 2009 at 5:54 PM, mdipierro wrote:

 > the web2py in trunk can execute models 2.5x faster than the current
 > stable/production version (requires migrate=False and bytecode
 > compiled models).

 Will this speedup also has an effect on GAE?  IMO one uploads no .pyc 
 files?

 Markus
>>> >>>
>>>
>>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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
-~--~~~~--~~--~--~---



ab-runs.gz
Description: GNU Zip compressed data


[web2py:23666] Reference in another table

2009-06-09 Thread pk

Hi,

I´ve a table called project and i have another table called
projectfile. How can i reference automaticlly the project.id in the
table projectfile?

this is my code, but it`s wrong:

db.define_table('projectfile',
SQLField('projectid', default=project.id,
writable=False, readable=False),
SQLField('filename'),
SQLField('format'),
SQLField('file','upload'),
SQLField('cdate','date',default=now),
SQLField('description','text'))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23667] Re: build automation

2009-06-09 Thread Sebastian E. Ovide
ok... from the Makefile I could use:

python -c 'import compileall;
compileall.compile_dir("applications/myapplication")'

to build it.

will it run the unit tests too ?

if yes, how do I know how many tests have failed ?

thanks





On Mon, Jun 8, 2009 at 10:20 PM, mdipierro  wrote:

>
> What Hans suggests is the simplest thing. It boils down to
>
> cd applications/yourapp
> tar zcvf ../../web2py.app.youapp.w2p *
>
> there is nothing more to it.
>
> On Jun 8, 4:10 pm, Hans Donner  wrote:
> > you might have a look at the current makefile for web2py, there you
> > can see how the current w2p files are generated.
> >
> > On Mon, Jun 8, 2009 at 9:21 PM, Sebastian E.
> >
> > Ovide wrote:
> > > Hi Massimo,
> >
> > > I was wondering if there is an easy way to compile and package an
> > > application from command line. The question arise from the need to
> integrate
> > > a web2py project in an automated build system. It builds every night,
> run
> > > tests, and if there are not errors it deploys in the DEV environment.
> >
> > > thanks
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23668] Re: new auth functions in trunk (basic, email/gmail, ldap)

2009-06-09 Thread Trollkarlen



Alexei Vinidiktov wrote:
> On Mon, Jun 8, 2009 at 11:29 AM, mdipierro wrote:
> >
> > Hi Richard,
> >
> > the gmail authentication is not based on open-id (yet). it presents
> > you with a standard login form. It tried to log you in via the normal
> > auth_user table. It it fails, it tried to verify your password using
> > the gmail smtp service. If that works a the auth_user table is created/
> > updated with the md5 hash of your current password.
> >
> > This is designed to be streightforward to setup.
>
> I see one drawback to this approach. If the user is logged in with
> gmail credentials without leaving your site, he/she may be reluctant
> to give them because he/she might be thinking "what if this site is
> phishing for my credentials to gmail?"
>
> What do you think?
>

Not only that its against the IT security rule no 1 to not have the
same passwords on different sites.
And in this case the chain is not stronger than the weakest link.

So it think this a potential security risk even thou its very handy.

/R

> >
> > We will soon have an API like stack overflow does.
> >
>
> That's great to hear!
>
>
>
>
>
> --
> Alexei Vinidiktov
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23669] Re: response.flash upgrade

2009-06-09 Thread Trollkarlen

I have done the same but with:
http://digitarald.de/project/roar

They have very nice things on that site.

/T

mr.freeze wrote:
> I don't like having to click on response.flash to close it so I
> replaced it with this:
> http://stanlemon.net/projects/jgrowl.html
> Just thought I would share.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23670] Auth

2009-06-09 Thread Robert Marklund
Cant auth be changed somhow to it will be easier to extend like this:

db.define_table('auth_user2',
db.auth_user,
SQLField('nickname'),
SQLField('image','upload'))

The problem to day is the:
table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email'
 % self.settings.table_user._tablename)]

It will check the auth_user table instead of my extended table for the email
to be uniq.

I have tested to add this but it doesnt help:

db.auth_user2.email.requiers = [IS_EMAIL(),
IS_NOT_IN_DB(db, 'auth_user2.email')]

/T


-- 
__
Robert Marklund

Phone: +46 (0)46 19 36 82
Mobile: +46 (0)70 213 22 76
E-mail: robbelibob...@gmail.com
__

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23671] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov
Results of second set of test runs:

r87545.523ms
r88220.614ms
inits v.1   18.464ms
inits v.2   18.677ms
inits1+lazyT15.377ms
inits2+lazyT15.280ms

Observed noise was 0.502ms for slowest execution (90:1
signal-to-noise) and 0.889ms for fastest execution (16:1
signal-to-noise).
Given than, I think it is safe enough to say that
"this particular application on this particular hardware/OS
combination was sped up 2.88...3.31 times".

As in last case - for completeness I'm attaching full console output

I think I know what I'll do. Currently I do not want to release my
project as any kind of open-source. But I can
1) Strip out any code I do not use in this perfomance testing
2) rename all sensitive fieldnames/variables to something like field1,
field2, var3, var4.
Release resulting package. It would be useless as it is, but it will
have same perfomance parameters so could be used for testing.

On Tue, Jun 9, 2009 at 1:35 PM, Alexey Nezhdanov wrote:
> Wrote 'optimised inits v2' patch. Tested everything.
>
> Once again I changed my testing pattern a bit.
>
> 1) I dumped my own timing tool in favor of much more standard
> 'ab' (apache benchmark).
>
> 2) I decidedly will publish all these results in two main.
> I just finished first round of testing. Here are results (reported
> values are average request time in milliseconds. If anyone interested
> - I'm attaching a full output from my console).
> I will do all that testing again and publish same results again so
> that the amount of noise in all this will be public and clearly
> visible (here I'm fighting with my own temptation to rerun the tests
> if timings seem to be 'too away' to me).
>
> First four lines share my app's db.py. Last two require a modified
> db.py, but modification is cosmetical - each define_table is put into
> separate function and I do db.tablename=create_table_tablename after
> each function. Model init time was not measured.
>
> No more words. Dry figures only. Each line represents result of 10k requests.
> r875            46.025ms
> r882            21.048ms
> inits v.1       18.918ms
> inits v.2       18.122ms
> inits1+lazyT    16.032ms
> inits2+lazyT    14.391ms
>
> P.S. I'm surprised about last line... Noise?
>
> On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov wrote:
>> new testing:
>>
>>  SERVER KERNEL 
>> --prints
>> r875    0.04898
>> r822ini 0.03070 1.60x
>> --silent
>> r875    0.04914
>> r822ini 0.03049 1.61x
>>
>> So I get much more consistent results on this hardware.
>> While this is obviously not the best perfomance (my weaker box,
>> with less RAM, troubled with video output 1280x1024,
>> software 90deg rotation - performs BETTER), that does not matter.
>> What does - is that I can now be sure that these results are
>> noise-free so I can safely compare timings from various patches.
>> Proceeding with writing 'inits v2'.
>>
>>
>> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov wrote:
>>> Ok. Now the confusion is resolved.
>>> 1) Speed improvements of 70% and up that I reported yesterday are
>>> really exist. I just reproduced a 3.47 times model speedup and 2.15
>>> overall speedup for my app (r875 vs r822+inits).
>>> BUT this app is atypical. I have added some time measuring code there
>>> so it prints out two lines per each model init. So when I am testing
>>> perfomance - screen very quickly scrolls up
>>>
>>> 2) Simply commenting out two print statements gives me only 1.67
>>> overall speedup given equal other conditions. I think that processor
>>> receive additional interrupts from videocard that in turn results in
>>> more often checks of tasks queue.
>>>
>>> 3) I declare all my previous testing results spoiled by noise
>>> generated by print statement and inappropriate kernel scheduler
>>> setting.
>>> I've set up yet another test box with these parameters:
>>>
>>> Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
>>> 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
>>> but it appeared to be unstable on that hardware (and afterall - it's
>>> for sound/video processing and 'server' type is more likely to be
>>> installed on servers).
>>>
>>> Will report new testing results (and finally I hope to write
>>> 'optimised inits ver.2' patch) later today.
>>>
>>> On Tue, Jun 9, 2009 at 5:14 AM, mdipierro wrote:

 Please try launchpad 893. I think it should be faster on GAE.
 We can do better with lazy tables but at least the validators and
 calls to getitem are eliminated.

 Massimo

 On Jun 8, 1:05 pm, Markus Gritsch  wrote:
> On Mon, Jun 8, 2009 at 5:54 PM, mdipierro wrote:
>
> > the web2py in trunk can execute models 2.5x faster than the current
> > stable/production version (requires migrate=False and bytecode
> > compiled models).
>
> Will this speedup also has an effect on GAE?  IMO one uploads no .pyc 
> files?
>
> Markus
 

>>>
>>
>

--~--~-

[web2py:23672] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov
Forgot about patches. Here they are.
'optimised inits v.2'
'lazy tables' (this one is modified to be applicable to trunk version of
sql.py)

On Tue, Jun 9, 2009 at 3:10 PM, Alexey Nezhdanov  wrote:

> Results of second set of test runs:
>
> r87545.523ms
> r88220.614ms
> inits v.1   18.464ms
> inits v.2   18.677ms
> inits1+lazyT15.377ms
> inits2+lazyT15.280ms
>
> Observed noise was 0.502ms for slowest execution (90:1
> signal-to-noise) and 0.889ms for fastest execution (16:1
> signal-to-noise).
> Given than, I think it is safe enough to say that
> "this particular application on this particular hardware/OS
> combination was sped up 2.88...3.31 times".
>
> As in last case - for completeness I'm attaching full console output
>
> I think I know what I'll do. Currently I do not want to release my
> project as any kind of open-source. But I can
> 1) Strip out any code I do not use in this perfomance testing
> 2) rename all sensitive fieldnames/variables to something like field1,
> field2, var3, var4.
> Release resulting package. It would be useless as it is, but it will
> have same perfomance parameters so could be used for testing.
>
> On Tue, Jun 9, 2009 at 1:35 PM, Alexey Nezhdanov wrote:
> > Wrote 'optimised inits v2' patch. Tested everything.
> >
> > Once again I changed my testing pattern a bit.
> >
> > 1) I dumped my own timing tool in favor of much more standard
> > 'ab' (apache benchmark).
> >
> > 2) I decidedly will publish all these results in two main.
> > I just finished first round of testing. Here are results (reported
> > values are average request time in milliseconds. If anyone interested
> > - I'm attaching a full output from my console).
> > I will do all that testing again and publish same results again so
> > that the amount of noise in all this will be public and clearly
> > visible (here I'm fighting with my own temptation to rerun the tests
> > if timings seem to be 'too away' to me).
> >
> > First four lines share my app's db.py. Last two require a modified
> > db.py, but modification is cosmetical - each define_table is put into
> > separate function and I do db.tablename=create_table_tablename after
> > each function. Model init time was not measured.
> >
> > No more words. Dry figures only. Each line represents result of 10k
> requests.
> > r87546.025ms
> > r88221.048ms
> > inits v.1   18.918ms
> > inits v.2   18.122ms
> > inits1+lazyT16.032ms
> > inits2+lazyT14.391ms
> >
> > P.S. I'm surprised about last line... Noise?
> >
> > On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov
> wrote:
> >> new testing:
> >>
> >>  SERVER KERNEL 
> >> --prints
> >> r8750.04898
> >> r822ini 0.03070 1.60x
> >> --silent
> >> r8750.04914
> >> r822ini 0.03049 1.61x
> >>
> >> So I get much more consistent results on this hardware.
> >> While this is obviously not the best perfomance (my weaker box,
> >> with less RAM, troubled with video output 1280x1024,
> >> software 90deg rotation - performs BETTER), that does not matter.
> >> What does - is that I can now be sure that these results are
> >> noise-free so I can safely compare timings from various patches.
> >> Proceeding with writing 'inits v2'.
> >>
> >>
> >> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov
> wrote:
> >>> Ok. Now the confusion is resolved.
> >>> 1) Speed improvements of 70% and up that I reported yesterday are
> >>> really exist. I just reproduced a 3.47 times model speedup and 2.15
> >>> overall speedup for my app (r875 vs r822+inits).
> >>> BUT this app is atypical. I have added some time measuring code there
> >>> so it prints out two lines per each model init. So when I am testing
> >>> perfomance - screen very quickly scrolls up
> >>>
> >>> 2) Simply commenting out two print statements gives me only 1.67
> >>> overall speedup given equal other conditions. I think that processor
> >>> receive additional interrupts from videocard that in turn results in
> >>> more often checks of tasks queue.
> >>>
> >>> 3) I declare all my previous testing results spoiled by noise
> >>> generated by print statement and inappropriate kernel scheduler
> >>> setting.
> >>> I've set up yet another test box with these parameters:
> >>>
> >>> Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
> >>> 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
> >>> but it appeared to be unstable on that hardware (and afterall - it's
> >>> for sound/video processing and 'server' type is more likely to be
> >>> installed on servers).
> >>>
> >>> Will report new testing results (and finally I hope to write
> >>> 'optimised inits ver.2' patch) later today.
> >>>
> >>> On Tue, Jun 9, 2009 at 5:14 AM, mdipierro
> wrote:
> 
>  Please try launchpad 893. I think it should be faster on GAE.
>  We can do better with lazy tables but at least the validators and
>  calls to getitem are eliminated.
> 
>  Massimo
> 
> 

[web2py:23673] Re: Delete Content with Security question

2009-06-09 Thread Fran

On Jun 9, 10:30 am, pk  wrote:
> how can I delete a content (row) from the table with a security
> question. for example: "Are you sure to delete the project? yes - no"

Look at make_delete_row() in this file:
http://trac.sahanapy.org/browser/views/sahana_scripts_min.html

URL2() is defined here:
http://trac.sahanapy.org/browser/modules/sahana.py

I no longer use this, but used to create the checkboxes using:
shn_represent_extra() in this file:
http://trac.sahanapy.org/browser/models/01_RESTlike_controller.py

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23674] Re: Reference in another table

2009-06-09 Thread Fran

On Jun 9, 10:56 am, pk  wrote:
> I´ve a table called project and i have another table called
> projectfile. How can i reference automaticlly the project.id in the
> table projectfile?
> db.define_table('projectfile',
>                 SQLField('projectid', default=project.id,
> writable=False, readable=False),

SQLField('projectid', db.project, writable=False, readable=False)

To populate the default you'll need to use a crud.create.onvalidation
callback.
(The model definition has no idea which project you're referring to.

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23675] Re: Reference in another table

2009-06-09 Thread pk

ok i will try, thanks for your help

On 9 Jun., 13:47, Fran  wrote:
> On Jun 9, 10:56 am, pk  wrote:
>
> > I´ve a table called project and i have another table called
> > projectfile. How can i reference automaticlly the project.id in the
> > table projectfile?
> > db.define_table('projectfile',
> >                 SQLField('projectid', default=project.id,
> > writable=False, readable=False),
>
> SQLField('projectid', db.project, writable=False, readable=False)
>
> To populate the default you'll need to use a crud.create.onvalidation
> callback.
> (The model definition has no idea which project you're referring to.
>
> F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23676] how to prevent deletion of referenced records

2009-06-09 Thread Marco Prosperi

hi all, is there a validator or an easy way to prevent a user to
delete a record if there are other records referencing it? Just to
make an example: consider the 'images' application in cookbook2.pdf. I
would like that the user cannot delete an image if there are comments
referred to it (it would be useful to get a warning message specifying
that the user has to delete the comments first)

thanks in advance,

Marco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23677] Re: Auth

2009-06-09 Thread Fran

On Jun 9, 11:42 am, Robert Marklund  wrote:
> Cant auth be changed somhow to it will be easier to extend like this:
> db.define_table('auth_user2',
>                 db.auth_user,
>                 SQLField('nickname'),
>                 SQLField('image','upload'))
> The problem to day is the:
> table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email'
>                                  % self.settings.table_user._tablename)]
> It will check the auth_user table instead of my extended table for the email
> to be uniq.

Try:
auth.settings.table_user_name = 'auth_user2'

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23678] Show only users Project

2009-06-09 Thread pk

Hi,

I've another question:
Every user should upload files and i create a table called
projectfile.

db.define_table('projectfile',
SQLField('userid', default=auth.user.id if auth.user
else 0, writable=False, readable=False),
SQLField('procreator', default=auth.user.last_name if
auth.user else 0, writable=False, readable=False),
SQLField('projectname'),
SQLField('filename'),
SQLField('format'),
SQLField('cdate', 'date', default=now),
SQLField('datei','upload'),
SQLField('description','text'))

db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
db.projectfile.projectname.requires=IS_IN_DB(db,'project.pname')
db.projectfile.filename.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'projectfile.filename')]
db.projectfile.format.requires=[IS_NOT_EMPTY()]
db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
db.projectfile.datei.requires=IS_NOT_EMPTY()



def projectfile():
if auth.is_logged_in():
form=SQLFORM(db.projectfile,fields=['projectname',
'filename',
'format',
'description',
'datei'])



now my question: how can i show on the website in the field
'projectname' only the projects from the user not all projects in the
table?

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23679] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov
Finally, I started migration (before I was just slapping sql.py, checked out
of the trunk over my ancient 1.61.4 install).
Migration is not easy, I've been bending source for my needs so now I have
to port all this to 1.63.5. Massimo, do you have any objections to this
patch? I proposed it some time ago, but you were too busy at the time.
The purpose is - if we want custom forms instead of SQLFORM then we have to
write our own view.html. But on the other hand - that is double work in the
regard that we need to write down  each time while we already generated all this in controller.
I'd really like to be able to write in my controller:

{{=form.custom.label.my_input}}
{{=form.custom.widget.my_input}}

See attached patch.

On Tue, Jun 9, 2009 at 3:14 PM, Alexey Nezhdanov  wrote:

> Forgot about patches. Here they are.
> 'optimised inits v.2'
> 'lazy tables' (this one is modified to be applicable to trunk version of
> sql.py)
>
>
> On Tue, Jun 9, 2009 at 3:10 PM, Alexey Nezhdanov wrote:
>
>> Results of second set of test runs:
>>
>> r87545.523ms
>> r88220.614ms
>> inits v.1   18.464ms
>> inits v.2   18.677ms
>> inits1+lazyT15.377ms
>> inits2+lazyT15.280ms
>>
>> Observed noise was 0.502ms for slowest execution (90:1
>> signal-to-noise) and 0.889ms for fastest execution (16:1
>> signal-to-noise).
>> Given than, I think it is safe enough to say that
>> "this particular application on this particular hardware/OS
>> combination was sped up 2.88...3.31 times".
>>
>> As in last case - for completeness I'm attaching full console output
>>
>> I think I know what I'll do. Currently I do not want to release my
>> project as any kind of open-source. But I can
>> 1) Strip out any code I do not use in this perfomance testing
>> 2) rename all sensitive fieldnames/variables to something like field1,
>> field2, var3, var4.
>> Release resulting package. It would be useless as it is, but it will
>> have same perfomance parameters so could be used for testing.
>>
>> On Tue, Jun 9, 2009 at 1:35 PM, Alexey Nezhdanov
>> wrote:
>> > Wrote 'optimised inits v2' patch. Tested everything.
>> >
>> > Once again I changed my testing pattern a bit.
>> >
>> > 1) I dumped my own timing tool in favor of much more standard
>> > 'ab' (apache benchmark).
>> >
>> > 2) I decidedly will publish all these results in two main.
>> > I just finished first round of testing. Here are results (reported
>> > values are average request time in milliseconds. If anyone interested
>> > - I'm attaching a full output from my console).
>> > I will do all that testing again and publish same results again so
>> > that the amount of noise in all this will be public and clearly
>> > visible (here I'm fighting with my own temptation to rerun the tests
>> > if timings seem to be 'too away' to me).
>> >
>> > First four lines share my app's db.py. Last two require a modified
>> > db.py, but modification is cosmetical - each define_table is put into
>> > separate function and I do db.tablename=create_table_tablename after
>> > each function. Model init time was not measured.
>> >
>> > No more words. Dry figures only. Each line represents result of 10k
>> requests.
>> > r87546.025ms
>> > r88221.048ms
>> > inits v.1   18.918ms
>> > inits v.2   18.122ms
>> > inits1+lazyT16.032ms
>> > inits2+lazyT14.391ms
>> >
>> > P.S. I'm surprised about last line... Noise?
>> >
>> > On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov
>> wrote:
>> >> new testing:
>> >>
>> >>  SERVER KERNEL 
>> >> --prints
>> >> r8750.04898
>> >> r822ini 0.03070 1.60x
>> >> --silent
>> >> r8750.04914
>> >> r822ini 0.03049 1.61x
>> >>
>> >> So I get much more consistent results on this hardware.
>> >> While this is obviously not the best perfomance (my weaker box,
>> >> with less RAM, troubled with video output 1280x1024,
>> >> software 90deg rotation - performs BETTER), that does not matter.
>> >> What does - is that I can now be sure that these results are
>> >> noise-free so I can safely compare timings from various patches.
>> >> Proceeding with writing 'inits v2'.
>> >>
>> >>
>> >> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov
>> wrote:
>> >>> Ok. Now the confusion is resolved.
>> >>> 1) Speed improvements of 70% and up that I reported yesterday are
>> >>> really exist. I just reproduced a 3.47 times model speedup and 2.15
>> >>> overall speedup for my app (r875 vs r822+inits).
>> >>> BUT this app is atypical. I have added some time measuring code there
>> >>> so it prints out two lines per each model init. So when I am testing
>> >>> perfomance - screen very quickly scrolls up
>> >>>
>> >>> 2) Simply commenting out two print statements gives me only 1.67
>> >>> overall speedup given equal other conditions. I think that processor
>> >>> receive additional interrupts from videocard that in turn results in
>> >>> more often checks of tasks queue.
>> >>>
>> >>> 3) I declare all my previous testing results spoile

[web2py:23680] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov
Wanted to attach test data as well but automatically clicked 'send' and
oops... it gone.
Here are couple of test runs:
1.63.544.572
On Tue, Jun 9, 2009 at 4:14 PM, Alexey Nezhdanov  wrote:

> Finally, I started migration (before I was just slapping sql.py, checked
> out of the trunk over my ancient 1.61.4 install).
> Migration is not easy, I've been bending source for my needs so now I have
> to port all this to 1.63.5. Massimo, do you have any objections to this
> patch? I proposed it some time ago, but you were too busy at the time.
> The purpose is - if we want custom forms instead of SQLFORM then we have to
> write our own view.html. But on the other hand - that is double work in the
> regard that we need to write down  name='nnn' /> each time while we already generated all this in controller.
> I'd really like to be able to write in my controller:
> 
> {{=form.custom.label.my_input}}
> {{=form.custom.widget.my_input}}
> 
> See attached patch.
>
>
> On Tue, Jun 9, 2009 at 3:14 PM, Alexey Nezhdanov wrote:
>
>> Forgot about patches. Here they are.
>> 'optimised inits v.2'
>> 'lazy tables' (this one is modified to be applicable to trunk version of
>> sql.py)
>>
>>
>> On Tue, Jun 9, 2009 at 3:10 PM, Alexey Nezhdanov wrote:
>>
>>> Results of second set of test runs:
>>>
>>> r87545.523ms
>>> r88220.614ms
>>> inits v.1   18.464ms
>>> inits v.2   18.677ms
>>> inits1+lazyT15.377ms
>>> inits2+lazyT15.280ms
>>>
>>> Observed noise was 0.502ms for slowest execution (90:1
>>> signal-to-noise) and 0.889ms for fastest execution (16:1
>>> signal-to-noise).
>>> Given than, I think it is safe enough to say that
>>> "this particular application on this particular hardware/OS
>>> combination was sped up 2.88...3.31 times".
>>>
>>> As in last case - for completeness I'm attaching full console output
>>>
>>> I think I know what I'll do. Currently I do not want to release my
>>> project as any kind of open-source. But I can
>>> 1) Strip out any code I do not use in this perfomance testing
>>> 2) rename all sensitive fieldnames/variables to something like field1,
>>> field2, var3, var4.
>>> Release resulting package. It would be useless as it is, but it will
>>> have same perfomance parameters so could be used for testing.
>>>
>>> On Tue, Jun 9, 2009 at 1:35 PM, Alexey Nezhdanov
>>> wrote:
>>> > Wrote 'optimised inits v2' patch. Tested everything.
>>> >
>>> > Once again I changed my testing pattern a bit.
>>> >
>>> > 1) I dumped my own timing tool in favor of much more standard
>>> > 'ab' (apache benchmark).
>>> >
>>> > 2) I decidedly will publish all these results in two main.
>>> > I just finished first round of testing. Here are results (reported
>>> > values are average request time in milliseconds. If anyone interested
>>> > - I'm attaching a full output from my console).
>>> > I will do all that testing again and publish same results again so
>>> > that the amount of noise in all this will be public and clearly
>>> > visible (here I'm fighting with my own temptation to rerun the tests
>>> > if timings seem to be 'too away' to me).
>>> >
>>> > First four lines share my app's db.py. Last two require a modified
>>> > db.py, but modification is cosmetical - each define_table is put into
>>> > separate function and I do db.tablename=create_table_tablename after
>>> > each function. Model init time was not measured.
>>> >
>>> > No more words. Dry figures only. Each line represents result of 10k
>>> requests.
>>> > r87546.025ms
>>> > r88221.048ms
>>> > inits v.1   18.918ms
>>> > inits v.2   18.122ms
>>> > inits1+lazyT16.032ms
>>> > inits2+lazyT14.391ms
>>> >
>>> > P.S. I'm surprised about last line... Noise?
>>> >
>>> > On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov
>>> wrote:
>>> >> new testing:
>>> >>
>>> >>  SERVER KERNEL 
>>> >> --prints
>>> >> r8750.04898
>>> >> r822ini 0.03070 1.60x
>>> >> --silent
>>> >> r8750.04914
>>> >> r822ini 0.03049 1.61x
>>> >>
>>> >> So I get much more consistent results on this hardware.
>>> >> While this is obviously not the best perfomance (my weaker box,
>>> >> with less RAM, troubled with video output 1280x1024,
>>> >> software 90deg rotation - performs BETTER), that does not matter.
>>> >> What does - is that I can now be sure that these results are
>>> >> noise-free so I can safely compare timings from various patches.
>>> >> Proceeding with writing 'inits v2'.
>>> >>
>>> >>
>>> >> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov
>>> wrote:
>>> >>> Ok. Now the confusion is resolved.
>>> >>> 1) Speed improvements of 70% and up that I reported yesterday are
>>> >>> really exist. I just reproduced a 3.47 times model speedup and 2.15
>>> >>> overall speedup for my app (r875 vs r822+inits).
>>> >>> BUT this app is atypical. I have added some time measuring code there
>>> >>> so it prints out two lines per each model init. So when I am testing
>>> >>> perfomance - screen very quickly scrolls up
>>

[web2py:23681] Re: response.flash upgrade

2009-06-09 Thread mr.freeze

Ooooh...That's nice too.  Massimo, should one of these (probably a
jQuery based one) replace the default response.flash behavior to give
web2py some more pizazz out of the box? Also, what are your thoughts
on including jQueryUI with web2py and replacing the current default
clunky calendar with the jQueryUI calendar?

On Jun 9, 5:19 am, Trollkarlen  wrote:
> I have done the same but with:http://digitarald.de/project/roar
>
> They have very nice things on that site.
>
> /T
>
>
>
> mr.freeze wrote:
> > I don't like having to click on response.flash to close it so I
> > replaced it with this:
> >http://stanlemon.net/projects/jgrowl.html
> > Just thought I would share.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23682] Re: web2py perfomance

2009-06-09 Thread Alexey Nezhdanov
:( using web interface is inconvenient. Ignore last mail, resending:
-
Wanted to attach test data as well but automatically clicked 'send' and
oops... it gone.
Here are couple of test runs:
1.63.5  44.572ms
1.63.5  44.898ms
detected noise 0.326ms (136:1 signal-to-noise).
full 'ab' output attached

On Tue, Jun 9, 2009 at 4:25 PM, Alexey Nezhdanov  wrote:

> Wanted to attach test data as well but automatically clicked 'send' and
> oops... it gone.
> Here are couple of test runs:
> 1.63.544.572
>
> On Tue, Jun 9, 2009 at 4:14 PM, Alexey Nezhdanov wrote:
>
>> Finally, I started migration (before I was just slapping sql.py, checked
>> out of the trunk over my ancient 1.61.4 install).
>> Migration is not easy, I've been bending source for my needs so now I have
>> to port all this to 1.63.5. Massimo, do you have any objections to this
>> patch? I proposed it some time ago, but you were too busy at the time.
>> The purpose is - if we want custom forms instead of SQLFORM then we have
>> to write our own view.html. But on the other hand - that is double work in
>> the regard that we need to write down > id='zzz' name='nnn' /> each time while we already generated all this in
>> controller.
>> I'd really like to be able to write in my controller:
>> 
>> {{=form.custom.label.my_input}}
>> {{=form.custom.widget.my_input}}
>> 
>> See attached patch.
>>
>>
>> On Tue, Jun 9, 2009 at 3:14 PM, Alexey Nezhdanov wrote:
>>
>>> Forgot about patches. Here they are.
>>> 'optimised inits v.2'
>>> 'lazy tables' (this one is modified to be applicable to trunk version of
>>> sql.py)
>>>
>>>
>>> On Tue, Jun 9, 2009 at 3:10 PM, Alexey Nezhdanov wrote:
>>>
 Results of second set of test runs:

 r87545.523ms
 r88220.614ms
 inits v.1   18.464ms
 inits v.2   18.677ms
 inits1+lazyT15.377ms
 inits2+lazyT15.280ms

 Observed noise was 0.502ms for slowest execution (90:1
 signal-to-noise) and 0.889ms for fastest execution (16:1
 signal-to-noise).
 Given than, I think it is safe enough to say that
 "this particular application on this particular hardware/OS
 combination was sped up 2.88...3.31 times".

 As in last case - for completeness I'm attaching full console output

 I think I know what I'll do. Currently I do not want to release my
 project as any kind of open-source. But I can
 1) Strip out any code I do not use in this perfomance testing
 2) rename all sensitive fieldnames/variables to something like field1,
 field2, var3, var4.
 Release resulting package. It would be useless as it is, but it will
 have same perfomance parameters so could be used for testing.

 On Tue, Jun 9, 2009 at 1:35 PM, Alexey Nezhdanov
 wrote:
 > Wrote 'optimised inits v2' patch. Tested everything.
 >
 > Once again I changed my testing pattern a bit.
 >
 > 1) I dumped my own timing tool in favor of much more standard
 > 'ab' (apache benchmark).
 >
 > 2) I decidedly will publish all these results in two main.
 > I just finished first round of testing. Here are results (reported
 > values are average request time in milliseconds. If anyone interested
 > - I'm attaching a full output from my console).
 > I will do all that testing again and publish same results again so
 > that the amount of noise in all this will be public and clearly
 > visible (here I'm fighting with my own temptation to rerun the tests
 > if timings seem to be 'too away' to me).
 >
 > First four lines share my app's db.py. Last two require a modified
 > db.py, but modification is cosmetical - each define_table is put into
 > separate function and I do db.tablename=create_table_tablename after
 > each function. Model init time was not measured.
 >
 > No more words. Dry figures only. Each line represents result of 10k
 requests.
 > r87546.025ms
 > r88221.048ms
 > inits v.1   18.918ms
 > inits v.2   18.122ms
 > inits1+lazyT16.032ms
 > inits2+lazyT14.391ms
 >
 > P.S. I'm surprised about last line... Noise?
 >
 > On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov
 wrote:
 >> new testing:
 >>
 >>  SERVER KERNEL 
 >> --prints
 >> r8750.04898
 >> r822ini 0.03070 1.60x
 >> --silent
 >> r8750.04914
 >> r822ini 0.03049 1.61x
 >>
 >> So I get much more consistent results on this hardware.
 >> While this is obviously not the best perfomance (my weaker box,
 >> with less RAM, troubled with video output 1280x1024,
 >> software 90deg rotation - performs BETTER), that does not matter.
 >> What does - is that I can now be sure that these results are
 >> noise-free so I can safely compare timings from various patches.
 >> Proceeding with writing 'inits v2'.
 >>
 >>
>>

[web2py:23683] Re: new auth functions in trunk (basic, email/gmail, ldap)

2009-06-09 Thread mr.freeze

I will take a stab at the active directory implementation ASAP.

On Jun 8, 11:52 pm, mdipierro  wrote:
> only mode='uid' is implemented. I could use help debugging/
> implementing the other modes
>
> Massimo
>
> On Jun 8, 10:38 pm, "mr.freeze"  wrote:
>
>
>
> > Sorry, I saw 'raise SyntaxError, "Not yet implemented"' under the 'ad'
> > and 'domino' if statements of ldap_auth_aux in ldap_auth.py and
> > thought you weren't done.   I tried it and it seems that if ad/ldap is
> > enabled that it will take any username with a blank password.
>
> > On Jun 8, 10:04 pm, mdipierro  wrote:
>
> > > ldap should work already. Please test it.
>
> > > On Jun 8, 9:29 pm, "mr.freeze"  wrote:
>
> > > > Massimo, I can test ldap against AD when it is finished.
>
> > > > On May 13, 12:01 am, mdipierro  wrote:
>
> > > > > Please try this
>
> > > > > 1) to authenticate with gmail
>
> > > > > auth=Auth(globals(),db)
> > > > > from gluon.contrib.login_methods.email_auth import email_auth
> > > > > auth.settings.login_methods.append(email_auth())
>
> > > > > 2) to authenticate using basic authentication of a third party server
>
> > > > > auth=Auth(globals(),db)
> > > > > from gluon.contrib.login_methods.basic_auth import basic_auth
> > > > > auth.settings.login_methods.append(basic_auth('http://server'))
>
> > > > > 3) to authenticate using LDAP  server
>
> > > > > auth=Auth(globals(),db)
> > > > > from gluon.contrib.login_methods.ldap_auth import ldap_auth
> > > > > auth.settings.login_methods.append(ldap_auth(...))
>
> > > > > (requires ldap library installed. look into gluon/contrib/
> > > > > login_methods/ldap_auth.py for ... options).
>
> > > > > Please let me know if this works for you.
>
> > > > > CAS client will be next
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23684] Re: global logging to file

2009-06-09 Thread Hans

Sorry for being picky on this. I think the database is not a suitable
place either to store a 'application instance initialized flag'.
Reason:
1) the db can be used by more than one instance of the app
2) if the app stops execution without setting back the 'db record' to
'app not initialized' - like it happens when you remove the power -
then the application will not work any more because the code will
refer to objects which are not created yet because the one-time-
initialization per app was not executed.

I'm not aware how application wide vars in web2py cache are working,
but I assume it could be a viable option.

what do you think?

On Jun 8, 2:43 pm, mdipierro  wrote:
> You are right. Not in session. You can store an application wide var
> in cache but I would suggest using the db for this. Anyway, I will
> post an example.
>
> On Jun 8, 4:27 am, Hans 
> wrote:
>
> > The log file initialization code must be executed once when the
> > application starts and should not be executed multiple times (e.g. not
> > once per user and not once per controller execution).
>
> > I'm not aware that in a session I can store a application-wide global
> > variable - independent of the user.
>
> > Can you provide a link or example code for execution only once per
> > application (e.g. initialization function) ?
>
> > On Jun 5, 10:19 pm, mdipierro  wrote:
>
> > > can you store it into a session?
>
> > > On Jun 5, 2:11 pm, Hans 
> > > wrote:
>
> > > > The problem I have with my code for generating log files that the part
> > > > of the code (see first posting in this thread) which is outside any
> > > > function in the controller (because it should be available for all
> > > > functions in this controller) is executed every time a function is
> > > > called. I have not found a way to execute it only once intitially and
> > > > prevent multiple executions. Hence it registeres log handlers every
> > > > time the controller is executed which causes every log line to be
> > > > written multiple times into the log file.
>
> > > > The following did not work:
>
> > > > try:
> > > >     done_once
> > > > except:
> > > >     place code to be executed only once here
> > > >     global done_once
> > > >     done_once=true
>
> > > > because the variable done_once is undefined each time the controller
> > > > is executed again.
>
> > > > How can a code in the controller be executed only once?
> > > > Also completely different approach suggestions are welcome!
>
> > > > Thanks,
> > > > Hans
> > > > On Jun 5, 4:36 pm, mdipierro  wrote:
>
> > > > > Sorry Hans, I still do not understand the problem.
>
> > > > > code outside function is executed when a function in the controller is
> > > > > called (whatever the function) code in the function is executed only
> > > > > when that function is called. A call to redirect causes the browser to
> > > > > make another request thus the controller is executed again.
>
> > > > > Massimo
>
> > > > > On Jun 5, 8:08 am, Hans 
> > > > > wrote:
>
> > > > > > Correction: redirect() usage is NOT causing the problem. Every call 
> > > > > > of
> > > > > > a controller function also executes
> > > > > > 1) general parts of the model (db.py)
> > > > > > 2) general parts of the controller (default.py)
> > > > > > 3) the requested function in controller
>
> > > > > > In my case every click to an menu function adds another multiple for
> > > > > > log entries.
>
> > > > > > Thinking about the response.menu example which gives you different
> > > > > > menu options depending on the user being logged in or not I'm
> > > > > > convinced that the general controller sections are executed before
> > > > > > each requested function. That's good for the dynamically changing 
> > > > > > menu
> > > > > > and other needs.
>
> > > > > > For a log file function which should be available for the entire
> > > > > > controller I need to make sure its executed only once. Is there a
> > > > > > simple way to do that or a different way to achieve a log file
> > > > > > function (similar like my example up in this thread) available for 
> > > > > > the
> > > > > > entire controller?
>
> > > > > > Thanks,
> > > > > > Hans
> > > > > > On Jun 5, 2:34 pm, Hans 
> > > > > > wrote:
>
> > > > > > > yes confirmed, the controller is called multiple times. the 
> > > > > > > reason I
> > > > > > > found is that the redirect() statements I use cause this. every
> > > > > > > redirect() seems to call the controller, not only the redirection
> > > > > > > target function.
>
> > > > > > > for example my index is mainly a redirect function, based on 
> > > > > > > settings
> > > > > > > its for instance doing
> > > > > > >  redirect(URL(r=request,f='f1'))
>
> > > > > > > then also in other functions I use redirects e.g. based on rights/
> > > > > > > settings.
>
> > > > > > > I'm using 1.63.5 on WinXP SP3.
>
> > > > > > > Is there a better function than redirect() for avoiding to call 
> > > > > > > the
> > > > > > > general controller stuff m

[web2py:23685] Re: how to prevent deletion of referenced records

2009-06-09 Thread carlo

Hi Marco,
if you mean at db level, it depends on your db engine. To my
knowledge, in Sqlite you can not get foreign key constraints ("on
delete=cascade" or similar is not effective) but you have to use
Triggers to achieve the same result. Foreign keys constraints though
can be enforced in most of other rdbms.
Of course sort of referential integrity can be assured via software
checking in every table which has a reference to the record you want
to delete.

carlo

On 9 Giu, 13:51, Marco Prosperi  wrote:
> hi all, is there a validator or an easy way to prevent a user to
> delete a record if there are other records referencing it? Just to
> make an example: consider the 'images' application in cookbook2.pdf. I
> would like that the user cannot delete an image if there are comments
> referred to it (it would be useful to get a warning message specifying
> that the user has to delete the comments first)
>
> thanks in advance,
>
> Marco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23686] Re: how to prevent deletion of referenced records

2009-06-09 Thread annet

Marco,


Did you test this in Sqlite:

db.define_table('table',
db.Field('field',...,ondelete='RESTRICT'),
migrate='table.table')


It does set the ON DELETE to RESTRICT in the foreign key constraint in
Postres.


Annet.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23687] Re: how to prevent deletion of referenced records

2009-06-09 Thread carlo

Foreign key constraints are not implemented in Sqlite (although it
parses the command).

See: http://www.sqlite.org/omitted.html

but you can use triggers.

carlo

On 9 Giu, 15:46, annet  wrote:
> Marco,
>
> Did you test this in Sqlite:
>
> db.define_table('table',
>     db.Field('field',...,ondelete='RESTRICT'),
>     migrate='table.table')
>
> It does set the ON DELETE to RESTRICT in the foreign key constraint in
> Postres.
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23688] Re: problem with selfreference left outer join

2009-06-09 Thread mdipierro

sorry, should have been:

db().select(db.dog.name, father.name, mother.name,
left=(father.on(father.id==db.dog.father_id),
mother.on(mother.id==db.dog.mother_id)))




On Jun 9, 3:03 am, Peter Etchells  wrote:
> prints:
> SELECT dog.name, dog.name, dog.name FROM LEFT JOIN dog ON
> dog.id=dog.father_id LEFT JOIN dog ON dog.id=dog.mother_id;
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23689] Re: rev 877 breaks app

2009-06-09 Thread mdipierro

Uploading another version to trunk. Please give it another try

On Jun 9, 1:49 am, Fran  wrote:
> On Jun 9, 1:53 am, mdipierro  wrote:
>
> > please try revision 892
>
> Seems to fix that problem, but creates a new one:
>
> I have a table which has a parent-child hierarchy, so has a reference
> to itself:
>
> db.define_table(gis_location,
>                 db.Field('parent', 'reference gis_location'))   # This
> form of hierarchy may not work on all Databases
>
> File "C:/Bin/web2py/applications/sahana/models/03_gis.py", line 418,
> in 
>     db.Field('parent', 'reference gis_location'))   # This form of
> hierarchy may not work on all Databases
>   File "C:\Bin\web2py\gluon\sql.py", line 955, in define_table
>     t = self[tablename] = SQLTable(self, tablename, *fields)
>   File "C:\Bin\web2py\gluon\sql.py", line 1147, in __init__
>     raise SyntaxError, 'SQLTable: table does not exist'
> SyntaxError: SQLTable: table does not exist
>
> Many thanks,
> Fran.
>
> > Massimo
> > On Jun 8, 4:46 pm, mdipierro  wrote:
> > > This would also break form_factory. Sorry.
> > > I know how to fix it and will do so tonight.
> > > Massimo
> > > On Jun 8, 3:02 pm, Fran  wrote:
> > > > In my model, I define a pair of reusable fields:
> > > > authorstamp = SQLTable(None, 'authorstamp',
> > > >             db.Field('created_by', db.auth_user,
> > > >                           writable=False,
> > > >                           default=session.auth.user.id if
> > > > auth.is_logged_in() else 0),
> > > >             db.Field('modified_by', db.auth_user,
> > > >                           writable=False,
> > > >                           default=session.auth.user.id if
> > > > auth.is_logged_in() else 0,
> > > >                           update=session.auth.user.id if
> > > > auth.is_logged_in() else 0)
> > > >             )
> > > > With revision 877, this breaks:
> > > > Traceback (most recent call last):
> > > >   File "C:\Bin\web2py\gluon\restricted.py", line 107, in restricted
> > > >     exec ccode in environment
> > > >   File "C:/Bin/web2py/applications/sahana/models/00_db.py", line 80,
> > > > in 
> > > >     update=session.auth.user.id if auth.is_logged_in() else 0)
> > > >   File "C:\Bin\web2py\gluon\sql.py", line 1142, in __init__
> > > >     if not referenced in self._db:
> > > > TypeError: argument of type 'NoneType' is not iterable
> > > > The speedups look good, but I can't see why this now breaks the 
> > > > app:http://bazaar.launchpad.net/~mdipierro/web2py/devel/revision/877
> > > > I can't also find another way of getting the same functionality :/
> > > > The reusable field is defined after 'auth' is instantiated.
> > > > Thanks,
> > > > F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23690] Re: how to get main web2py directory?

2009-06-09 Thread mdipierro

Does this mean the fix is wrong but we still have a problem to fix? or
does it mean it works as it is?

On Jun 9, 2:27 am, SergeyPo  wrote:
> When it runs as windows service it shows, well, not python, I was
> wrong, it shows the path to that utility that is used to run as
> service... I think if request.env.web2py_path always gives realpath to
> web2py directory that would be enough.
>
> On Jun 9, 10:44 am, mdipierro  wrote:
>
> > I am not convinced. why should it find applications and not find its
> > own path?
> > anyway, where do you think it should go?
>
> > massimo
>
> > On Jun 9, 1:04 am, SergeyPo  wrote:
>
> > > There are problems with these in Windows when web2py is run as
> > > service. They show path to python.
> > > After many trials I came to this ugly solution:
>
> > > import applications.advantage.modules.pathfinder as pathfinder
> > > PATH_TO_ME = os.path.dirname( os.path.realpath( pathfinder.__file__ ))
>
> > > Here 'pathfinder' is any module, even empty one.
>
> > > On Jun 8, 4:41 pm, mdipierro  wrote:
>
> > > > request.folder is the path to your app
> > > > request.env.web2py_path is the path to web2py
>
> > > > On Jun 8, 3:08 am, mika  wrote:
>
> > > > > I would like to get the main web2py path, so I could just for example
> > > > > add 'applications/my_app/generated_files/1.txt'  to make the complete
> > > > > path for file that will be created. Are there some environmetal paths
> > > > > or something like this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23691] Re: Login_next

2009-06-09 Thread mdipierro

Right now there are two possibilities:

- if web2py redirects you to login, after login, login redirects you
to the referencing page
- if you go to the login page without redirection, after login, you go
to login_next

I think what you see is consistent with this behavior. Am I wrong?

Massimo

On Jun 9, 2:36 am, annet  wrote:
> Massimo,
>
> r992 did not fix the login_next problem.
>
> In db.py I have:
>
> auth.settings.login_url=URL(r=request,c='authentication',f='login')
> auth.settings.login_next=URL(r=request,c='core',f='index')
> auth.settings.logout_next=URL(r=request,c='default',f='index')
>
> In 1.61.4 the first two worked, in 1.63.5 with r992 ...
>
> When on default/index, I choose login from the menu and login I am
> redirected to default/index instead of core/index.
>
> When I expose a function from appadmin, I am redirected to login, when
> I login I am redirected to:http://127.0.0.1:8000/admin/default/design/cms,
> instead of core/index
>
> I also bookmarked the login page. When I login I am redirect to core/
> index. However, when I logout and login again, I am redirected to
> default/index.
>
> So only when I login from outside web2py the login_next works
> correctly.
>
> I am looking forward to a fix of this problem.
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23692] Re: retrieve_username and retrieve_password

2009-06-09 Thread mdipierro

I think you are mssing

auth.settings.mailer=mail

On Jun 9, 2:43 am, annet  wrote:
> In version 1.61.4 these settings sufficed to retrieve the username and
> password:
>
> ## mailer
> mail=Mail()
>
> ## specify your SMPT server
> mail.settings.server='smtp.gmail.com:587'
>
> ## specify your email address
> mail.settings.sender='@gmail.com'
>
> ## optional: specify your user name and password for SMTP
> mail.settings.login='@gmail.com:...'
>
> In 1.63.5 this in case of retrieve _username results in an error
> ticket:
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py_1_63_5/gluon/
> restricted.py", line 107, in restricted
>     exec ccode in environment
>   File "/Library/Python/2.5/site-packages/web2py_1_63_5/applications/
> cms/controllers/authentication.py", line 39, in 
>   File "/Library/Python/2.5/site-packages/web2py_1_63_5/gluon/
> globals.py", line 97, in 
>     self._caller = lambda f: f()
>   File "/Library/Python/2.5/site-packages/web2py_1_63_5/applications/
> cms/controllers/authentication.py", line 15, in retrieve_username
>     return dict(form=auth.retrieve_username())
>   File "/Library/Python/2.5/site-packages/web2py_1_63_5/gluon/
> tools.py", line 898, in retrieve_username
>     response.flash = self.messages.function_disabled
> NameError: global name 'response' is not defined
>
> ... and in case of retrieve_password in a flash: function disabled.
>
> What change in 1.63.5 causes these settings to no longer work.
>
> Kind regards,
>
> Annet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23693] Re: What happened to "db.py" when creating a new app???

2009-06-09 Thread cesmiga

Massimo,

The latest trunk (rev 1014) works as designed.

Christopher

mdipierro wrote:
> This I cannot reproduce. Please try the latest trunk anyway.
>
> On Jun 9, 12:16 am, cesmiga  wrote:
> > Just another note on this issue.  While running...
> >
> > #> ./web2py.py -S testapp
> >
> > after the application was aplready created., Web2Py does not recognize
> > the application already exists either.
> >
> > Christopher
> >
> > cesmiga wrote:
> > > Hey gang!
> >
> > > I tried to create a new application this evening with...
> >
> > >     #> ./web2py.py -S testapp
> >
> > > and the application builds in the "applications" directory, but I
> > > don't see "db.py" file in the "models" directory.  Listed below is
> > > what I have in the models directory.
> >
> > > -rw-r--r-- 1 root staff  649 2009-04-29 10:47 0_imports.py
> > > -rw-r--r-- 1 root staff 1296 2009-04-29 14:14 0.py
> > > -rw-r--r-- 1 root staff 2290 2009-05-23 13:36 access.py
> > > -rw-r--r-- 1 root staff 1262 2009-05-11 00:50 menu.py
> >
> > > Did something change that I was not aware of?  I can't find a...
> >
> > > db = SQLDB(...
> >
> > > entry in any of the files in this directory.  What changed?
> >
> > > Here is the current version I'm working with.
> >
> > > r...@vm-debian-5:/opt/web2py# cat VERSION
> > > Version 1.63.5 (2009-06-03 23:35:00)
> >
> > > I just tried this at the Web2Py UI and "db.py" successfully creates.
> > > Something is broke with...
> >
> > > #> ./web2py.py -S 
> >
> > > Thank you,
> > > Christopher
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23694] Re: slides again

2009-06-09 Thread mdipierro

I will post keynote and ppt versions tonight.

Massimo

On Jun 9, 4:05 am, LordMax  wrote:
> Hi
>
> On 7 Giu, 23:13, mdipierro  wrote:
>
> > I did not realize one had to login. I will post it somewehere else
> > too, together with source (ppt and keynote) asap.
>
> wow.
>
> There's alredy a link?
>
> I would appreciate very much ppt or keynote version.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23695] Re: build automation

2009-06-09 Thread mdipierro

No you have to run the tests one by one

cd gluon/tests
python test_html.py
...


On Jun 9, 5:09 am, "Sebastian E. Ovide" 
wrote:
> ok... from the Makefile I could use:
>
> python -c 'import compileall;
> compileall.compile_dir("applications/myapplication")'
>
> to build it.
>
> will it run the unit tests too ?
>
> if yes, how do I know how many tests have failed ?
>
> thanks
>
> On Mon, Jun 8, 2009 at 10:20 PM, mdipierro  wrote:
>
> > What Hans suggests is the simplest thing. It boils down to
>
> > cd applications/yourapp
> > tar zcvf ../../web2py.app.youapp.w2p *
>
> > there is nothing more to it.
>
> > On Jun 8, 4:10 pm, Hans Donner  wrote:
> > > you might have a look at the current makefile for web2py, there you
> > > can see how the current w2p files are generated.
>
> > > On Mon, Jun 8, 2009 at 9:21 PM, Sebastian E.
>
> > > Ovide wrote:
> > > > Hi Massimo,
>
> > > > I was wondering if there is an easy way to compile and package an
> > > > application from command line. The question arise from the need to
> > integrate
> > > > a web2py project in an automated build system. It builds every night,
> > run
> > > > tests, and if there are not errors it deploys in the DEV environment.
>
> > > > thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23696] Re: Show only users Project

2009-06-09 Thread mdipierro

There is a reference to project.pname that I do not underastand so I
can only give you a partial answer.

You want to specify a filter as first argument of IS_IN_DB


db.projectfile.projectname.requires=IS_IN_DB(db
(db.project.userid==auth.user.id),
'project.pname', '%(pname)s')


On Jun 9, 7:01 am, pk  wrote:
> Hi,
>
> I've another question:
> Every user should upload files and i create a table called
> projectfile.
>
> db.define_table('projectfile',
>                 SQLField('userid', default=auth.user.id if auth.user
> else 0, writable=False, readable=False),
>                 SQLField('procreator', default=auth.user.last_name if
> auth.user else 0, writable=False, readable=False),
>                 SQLField('projectname'),
>                 SQLField('filename'),
>                 SQLField('format'),
>                 SQLField('cdate', 'date', default=now),
>                 SQLField('datei','upload'),
>                 SQLField('description','text'))
>
> db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> db.projectfile.projectname.requires=IS_IN_DB(db,'project.pname')
> db.projectfile.filename.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
> (db,'projectfile.filename')]
> db.projectfile.format.requires=[IS_NOT_EMPTY()]
> db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> 
>
> def projectfile():
>     if auth.is_logged_in():
>         form=SQLFORM(db.projectfile,fields=['projectname',
>                                         'filename',
>                                         'format',
>                                         'description',
>                                         'datei'])
>
> 
>
> now my question: how can i show on the website in the field
> 'projectname' only the projects from the user not all projects in the
> table?
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23697] Re: response.flash upgrade

2009-06-09 Thread mdipierro

I would prefer to minimize the amount of JS that ships with the
scafolding app. It makes it easier to customize it.
I do not object to making admin more sophisticate and flashier.

Massimo

On Jun 9, 7:28 am, "mr.freeze"  wrote:
> Ooooh...That's nice too.  Massimo, should one of these (probably a
> jQuery based one) replace the default response.flash behavior to give
> web2py some more pizazz out of the box? Also, what are your thoughts
> on including jQueryUI with web2py and replacing the current default
> clunky calendar with the jQueryUI calendar?
>
> On Jun 9, 5:19 am, Trollkarlen  wrote:
>
> > I have done the same but with:http://digitarald.de/project/roar
>
> > They have very nice things on that site.
>
> > /T
>
> > mr.freeze wrote:
> > > I don't like having to click on response.flash to close it so I
> > > replaced it with this:
> > >http://stanlemon.net/projects/jgrowl.html
> > > Just thought I would share.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23698] Re: web2py perfomance

2009-06-09 Thread mdipierro

This confirms the 2.5x speedup of trunk vs stable.
It will take me some time to go over the other patches but I will.
Thanks Alexey.

Massimo

On Jun 9, 6:10 am, Alexey Nezhdanov  wrote:
> Results of second set of test runs:
>
> r875            45.523ms
> r882            20.614ms
> inits v.1       18.464ms
> inits v.2       18.677ms
> inits1+lazyT    15.377ms
> inits2+lazyT    15.280ms
>
> Observed noise was 0.502ms for slowest execution (90:1
> signal-to-noise) and 0.889ms for fastest execution (16:1
> signal-to-noise).
> Given than, I think it is safe enough to say that
> "this particular application on this particular hardware/OS
> combination was sped up 2.88...3.31 times".
>
> As in last case - for completeness I'm attaching full console output
>
> I think I know what I'll do. Currently I do not want to release my
> project as any kind of open-source. But I can
> 1) Strip out any code I do not use in this perfomance testing
> 2) rename all sensitive fieldnames/variables to something like field1,
> field2, var3, var4.
> Release resulting package. It would be useless as it is, but it will
> have same perfomance parameters so could be used for testing.
>
> On Tue, Jun 9, 2009 at 1:35 PM, Alexey Nezhdanov wrote:
> > Wrote 'optimised inits v2' patch. Tested everything.
>
> > Once again I changed my testing pattern a bit.
>
> > 1) I dumped my own timing tool in favor of much more standard
> > 'ab' (apache benchmark).
>
> > 2) I decidedly will publish all these results in two main.
> > I just finished first round of testing. Here are results (reported
> > values are average request time in milliseconds. If anyone interested
> > - I'm attaching a full output from my console).
> > I will do all that testing again and publish same results again so
> > that the amount of noise in all this will be public and clearly
> > visible (here I'm fighting with my own temptation to rerun the tests
> > if timings seem to be 'too away' to me).
>
> > First four lines share my app's db.py. Last two require a modified
> > db.py, but modification is cosmetical - each define_table is put into
> > separate function and I do db.tablename=create_table_tablename after
> > each function. Model init time was not measured.
>
> > No more words. Dry figures only. Each line represents result of 10k 
> > requests.
> > r875            46.025ms
> > r882            21.048ms
> > inits v.1       18.918ms
> > inits v.2       18.122ms
> > inits1+lazyT    16.032ms
> > inits2+lazyT    14.391ms
>
> > P.S. I'm surprised about last line... Noise?
>
> > On Tue, Jun 9, 2009 at 11:12 AM, Alexey Nezhdanov wrote:
> >> new testing:
>
> >>  SERVER KERNEL 
> >> --prints
> >> r875    0.04898
> >> r822ini 0.03070 1.60x
> >> --silent
> >> r875    0.04914
> >> r822ini 0.03049 1.61x
>
> >> So I get much more consistent results on this hardware.
> >> While this is obviously not the best perfomance (my weaker box,
> >> with less RAM, troubled with video output 1280x1024,
> >> software 90deg rotation - performs BETTER), that does not matter.
> >> What does - is that I can now be sure that these results are
> >> noise-free so I can safely compare timings from various patches.
> >> Proceeding with writing 'inits v2'.
>
> >> On Tue, Jun 9, 2009 at 10:43 AM, Alexey Nezhdanov wrote:
> >>> Ok. Now the confusion is resolved.
> >>> 1) Speed improvements of 70% and up that I reported yesterday are
> >>> really exist. I just reproduced a 3.47 times model speedup and 2.15
> >>> overall speedup for my app (r875 vs r822+inits).
> >>> BUT this app is atypical. I have added some time measuring code there
> >>> so it prints out two lines per each model init. So when I am testing
> >>> perfomance - screen very quickly scrolls up
>
> >>> 2) Simply commenting out two print statements gives me only 1.67
> >>> overall speedup given equal other conditions. I think that processor
> >>> receive additional interrupts from videocard that in turn results in
> >>> more often checks of tasks queue.
>
> >>> 3) I declare all my previous testing results spoiled by noise
> >>> generated by print statement and inappropriate kernel scheduler
> >>> setting.
> >>> I've set up yet another test box with these parameters:
>
> >>> Intel Core2 Duo 2.66GHz, 2G RAM, Ubuntu 9.04, 'server' flavour kernel
> >>> 2.6.28-11.42. Initially I considered to install a 'realtime' kernel,
> >>> but it appeared to be unstable on that hardware (and afterall - it's
> >>> for sound/video processing and 'server' type is more likely to be
> >>> installed on servers).
>
> >>> Will report new testing results (and finally I hope to write
> >>> 'optimised inits ver.2' patch) later today.
>
> >>> On Tue, Jun 9, 2009 at 5:14 AM, mdipierro wrote:
>
>  Please try launchpad 893. I think it should be faster on GAE.
>  We can do better with lazy tables but at least the validators and
>  calls to getitem are eliminated.
>
>  Massimo
>
>  On Jun 8, 1:05 pm, Markus Gritsch  wrote:
> > On Mon, Jun 8, 2009 at 5:5

[web2py:23699] Re: response.flash upgrade

2009-06-09 Thread annet

Massimo,

I think it is a good idea to substitute the current calendar with a
more straightforward one. I had a look at the dynarch site, the
calender we use in web2py has been moved to the 'old stuff'
section ...

I would prefer a calendar like the one demonstrated here:

http://jqueryui.com/demos/datepicker/


Kind regards,

Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23700] Re: Show only users Project

2009-06-09 Thread pk

thanks but i get a now an error:
Traceback (most recent call last):
  File "gluon/restricted.py", line 98, in restricted
  File "/Applications/web2py1.62/web2py.app/Contents/Resources/
applications/2busy/models/db.py", line 104, in 
AttributeError: 'NoneType' object has no attribute 'id'

#
## Tabelle File
#
db.define_table('projectfile',
SQLField('userid', default=auth.user.id if auth.user
else 0, writable=False, readable=False),
SQLField('procreator', default=auth.user.last_name if
auth.user else 0, writable=False, readable=False),
SQLField('projectname'),
SQLField('filename'),
SQLField('format'),
SQLField('cdate', 'date', default=now),
SQLField('datei','upload'),
SQLField('description','text'))

db.projectfile.projectname.requires=IS_IN_DB(db
(db.project.userid==auth.user.id),'project.pname','%(pname)s')
db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
db.projectfile.filename.requires=[IS_NOT_EMPTY()]
db.projectfile.format.requires=[IS_NOT_EMPTY()]
db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
db.projectfile.datei.requires=IS_NOT_EMPTY()











On 9 Jun., 16:25, mdipierro  wrote:
> There is a reference to project.pname that I do not underastand so I
> can only give you a partial answer.
>
> You want to specify a filter as first argument of IS_IN_DB
>
> db.projectfile.projectname.requires=IS_IN_DB(db
> (db.project.userid==auth.user.id),
>             'project.pname', '%(pname)s')
>
> On Jun 9, 7:01 am, pk  wrote:
>
> > Hi,
>
> > I've another question:
> > Every user should upload files and i create a table called
> > projectfile.
>
> > db.define_table('projectfile',
> >                 SQLField('userid', default=auth.user.id if auth.user
> > else 0, writable=False, readable=False),
> >                 SQLField('procreator', default=auth.user.last_name if
> > auth.user else 0, writable=False, readable=False),
> >                 SQLField('projectname'),
> >                 SQLField('filename'),
> >                 SQLField('format'),
> >                 SQLField('cdate', 'date', default=now),
> >                 SQLField('datei','upload'),
> >                 SQLField('description','text'))
>
> > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > db.projectfile.projectname.requires=IS_IN_DB(db,'project.pname')
> > db.projectfile.filename.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
> > (db,'projectfile.filename')]
> > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > 
>
> > def projectfile():
> >     if auth.is_logged_in():
> >         form=SQLFORM(db.projectfile,fields=['projectname',
> >                                         'filename',
> >                                         'format',
> >                                         'description',
> >                                         'datei'])
>
> > 
>
> > now my question: how can i show on the website in the field
> > 'projectname' only the projects from the user not all projects in the
> > table?
>
> > thanks
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23702] Re: problem with selfreference left outer join

2009-06-09 Thread DenesL

Using latest trunk 1014 and starting from empty app the table
definition fails:

db = SQLDB('sqlite://storage.sqlite')
db.define_table('dog',
SQLField('name'),
SQLField('father_id','reference dog'),
SQLField('mother_id','reference dog'))

Traceback (most recent call last):
  File "D:\web2py\trunk\gluon\restricted.py", line 107, in restricted
exec ccode in environment
  File "D:/web2py/trunk/applications/slides/models/db.py", line 73, in

SQLField('mother_id','reference dog')
  File "D:\web2py\trunk\gluon\sql.py", line 955, in define_table
t = self[tablename] = SQLTable(self, tablename, *fields)
  File "D:\web2py\trunk\gluon\sql.py", line 1147, in __init__
raise SyntaxError, 'SQLTable: table does not exist'
SyntaxError: SQLTable: table does not exist




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23701] Re: global logging to file

2009-06-09 Thread mdipierro

I agree about 1 and 2. I do not thing logging belongs to cache either.

i think we want something like

   request.log(message)

which does something like.

   open(os.path.join(request.folder,'app.log'),'w').write(message
+'\n')

Am I wrong? The problem is that this naive approach would bypass OS
logging and filtering capabilities supported by logging. we should
look into the logging module perhaps we can have a logger per app?

Massimo

On Jun 9, 8:32 am, Hans 
wrote:
> Sorry for being picky on this. I think the database is not a suitable
> place either to store a 'application instance initialized flag'.
> Reason:
> 1) the db can be used by more than one instance of the app
> 2) if the app stops execution without setting back the 'db record' to
> 'app not initialized' - like it happens when you remove the power -
> then the application will not work any more because the code will
> refer to objects which are not created yet because the one-time-
> initialization per app was not executed.
>
> I'm not aware how application wide vars in web2py cache are working,
> but I assume it could be a viable option.
>
> what do you think?
>
> On Jun 8, 2:43 pm, mdipierro  wrote:
>
> > You are right. Not in session. You can store an application wide var
> > in cache but I would suggest using the db for this. Anyway, I will
> > post an example.
>
> > On Jun 8, 4:27 am, Hans 
> > wrote:
>
> > > The log file initialization code must be executed once when the
> > > application starts and should not be executed multiple times (e.g. not
> > > once per user and not once per controller execution).
>
> > > I'm not aware that in a session I can store a application-wide global
> > > variable - independent of the user.
>
> > > Can you provide a link or example code for execution only once per
> > > application (e.g. initialization function) ?
>
> > > On Jun 5, 10:19 pm, mdipierro  wrote:
>
> > > > can you store it into a session?
>
> > > > On Jun 5, 2:11 pm, Hans 
> > > > wrote:
>
> > > > > The problem I have with my code for generating log files that the part
> > > > > of the code (see first posting in this thread) which is outside any
> > > > > function in the controller (because it should be available for all
> > > > > functions in this controller) is executed every time a function is
> > > > > called. I have not found a way to execute it only once intitially and
> > > > > prevent multiple executions. Hence it registeres log handlers every
> > > > > time the controller is executed which causes every log line to be
> > > > > written multiple times into the log file.
>
> > > > > The following did not work:
>
> > > > > try:
> > > > >     done_once
> > > > > except:
> > > > >     place code to be executed only once here
> > > > >     global done_once
> > > > >     done_once=true
>
> > > > > because the variable done_once is undefined each time the controller
> > > > > is executed again.
>
> > > > > How can a code in the controller be executed only once?
> > > > > Also completely different approach suggestions are welcome!
>
> > > > > Thanks,
> > > > > Hans
> > > > > On Jun 5, 4:36 pm, mdipierro  wrote:
>
> > > > > > Sorry Hans, I still do not understand the problem.
>
> > > > > > code outside function is executed when a function in the controller 
> > > > > > is
> > > > > > called (whatever the function) code in the function is executed only
> > > > > > when that function is called. A call to redirect causes the browser 
> > > > > > to
> > > > > > make another request thus the controller is executed again.
>
> > > > > > Massimo
>
> > > > > > On Jun 5, 8:08 am, Hans 
> > > > > > wrote:
>
> > > > > > > Correction: redirect() usage is NOT causing the problem. Every 
> > > > > > > call of
> > > > > > > a controller function also executes
> > > > > > > 1) general parts of the model (db.py)
> > > > > > > 2) general parts of the controller (default.py)
> > > > > > > 3) the requested function in controller
>
> > > > > > > In my case every click to an menu function adds another multiple 
> > > > > > > for
> > > > > > > log entries.
>
> > > > > > > Thinking about the response.menu example which gives you different
> > > > > > > menu options depending on the user being logged in or not I'm
> > > > > > > convinced that the general controller sections are executed before
> > > > > > > each requested function. That's good for the dynamically changing 
> > > > > > > menu
> > > > > > > and other needs.
>
> > > > > > > For a log file function which should be available for the entire
> > > > > > > controller I need to make sure its executed only once. Is there a
> > > > > > > simple way to do that or a different way to achieve a log file
> > > > > > > function (similar like my example up in this thread) available 
> > > > > > > for the
> > > > > > > entire controller?
>
> > > > > > > Thanks,
> > > > > > > Hans
> > > > > > > On Jun 5, 2:34 pm, Hans 
> > > > > > > wrote:
>
> > > > > > > > yes confirmed, the controller is called multiple times. the 
>

[web2py:23703] Re: response.flash upgrade

2009-06-09 Thread mdipierro

yes but the one we have does date and datetime. The other one does not
do datetime. Am I wrong?

On Jun 9, 9:32 am, annet  wrote:
> Massimo,
>
> I think it is a good idea to substitute the current calendar with a
> more straightforward one. I had a look at the dynarch site, the
> calender we use in web2py has been moved to the 'old stuff'
> section ...
>
> I would prefer a calendar like the one demonstrated here:
>
> http://jqueryui.com/demos/datepicker/
>
> Kind regards,
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23704] Re: retrieve_username and retrieve_password

2009-06-09 Thread annet

Massimo,

Uncommenting auth.settings.mailer=mail solved the problem.


Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23705] Re: Show only users Project

2009-06-09 Thread mdipierro

if auth.is_logged_id():
   db.projectfile.projectname.requires=IS_IN_DB(db
(db.project.userid==auth.user.id),'project.pname','%(pname)s')

else you do not have a user id.

why are you still on 1.62? ;-)



On Jun 9, 9:34 am, pk  wrote:
> thanks but i get a now an error:
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 98, in restricted
>   File "/Applications/web2py1.62/web2py.app/Contents/Resources/
> applications/2busy/models/db.py", line 104, in 
> AttributeError: 'NoneType' object has no attribute 'id'
>
> #
> ## Tabelle File
> #
> db.define_table('projectfile',
>                 SQLField('userid', default=auth.user.id if auth.user
> else 0, writable=False, readable=False),
>                 SQLField('procreator', default=auth.user.last_name if
> auth.user else 0, writable=False, readable=False),
>                 SQLField('projectname'),
>                 SQLField('filename'),
>                 SQLField('format'),
>                 SQLField('cdate', 'date', default=now),
>                 SQLField('datei','upload'),
>                 SQLField('description','text'))
>
> db.projectfile.projectname.requires=IS_IN_DB(db
> (db.project.userid==auth.user.id),'project.pname','%(pname)s')
> db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> db.projectfile.filename.requires=[IS_NOT_EMPTY()]
> db.projectfile.format.requires=[IS_NOT_EMPTY()]
> db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> On 9 Jun., 16:25, mdipierro  wrote:
>
> > There is a reference to project.pname that I do not underastand so I
> > can only give you a partial answer.
>
> > You want to specify a filter as first argument of IS_IN_DB
>
> > db.projectfile.projectname.requires=IS_IN_DB(db
> > (db.project.userid==auth.user.id),
> >             'project.pname', '%(pname)s')
>
> > On Jun 9, 7:01 am, pk  wrote:
>
> > > Hi,
>
> > > I've another question:
> > > Every user should upload files and i create a table called
> > > projectfile.
>
> > > db.define_table('projectfile',
> > >                 SQLField('userid', default=auth.user.id if auth.user
> > > else 0, writable=False, readable=False),
> > >                 SQLField('procreator', default=auth.user.last_name if
> > > auth.user else 0, writable=False, readable=False),
> > >                 SQLField('projectname'),
> > >                 SQLField('filename'),
> > >                 SQLField('format'),
> > >                 SQLField('cdate', 'date', default=now),
> > >                 SQLField('datei','upload'),
> > >                 SQLField('description','text'))
>
> > > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > > db.projectfile.projectname.requires=IS_IN_DB(db,'project.pname')
> > > db.projectfile.filename.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
> > > (db,'projectfile.filename')]
> > > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> > > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > > 
>
> > > def projectfile():
> > >     if auth.is_logged_in():
> > >         form=SQLFORM(db.projectfile,fields=['projectname',
> > >                                         'filename',
> > >                                         'format',
> > >                                         'description',
> > >                                         'datei'])
>
> > > 
>
> > > now my question: how can i show on the website in the field
> > > 'projectname' only the projects from the user not all projects in the
> > > table?
>
> > > thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23706] Re: problem with selfreference left outer join

2009-06-09 Thread mdipierro

Try 1015. It seems the previous commit failed. Works for me.

Massimo

On Jun 9, 9:35 am, DenesL  wrote:
> Using latest trunk 1014 and starting from empty app the table
> definition fails:
>
> db = SQLDB('sqlite://storage.sqlite')
> db.define_table('dog',
>     SQLField('name'),
>     SQLField('father_id','reference dog'),
>     SQLField('mother_id','reference dog'))
>
> Traceback (most recent call last):
>   File "D:\web2py\trunk\gluon\restricted.py", line 107, in restricted
>     exec ccode in environment
>   File "D:/web2py/trunk/applications/slides/models/db.py", line 73, in
> 
>     SQLField('mother_id','reference dog')
>   File "D:\web2py\trunk\gluon\sql.py", line 955, in define_table
>     t = self[tablename] = SQLTable(self, tablename, *fields)
>   File "D:\web2py\trunk\gluon\sql.py", line 1147, in __init__
>     raise SyntaxError, 'SQLTable: table does not exist'
> SyntaxError: SQLTable: table does not exist
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23707] Re: Show only users Project

2009-06-09 Thread pk

now i get the next error :(
Traceback (most recent call last):
  File "gluon/restricted.py", line 98, in restricted
  File "/Applications/web2py1.62/web2py.app/Contents/Resources/
applications/2busy/models/db.py", line 103, in 
AttributeError: 'Auth' object has no attribute 'is_logged_id'


i will try it next, but in the past i have some problems in the
version 1.63 with the auth-object, but i will try it ;)




On 9 Jun., 16:39, mdipierro  wrote:
> if auth.is_logged_id():
>    db.projectfile.projectname.requires=IS_IN_DB(db
> (db.project.userid==auth.user.id),'project.pname','%(pname)s')
>
> else you do not have a user id.
>
> why are you still on 1.62? ;-)
>
> On Jun 9, 9:34 am, pk  wrote:
>
> > thanks but i get a now an error:
> > Traceback (most recent call last):
> >   File "gluon/restricted.py", line 98, in restricted
> >   File "/Applications/web2py1.62/web2py.app/Contents/Resources/
> > applications/2busy/models/db.py", line 104, in 
> > AttributeError: 'NoneType' object has no attribute 'id'
>
> > #
> > ## Tabelle File
> > #
> > db.define_table('projectfile',
> >                 SQLField('userid', default=auth.user.id if auth.user
> > else 0, writable=False, readable=False),
> >                 SQLField('procreator', default=auth.user.last_name if
> > auth.user else 0, writable=False, readable=False),
> >                 SQLField('projectname'),
> >                 SQLField('filename'),
> >                 SQLField('format'),
> >                 SQLField('cdate', 'date', default=now),
> >                 SQLField('datei','upload'),
> >                 SQLField('description','text'))
>
> > db.projectfile.projectname.requires=IS_IN_DB(db
> > (db.project.userid==auth.user.id),'project.pname','%(pname)s')
> > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > db.projectfile.filename.requires=[IS_NOT_EMPTY()]
> > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > On 9 Jun., 16:25, mdipierro  wrote:
>
> > > There is a reference to project.pname that I do not underastand so I
> > > can only give you a partial answer.
>
> > > You want to specify a filter as first argument of IS_IN_DB
>
> > > db.projectfile.projectname.requires=IS_IN_DB(db
> > > (db.project.userid==auth.user.id),
> > >             'project.pname', '%(pname)s')
>
> > > On Jun 9, 7:01 am, pk  wrote:
>
> > > > Hi,
>
> > > > I've another question:
> > > > Every user should upload files and i create a table called
> > > > projectfile.
>
> > > > db.define_table('projectfile',
> > > >                 SQLField('userid', default=auth.user.id if auth.user
> > > > else 0, writable=False, readable=False),
> > > >                 SQLField('procreator', default=auth.user.last_name if
> > > > auth.user else 0, writable=False, readable=False),
> > > >                 SQLField('projectname'),
> > > >                 SQLField('filename'),
> > > >                 SQLField('format'),
> > > >                 SQLField('cdate', 'date', default=now),
> > > >                 SQLField('datei','upload'),
> > > >                 SQLField('description','text'))
>
> > > > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > > > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > > > db.projectfile.projectname.requires=IS_IN_DB(db,'project.pname')
> > > > db.projectfile.filename.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
> > > > (db,'projectfile.filename')]
> > > > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > > > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> > > > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > > > 
>
> > > > def projectfile():
> > > >     if auth.is_logged_in():
> > > >         form=SQLFORM(db.projectfile,fields=['projectname',
> > > >                                         'filename',
> > > >                                         'format',
> > > >                                         'description',
> > > >                                         'datei'])
>
> > > > 
>
> > > > now my question: how can i show on the website in the field
> > > > 'projectname' only the projects from the user not all projects in the
> > > > table?
>
> > > > thanks
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from 

[web2py:23708] Re: problem with selfreference left outer join

2009-06-09 Thread DenesL

Same error with 1015.
Did you start from new app?

Steps:
Create new app in admin
Edit db.py to add define_table as above
Click "database administration" in appadmin
Internal error ticket


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23709] Re: response.flash upgrade

2009-06-09 Thread annet

Massimo,

No, you're right, however, I prefer a more straightforward date-picker
to the awkward date- and date-time-picker.


Kind regards,

Annet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23710] Re: Login_next

2009-06-09 Thread annet

Massimo,


> Right now there are two possibilities:
>
> - if web2py redirects you to login, after login, login redirects you
> to the referencing page
> - if you go to the login page without redirection, after login, you go
> to login_next
>
> I think what you see is consistent with this behavior. Am I wrong?

No, you are right. What I would like is web2py to always go to the
page set in login_next , so its behaviour is consistent, and not
dependent on being redirected or not.

I hope this can be fixed.

Annet.




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23711] Re: response.flash upgrade

2009-06-09 Thread DenesL

I feel this is a matter of taste.
The current one looks more cluttered but that is because it offers
more info and options to the user.
Try selecting June 2010 with the jqueryui one.
I prefer the current one.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23712] Re: Show only users Project

2009-06-09 Thread pk

ok i`ve solved my problem with

if auth.is_logged_in():
db.projectfile.projectname.requires=IS_IN_DB(db
(db.project.userid==auth.user.id),'project.pname','%(pname)s')


thanks

On 9 Jun., 16:44, pk  wrote:
> now i get the next error :(
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 98, in restricted
>   File "/Applications/web2py1.62/web2py.app/Contents/Resources/
> applications/2busy/models/db.py", line 103, in 
> AttributeError: 'Auth' object has no attribute 'is_logged_id'
>
> i will try it next, but in the past i have some problems in the
> version 1.63 with the auth-object, but i will try it ;)
>
> On 9 Jun., 16:39, mdipierro  wrote:
>
> > if auth.is_logged_id():
> >    db.projectfile.projectname.requires=IS_IN_DB(db
> > (db.project.userid==auth.user.id),'project.pname','%(pname)s')
>
> > else you do not have a user id.
>
> > why are you still on 1.62? ;-)
>
> > On Jun 9, 9:34 am, pk  wrote:
>
> > > thanks but i get a now an error:
> > > Traceback (most recent call last):
> > >   File "gluon/restricted.py", line 98, in restricted
> > >   File "/Applications/web2py1.62/web2py.app/Contents/Resources/
> > > applications/2busy/models/db.py", line 104, in 
> > > AttributeError: 'NoneType' object has no attribute 'id'
>
> > > #
> > > ## Tabelle File
> > > #
> > > db.define_table('projectfile',
> > >                 SQLField('userid', default=auth.user.id if auth.user
> > > else 0, writable=False, readable=False),
> > >                 SQLField('procreator', default=auth.user.last_name if
> > > auth.user else 0, writable=False, readable=False),
> > >                 SQLField('projectname'),
> > >                 SQLField('filename'),
> > >                 SQLField('format'),
> > >                 SQLField('cdate', 'date', default=now),
> > >                 SQLField('datei','upload'),
> > >                 SQLField('description','text'))
>
> > > db.projectfile.projectname.requires=IS_IN_DB(db
> > > (db.project.userid==auth.user.id),'project.pname','%(pname)s')
> > > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > > db.projectfile.filename.requires=[IS_NOT_EMPTY()]
> > > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> > > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > > On 9 Jun., 16:25, mdipierro  wrote:
>
> > > > There is a reference to project.pname that I do not underastand so I
> > > > can only give you a partial answer.
>
> > > > You want to specify a filter as first argument of IS_IN_DB
>
> > > > db.projectfile.projectname.requires=IS_IN_DB(db
> > > > (db.project.userid==auth.user.id),
> > > >             'project.pname', '%(pname)s')
>
> > > > On Jun 9, 7:01 am, pk  wrote:
>
> > > > > Hi,
>
> > > > > I've another question:
> > > > > Every user should upload files and i create a table called
> > > > > projectfile.
>
> > > > > db.define_table('projectfile',
> > > > >                 SQLField('userid', default=auth.user.id if auth.user
> > > > > else 0, writable=False, readable=False),
> > > > >                 SQLField('procreator', default=auth.user.last_name if
> > > > > auth.user else 0, writable=False, readable=False),
> > > > >                 SQLField('projectname'),
> > > > >                 SQLField('filename'),
> > > > >                 SQLField('format'),
> > > > >                 SQLField('cdate', 'date', default=now),
> > > > >                 SQLField('datei','upload'),
> > > > >                 SQLField('description','text'))
>
> > > > > db.projectfile.procreator.requires=IS_IN_DB(db,'auth_user.last_name')
> > > > > db.projectfile.userid.requires=IS_IN_DB(db,'auth_user.id')
> > > > > db.projectfile.projectname.requires=IS_IN_DB(db,'project.pname')
> > > > > db.projectfile.filename.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
> > > > > (db,'projectfile.filename')]
> > > > > db.projectfile.format.requires=[IS_NOT_EMPTY()]
> > > > > db.projectfile.cdate.requires=[IS_NOT_EMPTY(), IS_DATE()]
> > > > > db.projectfile.datei.requires=IS_NOT_EMPTY()
>
> > > > > 
>
> > > > > def projectfile():
> > > > >     if auth.is_logged_in():
> > > > >         form=SQLFORM(db.projectfile,fields=['projectname',
> > > > >                                         'filename',
> > > > >                                         'format',
> > > > >                                         'description',
> > > > >                                         'datei'])
>
> > > > > 
>
> > > > > now my question: how can i show on t

[web2py:23713] Problem in 1.63.5

2009-06-09 Thread pk

Hi Massimo,

I´ve problems when i login in the new version, i get the default page
of web2py not my requested page. In 1.62 i haven`t got this problem.

Here my code:
@auth.requires_login()
def index():
redirect(URL(r=request,c='menu',f='index'))

## # ##
## Authentifizierungsfunktionen werden aufge-
## rufen und in der user/html, falls angefor-
## dert, dargestellt
## # ##
def user():
return dict(form=auth())

I don`t understand this problem. I hope you can help me that i can
work with the new version.

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23714] Re: problem with selfreference left outer join

2009-06-09 Thread DenesL

This is very easy to reproduce.
Could someone else test and confirm either way?.
Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23715] Texteditor

2009-06-09 Thread pk

Hi,

is there a possibilty to use a texteditor in the html-page (bold-font,
newline ...) for the user and after submit it will save it in the
table.
i need it for an cms for example.

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23716] Re: problem with selfreference left outer join

2009-06-09 Thread DenesL

Created a new repository and exported from svn again.
Now it works (!?)
Strange, old gluon repository has all green svn check marks.
Oh well, main thing is it works.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23717] Re: Auth

2009-06-09 Thread Trollkarlen



Fran wrote:
> On Jun 9, 11:42 am, Robert Marklund  wrote:
> > Cant auth be changed somhow to it will be easier to extend like this:
> > db.define_table('auth_user2',
> >                 db.auth_user,
> >                 SQLField('nickname'),
> >                 SQLField('image','upload'))
> > The problem to day is the:
> > table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email'
> >                                  % self.settings.table_user._tablename)]
> > It will check the auth_user table instead of my extended table for the email
> > to be uniq.
>
> Try:
> auth.settings.table_user_name = 'auth_user2'
>
> F

Do i need to set that before calling the auth.define_tables()  ?
And is it the same with auth.settings.table_user ?

/T

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23718] Re: Problem in 1.63.5

2009-06-09 Thread mdipierro

Can you explain better? Is this is a prblem with the stable or the
tunk version?

On Jun 9, 10:17 am, pk  wrote:
> Hi Massimo,
>
> I´ve problems when i login in the new version, i get the default page
> of web2py not my requested page. In 1.62 i haven`t got this problem.
>
> Here my code:
> @auth.requires_login()
> def index():
> redirect(URL(r=request,c='menu',f='index'))
>
> ## # ##
> ## Authentifizierungsfunktionen werden aufge-
> ## rufen und in der user/html, falls angefor-
> ## dert, dargestellt
> ## # ##
> def user():
> return dict(form=auth())
>
> I don`t understand this problem. I hope you can help me that i can
> work with the new version.
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23719] Re: Auth

2009-06-09 Thread mdipierro

The best way is to customize the auth_user table as shown in the
slides, insdead of subclassing it. Else it is much more complex than
just setting auth.settings.table_user, since references from other
built-in tables will break

Massimo

On Jun 9, 10:42 am, Trollkarlen  wrote:
> Fran wrote:
> > On Jun 9, 11:42 am, Robert Marklund  wrote:
> > > Cant auth be changed somhow to it will be easier to extend like this:
> > > db.define_table('auth_user2',
> > > db.auth_user,
> > > SQLField('nickname'),
> > > SQLField('image','upload'))
> > > The problem to day is the:
> > > table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email'
> > >  % self.settings.table_user._tablename)]
> > > It will check the auth_user table instead of my extended table for the 
> > > email
> > > to be uniq.
>
> > Try:
> > auth.settings.table_user_name = 'auth_user2'
>
> > F
>
> Do i need to set that before calling the auth.define_tables()  ?
> And is it the same with auth.settings.table_user ?
>
> /T
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23720] Should we be tracking bugs and enhancement requests at Launchpad?

2009-06-09 Thread cesmiga

All:

I'm not sure if this has been discussed in the past and would like to
hear more if we should be tracking bugs and enhancement requests at
Launchpad?

https://launchpad.net/web2py

Wouldn't it make code management and processes more manageable and
more folks could aid with QA.

Thank you,
Christopher
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23721] Re: Problem in 1.63.5

2009-06-09 Thread pk

i load the version: Current Version 1.63.5 (2009-06-03 23:35:00) for
osx.

and i use the auth-object. on my index page i`ve a form to login,
register a user.
when the login is correct i receive the follow link:
http://localhost:8000/admin/default/site

but i will receive: http://localhost:8000/2busy/menu/index

in the version 1.62 i have no problems, only in the current version

thanks




On 9 Jun., 17:47, mdipierro  wrote:
> Can you explain better? Is this is a prblem with the stable or the
> tunk version?
>
> On Jun 9, 10:17 am, pk  wrote:
>
> > Hi Massimo,
>
> > I´ve problems when i login in the new version, i get the default page
> > of web2py not my requested page. In 1.62 i haven`t got this problem.
>
> > Here my code:
> > @auth.requires_login()
> > def index():
> >     redirect(URL(r=request,c='menu',f='index'))
>
> > ## # ##
> > ## Authentifizierungsfunktionen werden aufge-
> > ## rufen und in der user/html, falls angefor-
> > ## dert, dargestellt
> > ## # ##
> > def user():
> >     return dict(form=auth())
>
> > I don`t understand this problem. I hope you can help me that i can
> > work with the new version.
>
> > thanks
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23722] Re: response.flash upgrade

2009-06-09 Thread annet

Denes,

Indeed, it is a matter of taste.

But cognitive ergonomically the current calendar is a disaster. The
arrows to increase the months and years are next to today, my test
user did not see the month change when he clicked the arrow nor did he
see the year change when he clicked the double arrows. Also 'today'
did not make sense as a reference, because the year and month display
above it and the day beneath it. When you hover over the arrows, the
select date message changes to 'next month (hold for menu)' or 'next
year (hold for menu)', again, the user did not notice the change
because doesn't display near the mouse pointer. The next year drop
down displays odd or even years not both.


> Try selecting June 2010 with the jqueryui one.

That is a matter of configuring the plugin to display months and year
menus, just like displaying multiple months, restricting the date
range etc ;-)


Kind regards,

Annet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23723] Custom Display Values

2009-06-09 Thread Gary

I'm using crud to interact with a custom view.
form.custom.inpval.fieldname and form.custom.dspval.fieldname display
the proper value for most field types, but not files, select boxes and
checkboxes.  The download easily fixes the file display, but I've been
unable to find a similar solution to displaying the 'lookup' value of
the select rather than the 'id' of the target?  Ditto for the checkbox
rather that 'True/False'.

Thanks in advance for any help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23724] Re: response.flash upgrade

2009-06-09 Thread mr.freeze

There are many more options in the jQueryUI calendar.  For this you
could use:
$('.selector').datepicker({ changeYear: true });


On Jun 9, 10:11 am, DenesL  wrote:
> I feel this is a matter of taste.
> The current one looks more cluttered but that is because it offers
> more info and options to the user.
> Try selecting June 2010 with the jqueryui one.
> I prefer the current one.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23725] Re: Problem in 1.63.5

2009-06-09 Thread annet

Peter,

Aren't you facing the same problem as I am:

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



Annet.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23726] Re: check out my newly built web2py app if you want

2009-06-09 Thread Iceberg

I promise Matt is surely right about the font issue. :-)

And one more defect, trying to not completing necessary field results
in a "function error_message at 0x8c1c41c" appearing at the usual
response.flash area.

Everything else seems ok. I like your two level menu especially. Hope
to see your source code soon. :-)

On Jun9, 7:59am, "mgbeli...@gmail.com"  wrote:
> Thanks Yarko for those pointers, I just fixed them up.  The fonts
> don't show up because you must have Japanese fonts installed on your
> OS for them to work, I've tested it with several browser/platform
> combos and it was the lack of font packages that caused that every
> time.
>
> Thanks again for taking the time to look and giving me a heads up on a
> few of those things.
>
> -Matt
>
> On Jun 8, 3:49 pm, Yarko Tymciurak  wrote:
>
> > Hi Matt -
> > In checking this out, I notice that that dailynihongo is marked utf-8, but I
> > cannot see (most) of the characters, FYI.   I tried 3 different Japanese
> > encodings, but must not have the right character sets  this is just
> > commentary, as others may experience (I'm not sure what to do, and didn't
> > really try hard - perhaps the tutorial deserves a "help" button).
>
> > On the lemurstrikes site, I have to manually change the URL of your
> > portfolio to see other examples besides dailynihongo;  portfolio/1
> > (excellence_english) returns Invalid Request
>
> > Hope this is helpful.
>
> > Regards,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23727] Re: Problem in 1.63.5

2009-06-09 Thread pk

Hi Annet,

it seems to be the same problem.

Peter

On 9 Jun., 18:09, annet  wrote:
> Peter,
>
> Aren't you facing the same problem as I am:
>
> http://groups.google.com/group/web2py/browse_thread/thread/d5083ed08c...
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23728] Re: Texteditor

2009-06-09 Thread annet

I am using NicEdit:

http://nicedit.com/


Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23729] Re: Should we be tracking bugs and enhancement requests at Launchpad?

2009-06-09 Thread Jason Brower

Sadly, I agree, but 1 month ago, the choice was made to stick to what we
have now.  I REALLY want that to happen.
Regards,
Jason Brower


On Tue, 2009-06-09 at 08:56 -0700, cesmiga wrote:
> All:
> 
> I'm not sure if this has been discussed in the past and would like to
> hear more if we should be tracking bugs and enhancement requests at
> Launchpad?
> 
> https://launchpad.net/web2py
> 
> Wouldn't it make code management and processes more manageable and
> more folks could aid with QA.
> 
> Thank you,
> Christopher
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23730] Re: web2py perfomance

2009-06-09 Thread AchipA

Any particular reason not doing is_integer via a 'try: int(i) except:
return False'  statement ? It should be faster than regexes.

On Jun 7, 1:49 pm, Iceberg  wrote:
> On Jun7, 6:35pm, Alexey Nezhdanov  wrote:
>
>
>
> > > 2) is_integer is a fast call, but with 1.1k (!) calls ...
>
> > Replaced it with my own version:
> > integer_pat=re.compile('[0-9]+$')
> > is_integer=lambda x: integer_pat.match(x)
> > it's about 2.3 times faster. C version would be even better.
>
> If so, perhaps this is even better:
>
>   integer_pat=re.compile('[0-9]+$')
>   is_integer=integer_pat.match
>
> Because lambda is considered as much slower than built-in functions,
> AFAIK.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23731] Re: Custom Display Values

2009-06-09 Thread mdipierro

with the new trunk you can do

{{=form.custom.widget.fieldname}}

On Jun 9, 11:06 am, Gary  wrote:
> I'm using crud to interact with a custom view.
> form.custom.inpval.fieldname and form.custom.dspval.fieldname display
> the proper value for most field types, but not files, select boxes and
> checkboxes.  The download easily fixes the file display, but I've been
> unable to find a similar solution to displaying the 'lookup' value of
> the select rather than the 'id' of the target?  Ditto for the checkbox
> rather that 'True/False'.
>
> Thanks in advance for any help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23732] Re: Login_next

2009-06-09 Thread mdipierro

I have an idea that may fix this. I will work on it tonight.

On Jun 9, 10:05 am, annet  wrote:
> Massimo,
>
> > Right now there are two possibilities:
>
> > - if web2py redirects you to login, after login, login redirects you
> > to the referencing page
> > - if you go to the login page without redirection, after login, you go
> > to login_next
>
> > I think what you see is consistent with this behavior. Am I wrong?
>
> No, you are right. What I would like is web2py to always go to the
> page set in login_next , so its behaviour is consistent, and not
> dependent on being redirected or not.
>
> I hope this can be fixed.
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23733] Re: Texteditor

2009-06-09 Thread mdipierro

Using nicedit you can change the textareas for the field you need into
wysiwyg fields.

To then display the field properly you much prevent escaping with
{{=XML(fieldvalue)}}

On Jun 9, 11:16 am, annet  wrote:
> I am using NicEdit:
>
> http://nicedit.com/
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23734] Subset of records in SQLFORM dropbox

2009-06-09 Thread Gutch

Hello,

Sorry if this question is a repeat, but I'm new here and couldn't find
anything on point in the archive.

I'm trying to create a form for data insertion, which will include a
dropbox representing a foreign key. Trouble is, the foreign table has
another key representing the row's 'school', which corresponds to the
'school' of the logged-in user. I only want the dropbox to represent
rows whose school entry matches that of the user.

Is there any way to accomplish this with a SQLFORM? I could use a
FORM, a SQLFORM in HTML, or I could modify the SQLFORM class, but I'd
like to keep my code as simple and reusable as possible.

Here's the relevant code:

>From db.py:

db.define_table('school',SQLField('name','string'),
 SQLField('schoolnumber','integer')
   )
db.define_table('student',SQLField('school',db.school),
  SQLField('home_room','string'),
  SQLField('lastfirst','string',length=35),
  SQLField('student_number','integer'),
  SQLField
('enroll_status','integer',default=0)
   )
db.define_table('incident',SQLField('student',db.student),
   SQLField('starttime','datetime'),
   SQLField('endtime','datetime'),
   SQLField('rpttime','datetime'),
   SQLField('activity','string'),
   SQLField('location','string')
   )
db.define_table('staff',SQLField('school',db.school),
SQLField('emp_number','integer'),
SQLField('last_name','string'),
SQLField('first_name','string'),
SQLField('jobtitle','string')
   )
db.student.school.requires=IS_IN_DB(db,'school.id','school.name')
db.incident.student.requires=IS_IN_DB
(db,'student.id','student.lastfirst')
db.staff.school.requires=IS_IN_DB(db,'school.id','school.name')

>From the controller:

def incident():
uid = userid()
s = session.school
staffname=db(db.staff.id==uid).select
(db.staff.first_name,db.staff.last_name)
incidentform=SQLFORM(db.incident)  #I want the student dropbox
populated only with values in
   #db
(db.student.school==s).select(db.student.id,db.student.lastfirst)
return dict(staffname=staffname[0].first_name.capitalize
(),incidentform=incidentform)

>From the view:

{{extend 'layout.html'}}
This is the incident.html template
Hello, {{=staffname}}!
{{=incidentform}}



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23735] Re: Should we be tracking bugs and enhancement requests at Launchpad?

2009-06-09 Thread Yarko Tymciurak
just a reminder - there was a plan afoot to move from launchpad to mercurial
hosting (likely on google code)...

On Tue, Jun 9, 2009 at 11:16 AM, Jason Brower  wrote:

>
> Sadly, I agree, but 1 month ago, the choice was made to stick to what we
> have now.  I REALLY want that to happen.
> Regards,
> Jason Brower
>
>
> On Tue, 2009-06-09 at 08:56 -0700, cesmiga wrote:
> > All:
> >
> > I'm not sure if this has been discussed in the past and would like to
> > hear more if we should be tracking bugs and enhancement requests at
> > Launchpad?
> >
> > https://launchpad.net/web2py
> >
> > Wouldn't it make code management and processes more manageable and
> > more folks could aid with QA.
> >
> > Thank you,
> > Christopher
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23736] Re: Texteditor

2009-06-09 Thread pk

oh thanks, it`s a cool tool.

peter

On 9 Jun., 18:16, annet  wrote:
> I am using NicEdit:
>
> http://nicedit.com/
>
> Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23737] Re: Should we be tracking bugs and enhancement requests at Launchpad?

2009-06-09 Thread mdipierro

Yes and no.

We are moving to mercurial very very soon and move away from launchpad
so I would prefer we use google code for bug tracking.
It is also faster for me to access.

Anyway, I never said that we should use bug tracking. I only asked to
first email the list to make sure you indeed found a bug. What happens
is that when you ask, it is easier for me to fix and then respond than
for me to submit a bug, fix the bug and close the ticket.

We only have one open bug (or more like a required change in behavior)
that I know of, the one about redirection in login. I also have 3
pending patches from Hans and Alexey.

Massimo



On Jun 9, 11:16 am, Jason Brower  wrote:
> Sadly, I agree, but 1 month ago, the choice was made to stick to what we
> have now.  I REALLY want that to happen.
> Regards,
> Jason Brower
>
> On Tue, 2009-06-09 at 08:56 -0700, cesmiga wrote:
> > All:
>
> > I'm not sure if this has been discussed in the past and would like to
> > hear more if we should be tracking bugs and enhancement requests at
> > Launchpad?
>
> >https://launchpad.net/web2py
>
> > Wouldn't it make code management and processes more manageable and
> > more folks could aid with QA.
>
> > Thank you,
> > Christopher
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23738] Re: web2py perfomance

2009-06-09 Thread mdipierro

good point. Anyway, the function is no longer called as often as
Alexey originally pointed out, so it would make a negligible
difference. I will change it though.

Massimo

On Jun 9, 11:24 am, AchipA  wrote:
> Any particular reason not doing is_integer via a 'try: int(i) except:
> return False'  statement ? It should be faster than regexes.
>
> On Jun 7, 1:49 pm, Iceberg  wrote:
>
> > On Jun7, 6:35pm, Alexey Nezhdanov  wrote:
>
> > > > 2) is_integer is a fast call, but with 1.1k (!) calls ...
>
> > > Replaced it with my own version:
> > > integer_pat=re.compile('[0-9]+$')
> > > is_integer=lambda x: integer_pat.match(x)
> > > it's about 2.3 times faster. C version would be even better.
>
> > If so, perhaps this is even better:
>
> >   integer_pat=re.compile('[0-9]+$')
> >   is_integer=integer_pat.match
>
> > Because lambda is considered as much slower than built-in functions,
> > AFAIK.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23739] table/sqltable helper post-production

2009-06-09 Thread AchipA

Just been through some TABLE() and SQLTABLE() work and could not find
a way (I was satisfied with) to change output results of particular
columns. For example, I have an sql column that is a color code and
I'd like to put in a css element with that color. The hard way is
obviously foregoing the {{=table}} and looping through all the
components, changing the ones you need, but this produces mighty ugly
views. Is there a more intelligent/recommended way of doing this ?

If not, I'd like to suggest something like a per-column map function,
similar to what we have for upload columns now. For example

SQLTABLE(result=result, map={'colorcol': mycolorfunc, 'linkcol' :
lambda x: A(_href=x), 'bigfloatcol' : lambda x: "%.2f" % x} )

The same could work for TABLE() if they have a header row to identify
columns.
This could be also useful for views, too, imagine:

{{table.map['badlyformattedcol'] = goodformatfunc}}
{{=table}}

Comments, suggestions, recommendations ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23740] Re: Subset of records in SQLFORM dropbox

2009-06-09 Thread mdipierro

I do not fully understand. You want a create incident form but that
does not have a school field.
I guess what you want is display only students for the same school as
the logged in staff. In this case you can do

school_id=db.staff[userid()].school if userdi() else None
db.incident.student.requires=IS_IN_DB(db
(db.student.school==school_id),'student.id','student.lastfirst')

Massimo

On Jun 9, 10:59 am, Gutch  wrote:
> Hello,
>
> Sorry if this question is a repeat, but I'm new here and couldn't find
> anything on point in the archive.
>
> I'm trying to create a form for data insertion, which will include a
> dropbox representing a foreign key. Trouble is, the foreign table has
> another key representing the row's 'school', which corresponds to the
> 'school' of the logged-in user. I only want the dropbox to represent
> rows whose school entry matches that of the user.
>
> Is there any way to accomplish this with a SQLFORM? I could use a
> FORM, a SQLFORM in HTML, or I could modify the SQLFORM class, but I'd
> like to keep my code as simple and reusable as possible.
>
> Here's the relevant code:
>
> From db.py:
>
> db.define_table('school',SQLField('name','string'),
>  SQLField('schoolnumber','integer')
>)
> db.define_table('student',SQLField('school',db.school),
>   SQLField('home_room','string'),
>   SQLField('lastfirst','string',length=35),
>   SQLField('student_number','integer'),
>   SQLField
> ('enroll_status','integer',default=0)
>)
> db.define_table('incident',SQLField('student',db.student),
>SQLField('starttime','datetime'),
>SQLField('endtime','datetime'),
>SQLField('rpttime','datetime'),
>SQLField('activity','string'),
>SQLField('location','string')
>)
> db.define_table('staff',SQLField('school',db.school),
> SQLField('emp_number','integer'),
> SQLField('last_name','string'),
> SQLField('first_name','string'),
> SQLField('jobtitle','string')
>)
> db.student.school.requires=IS_IN_DB(db,'school.id','school.name')
> db.incident.student.requires=IS_IN_DB
> (db,'student.id','student.lastfirst')
> db.staff.school.requires=IS_IN_DB(db,'school.id','school.name')
>
> From the controller:
>
> def incident():
> uid = userid()
> s = session.school
> staffname=db(db.staff.id==uid).select
> (db.staff.first_name,db.staff.last_name)
> incidentform=SQLFORM(db.incident)  #I want the student dropbox
> populated only with values in
>#db
> (db.student.school==s).select(db.student.id,db.student.lastfirst)
> return dict(staffname=staffname[0].first_name.capitalize
> (),incidentform=incidentform)
>
> From the view:
>
> {{extend 'layout.html'}}
> This is the incident.html template
> Hello, {{=staffname}}!
> {{=incidentform}}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23741] Re: table/sqltable helper post-production

2009-06-09 Thread mdipierro

There is no may to make a SQLTABLE taht fits everybody's taste and
needs. I think you should

1) define your own SQLTABLE2, or
2) loop over rows explicitly

Massimo

On Jun 9, 11:50 am, AchipA  wrote:
> Just been through some TABLE() and SQLTABLE() work and could not find
> a way (I was satisfied with) to change output results of particular
> columns. For example, I have an sql column that is a color code and
> I'd like to put in a css element with that color. The hard way is
> obviously foregoing the {{=table}} and looping through all the
> components, changing the ones you need, but this produces mighty ugly
> views. Is there a more intelligent/recommended way of doing this ?
>
> If not, I'd like to suggest something like a per-column map function,
> similar to what we have for upload columns now. For example
>
> SQLTABLE(result=result, map={'colorcol': mycolorfunc, 'linkcol' :
> lambda x: A(_href=x), 'bigfloatcol' : lambda x: "%.2f" % x} )
>
> The same could work for TABLE() if they have a header row to identify
> columns.
> This could be also useful for views, too, imagine:
>
> {{table.map['badlyformattedcol'] = goodformatfunc}}
> {{=table}}
>
> Comments, suggestions, recommendations ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23742] redirect

2009-06-09 Thread Jose

Hello

At the end of the load of information on the part of the user there is
a link to the following function:

def terminar():
if session.documento is None:
redirect(URL(r=request, c='default', f='index'))
...

if solicitud[0].id > 0:
response.headers['Content-Type']='application/pdf'
response.headers['Content-Disposition'] = 'attachment;
filename=solicitud.pdf'

return reportes.impresion_tramite(solicitud[0].IdMatricula,
solicitud[0].Fecha)
else:
return None


This one generates a file pdf. What I want is that after generating
the pdf, redirect to index

If I put the redirect before the return it does not create the pdf, if
I put it after does not work.
Since I must do?

Regards
Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23743] Re: global logging to file

2009-06-09 Thread Iceberg

request.log(message) would be nice, but all the advantages of standard
logging are too good to let go. So I came up with this little trick.

Add following codes inside model/log.py:

  def _init_log():
import logging
logger=logging.getLogger(request.application)
logger.setLevel(logging.DEBUG)
handler=logging.FileHandler("%s.log"%request.application)
handler.setLevel(logging.DEBUG)
handler.setFormatter(logging.Formatter(
  "%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)
s"))
logger.addHandler(handler)
return logger
  logging=cache.ram('once',lambda:_init_log(),time_expire=)

Then, in any of your controller, you can just do the usual:
  logging.warn('blah blah')
The only tricky point is you can not do this inside your controller:
  import logging
otherwise you lose the magic. ;-)

Besides, thanks for Hans for bringing up all the issue, which inspires
me to find the solution (at least for me) for this problem haunting me
for long time.

On Jun9, 10:35pm, mdipierro  wrote:
> I agree about 1 and 2. I do not thing logging belongs to cache either.
>
> i think we want something like
>
>    request.log(message)
>
> which does something like.
>
>    open(os.path.join(request.folder,'app.log'),'w').write(message
> +'\n')
>
> Am I wrong? The problem is that this naive approach would bypass OS
> logging and filtering capabilities supported by logging. we should
> look into the logging module perhaps we can have a logger per app?
>
> Massimo
>
> On Jun 9, 8:32 am, Hans 
> wrote:
>
> > Sorry for being picky on this. I think the database is not a suitable
> > place either to store a 'application instance initialized flag'.
> > Reason:
> > 1) the db can be used by more than one instance of the app
> > 2) if the app stops execution without setting back the 'db record' to
> > 'app not initialized' - like it happens when you remove the power -
> > then the application will not work any more because the code will
> > refer to objects which are not created yet because the one-time-
> > initialization per app was not executed.
>
> > I'm not aware how application wide vars in web2py cache are working,
> > but I assume it could be a viable option.
>
> > what do you think?
>
> > On Jun 8, 2:43 pm, mdipierro  wrote:
>
> > > You are right. Not in session. You can store an application wide var
> > > in cache but I would suggest using the db for this. Anyway, I will
> > > post an example.
>
> > > On Jun 8, 4:27 am, Hans 
> > > wrote:
>
> > > > The log file initialization code must be executed once when the
> > > > application starts and should not be executed multiple times (e.g. not
> > > > once per user and not once per controller execution).
>
> > > > I'm not aware that in a session I can store a application-wide global
> > > > variable - independent of the user.
>
> > > > Can you provide a link or example code for execution only once per
> > > > application (e.g. initialization function) ?
>
> > > > On Jun 5, 10:19 pm, mdipierro  wrote:
>
> > > > > can you store it into a session?
>
> > > > > On Jun 5, 2:11 pm, Hans 
> > > > > wrote:
>
> > > > > > The problem I have with my code for generating log files that the 
> > > > > > part
> > > > > > of the code (see first posting in this thread) which is outside any
> > > > > > function in the controller (because it should be available for all
> > > > > > functions in this controller) is executed every time a function is
> > > > > > called. I have not found a way to execute it only once intitially 
> > > > > > and
> > > > > > prevent multiple executions. Hence it registeres log handlers every
> > > > > > time the controller is executed which causes every log line to be
> > > > > > written multiple times into the log file.
>
> > > > > > The following did not work:
>
> > > > > > try:
> > > > > >     done_once
> > > > > > except:
> > > > > >     place code to be executed only once here
> > > > > >     global done_once
> > > > > >     done_once=true
>
> > > > > > because the variable done_once is undefined each time the controller
> > > > > > is executed again.
>
> > > > > > How can a code in the controller be executed only once?
> > > > > > Also completely different approach suggestions are welcome!
>
> > > > > > Thanks,
> > > > > > Hans
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23744] Re: Should we be tracking bugs and enhancement requests at Launchpad?

2009-06-09 Thread cesmiga

Massimo,

Thank you for the update.  My apologies since this was discussed
earlier.

Christopher



mdipierro wrote:
> Yes and no.
>
> We are moving to mercurial very very soon and move away from launchpad
> so I would prefer we use google code for bug tracking.
> It is also faster for me to access.
>
> Anyway, I never said that we should use bug tracking. I only asked to
> first email the list to make sure you indeed found a bug. What happens
> is that when you ask, it is easier for me to fix and then respond than
> for me to submit a bug, fix the bug and close the ticket.
>
> We only have one open bug (or more like a required change in behavior)
> that I know of, the one about redirection in login. I also have 3
> pending patches from Hans and Alexey.
>
> Massimo
>
>
>
> On Jun 9, 11:16 am, Jason Brower  wrote:
> > Sadly, I agree, but 1 month ago, the choice was made to stick to what we
> > have now.  I REALLY want that to happen.
> > Regards,
> > Jason Brower
> >
> > On Tue, 2009-06-09 at 08:56 -0700, cesmiga wrote:
> > > All:
> >
> > > I'm not sure if this has been discussed in the past and would like to
> > > hear more if we should be tracking bugs and enhancement requests at
> > > Launchpad?
> >
> > >https://launchpad.net/web2py
> >
> > > Wouldn't it make code management and processes more manageable and
> > > more folks could aid with QA.
> >
> > > Thank you,
> > > Christopher
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23745] Re: check out my newly built web2py app if you want

2009-06-09 Thread mikech

It seems I created two new decks without hitting the submit button by
just navigating away from the page.  Also would be nice to be able to
delete them.

Mike

On Jun 9, 9:12 am, Iceberg  wrote:
> I promise Matt is surely right about the font issue. :-)
>
> And one more defect, trying to not completing necessary field results
> in a "function error_message at 0x8c1c41c" appearing at the usual
> response.flash area.
>
> Everything else seems ok. I like your two level menu especially. Hope
> to see your source code soon. :-)
>
> On Jun9, 7:59am, "mgbeli...@gmail.com"  wrote:
>
>
>
> > Thanks Yarko for those pointers, I just fixed them up.  The fonts
> > don't show up because you must have Japanese fonts installed on your
> > OS for them to work, I've tested it with several browser/platform
> > combos and it was the lack of font packages that caused that every
> > time.
>
> > Thanks again for taking the time to look and giving me a heads up on a
> > few of those things.
>
> > -Matt
>
> > On Jun 8, 3:49 pm, Yarko Tymciurak  wrote:
>
> > > Hi Matt -
> > > In checking this out, I notice that that dailynihongo is marked utf-8, 
> > > but I
> > > cannot see (most) of the characters, FYI.   I tried 3 different Japanese
> > > encodings, but must not have the right character sets  this is just
> > > commentary, as others may experience (I'm not sure what to do, and didn't
> > > really try hard - perhaps the tutorial deserves a "help" button).
>
> > > On the lemurstrikes site, I have to manually change the URL of your
> > > portfolio to see other examples besides dailynihongo;  portfolio/1
> > > (excellence_english) returns Invalid Request
>
> > > Hope this is helpful.
>
> > > Regards,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23746] Re: rev 877 breaks app

2009-06-09 Thread Fran

On Jun 9, 3:13 pm, mdipierro  wrote:
> Uploading another version to trunk. Please give it another try

r896 works fine - many thanks :)

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23747] Re: Custom Display Values

2009-06-09 Thread Gary

I tried {{=form.custom.widget.town_id}} in 1.63.5 and got an error
"AttributeError: 'NoneType' object has no attribute 'town_id'".
Using {{=form.custom.inpval.town_id}} returns a '1', the value of the
id in the 'Location' file pointing to the 'Town' file.

For clarification, does 'new trunk' mean something other than the
current release?

Thanks.



On Jun 9, 12:38 pm, mdipierro  wrote:
> with the new trunk you can do
>
> {{=form.custom.widget.fieldname}}
>
> On Jun 9, 11:06 am, Gary  wrote:
>
> > I'm using crud to interact with a custom view.
> > form.custom.inpval.fieldname and form.custom.dspval.fieldname display
> > the proper value for most field types, but not files, select boxes and
> > checkboxes.  The download easily fixes the file display, but I've been
> > unable to find a similar solution to displaying the 'lookup' value of
> > the select rather than the 'id' of the target?  Ditto for the checkbox
> > rather that 'True/False'.
>
> > Thanks in advance for any help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23748] Re: Custom Display Values

2009-06-09 Thread Fran

On Jun 9, 6:41 pm, Gary  wrote:
> For clarification, does 'new trunk' mean something other than the
> current release?

It means the live code downloaded via Bzr:
https://code.launchpad.net/~mdipierro/web2py/devel

So more current than the latest release.

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23749] Re: rev 877 breaks app

2009-06-09 Thread Fran

On Jun 9, 6:27 pm, Fran  wrote:
> On Jun 9, 3:13 pm, mdipierro  wrote:
> > Uploading another version to trunk. Please give it another try
> r896 works fine - many thanks :)

Solves that issue but seems to break updates:

This is a ticket from Tools' register() (but it also happens on other
DB updates)

Traceback (most recent call last):
  File "C:\Bin\web2py\gluon\restricted.py", line 107, in restricted
exec ccode in environment
  File "C:/Bin/web2py/applications/sahana/controllers/default.py",
line 59, in 
  File "C:/Bin/web2py/applications/sahana/models/00_db.py", line 453,
in 
response._caller = lambda f: shn_sessions(f)
  File "C:/Bin/web2py/applications/sahana/models/00_db.py", line 452,
in shn_sessions
return f()
  File "C:/Bin/web2py/applications/sahana/controllers/default.py",
line 13, in user
return dict(form=auth(), module_name=module_name)
  File "C:\Bin\web2py\gluon\tools.py", line 440, in __call__
return self.register()
  File "C:\Bin\web2py\applications\sahana\modules\sahana.py", line
384, in register
user[form.vars.id] = dict(registration_key='')
  File "C:\Bin\web2py\gluon\sql.py", line 1177, in __setitem__
== key).update(**self._filter_fields(value)):
  File "C:\Bin\web2py\gluon\sql.py", line 2160, in update
query = self._update(**update_fields)
  File "C:\Bin\web2py\gluon\sql.py", line 2146, in _update
in update_fields and table[field].update
UnboundLocalError: local variable 'field' referenced before assignment
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23750] Re: web2py perfomance

2009-06-09 Thread Iceberg

I don't know but you'd better do some profiling if you really want to
find out. IMHO, try...except might be fast, but wrapping it inside a
user-defined function could be another story, because defining a
function is expensive in python, so we shall call native function
(implemented by C) whenever possible.

On Jun10, 0:48am, mdipierro  wrote:
> good point. Anyway, the function is no longer called as often as
> Alexey originally pointed out, so it would make a negligible
> difference. I will change it though.
>
> Massimo
>
> On Jun 9, 11:24 am, AchipA  wrote:
>
> > Any particular reason not doing is_integer via a 'try: int(i) except:
> > return False'  statement ? It should be faster than regexes.
>
> > On Jun 7, 1:49 pm, Iceberg  wrote:
>
> > > On Jun7, 6:35pm, Alexey Nezhdanov  wrote:
>
> > > > > 2) is_integer is a fast call, but with 1.1k (!) calls ...
>
> > > > Replaced it with my own version:
> > > > integer_pat=re.compile('[0-9]+$')
> > > > is_integer=lambda x: integer_pat.match(x)
> > > > it's about 2.3 times faster. C version would be even better.
>
> > > If so, perhaps this is even better:
>
> > >   integer_pat=re.compile('[0-9]+$')
> > >   is_integer=integer_pat.match
>
> > > Because lambda is considered as much slower than built-in functions,
> > > AFAIK.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23751] Re: redirect

2009-06-09 Thread mdipierro

I am not familiar with the function

reportes.impresion_tramite(...)

what does it return? If your intention is to return the PDF to the
user (http 200 ok) you cannot redirect (http 303 redirect). The two
statements are not compatible.

Massimo



On Jun 9, 12:11 pm, Jose  wrote:
> Hello
>
> At the end of the load of information on the part of the user there is
> a link to the following function:
>
> def terminar():
> if session.documento is None:
> redirect(URL(r=request, c='default', f='index'))
> ...
>
> if solicitud[0].id > 0:
> response.headers['Content-Type']='application/pdf'
> response.headers['Content-Disposition'] = 'attachment;
> filename=solicitud.pdf'
>
> return reportes.impresion_tramite(solicitud[0].IdMatricula,
> solicitud[0].Fecha)
> else:
> return None
>
> This one generates a file pdf. What I want is that after generating
> the pdf, redirect to index
>
> If I put the redirect before the return it does not create the pdf, if
> I put it after does not work.
> Since I must do?
>
> Regards
> Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23752] Re: global logging to file

2009-06-09 Thread mdipierro

I think you nailed it! I would change the file name so that it resides
inside the applicaitons folder:

handler=logging.FileHandler(os.path.join(request.folder,"system.log"))

we could also add a line in the admin to peek the log (like with
sql.log).

On Jun 9, 12:18 pm, Iceberg  wrote:
> request.log(message) would be nice, but all the advantages of standard
> logging are too good to let go. So I came up with this little trick.
>
> Add following codes inside model/log.py:
>
>   def _init_log():
> import logging
> logger=logging.getLogger(request.application)
> logger.setLevel(logging.DEBUG)
> handler=logging.FileHandler("%s.log"%request.application)
> handler.setLevel(logging.DEBUG)
> handler.setFormatter(logging.Formatter(
>   "%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)
> s"))
> logger.addHandler(handler)
> return logger
>   logging=cache.ram('once',lambda:_init_log(),time_expire=)
>
> Then, in any of your controller, you can just do the usual:
>   logging.warn('blah blah')
> The only tricky point is you can not do this inside your controller:
>   import logging
> otherwise you lose the magic. ;-)
>
> Besides, thanks for Hans for bringing up all the issue, which inspires
> me to find the solution (at least for me) for this problem haunting me
> for long time.
>
> On Jun9, 10:35pm, mdipierro  wrote:
>
> > I agree about 1 and 2. I do not thing logging belongs to cache either.
>
> > i think we want something like
>
> >request.log(message)
>
> > which does something like.
>
> >open(os.path.join(request.folder,'app.log'),'w').write(message
> > +'\n')
>
> > Am I wrong? The problem is that this naive approach would bypass OS
> > logging and filtering capabilities supported by logging. we should
> > look into the logging module perhaps we can have a logger per app?
>
> > Massimo
>
> > On Jun 9, 8:32 am, Hans 
> > wrote:
>
> > > Sorry for being picky on this. I think the database is not a suitable
> > > place either to store a 'application instance initialized flag'.
> > > Reason:
> > > 1) the db can be used by more than one instance of the app
> > > 2) if the app stops execution without setting back the 'db record' to
> > > 'app not initialized' - like it happens when you remove the power -
> > > then the application will not work any more because the code will
> > > refer to objects which are not created yet because the one-time-
> > > initialization per app was not executed.
>
> > > I'm not aware how application wide vars in web2py cache are working,
> > > but I assume it could be a viable option.
>
> > > what do you think?
>
> > > On Jun 8, 2:43 pm, mdipierro  wrote:
>
> > > > You are right. Not in session. You can store an application wide var
> > > > in cache but I would suggest using the db for this. Anyway, I will
> > > > post an example.
>
> > > > On Jun 8, 4:27 am, Hans 
> > > > wrote:
>
> > > > > The log file initialization code must be executed once when the
> > > > > application starts and should not be executed multiple times (e.g. not
> > > > > once per user and not once per controller execution).
>
> > > > > I'm not aware that in a session I can store a application-wide global
> > > > > variable - independent of the user.
>
> > > > > Can you provide a link or example code for execution only once per
> > > > > application (e.g. initialization function) ?
>
> > > > > On Jun 5, 10:19 pm, mdipierro  wrote:
>
> > > > > > can you store it into a session?
>
> > > > > > On Jun 5, 2:11 pm, Hans 
> > > > > > wrote:
>
> > > > > > > The problem I have with my code for generating log files that the 
> > > > > > > part
> > > > > > > of the code (see first posting in this thread) which is outside 
> > > > > > > any
> > > > > > > function in the controller (because it should be available for all
> > > > > > > functions in this controller) is executed every time a function is
> > > > > > > called. I have not found a way to execute it only once intitially 
> > > > > > > and
> > > > > > > prevent multiple executions. Hence it registeres log handlers 
> > > > > > > every
> > > > > > > time the controller is executed which causes every log line to be
> > > > > > > written multiple times into the log file.
>
> > > > > > > The following did not work:
>
> > > > > > > try:
> > > > > > > done_once
> > > > > > > except:
> > > > > > > place code to be executed only once here
> > > > > > > global done_once
> > > > > > > done_once=true
>
> > > > > > > because the variable done_once is undefined each time the 
> > > > > > > controller
> > > > > > > is executed again.
>
> > > > > > > How can a code in the controller be executed only once?
> > > > > > > Also completely different approach suggestions are welcome!
>
> > > > > > > Thanks,
> > > > > > > Hans
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email t

[web2py:23753] Re: Should we be tracking bugs and enhancement requests at Launchpad?

2009-06-09 Thread mdipierro

No problem at all. this is an important issue and if we are not doing
it right, I want to know.

On Jun 9, 12:19 pm, cesmiga  wrote:
> Massimo,
>
> Thank you for the update.  My apologies since this was discussed
> earlier.
>
> Christopher
>
> mdipierro wrote:
> > Yes and no.
>
> > We are moving to mercurial very very soon and move away from launchpad
> > so I would prefer we use google code for bug tracking.
> > It is also faster for me to access.
>
> > Anyway, I never said that we should use bug tracking. I only asked to
> > first email the list to make sure you indeed found a bug. What happens
> > is that when you ask, it is easier for me to fix and then respond than
> > for me to submit a bug, fix the bug and close the ticket.
>
> > We only have one open bug (or more like a required change in behavior)
> > that I know of, the one about redirection in login. I also have 3
> > pending patches from Hans and Alexey.
>
> > Massimo
>
> > On Jun 9, 11:16 am, Jason Brower  wrote:
> > > Sadly, I agree, but 1 month ago, the choice was made to stick to what we
> > > have now.  I REALLY want that to happen.
> > > Regards,
> > > Jason Brower
>
> > > On Tue, 2009-06-09 at 08:56 -0700, cesmiga wrote:
> > > > All:
>
> > > > I'm not sure if this has been discussed in the past and would like to
> > > > hear more if we should be tracking bugs and enhancement requests at
> > > > Launchpad?
>
> > > >https://launchpad.net/web2py
>
> > > > Wouldn't it make code management and processes more manageable and
> > > > more folks could aid with QA.
>
> > > > Thank you,
> > > > Christopher
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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:23754] html.py failed doctest

2009-06-09 Thread Hans Donner

Got:

**
File "html.py", line 841, in __main__.FORM
Failed example:
form.xml()
Expected:
''
Got:
''
**
1 items had failures:
   1 of   2 in __main__.FORM
***Test Failed*** 1 failures.


assume the expected is wrong?
(if yes, I'll provide a patch including some other updates - if no
then you only get the other updates)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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
-~--~~~~--~~--~--~---



  1   2   >