[web2py] Can't use external internet in my development environment...

2010-11-18 Thread encompass
I see that the latest web2py pulls from ajax.googleapis.com.
This is a bad thing for me as I don't have external internet access.
Can we simply include these libraries?
BR,
Jason Brower


Re: [web2py] ajax push

2010-11-18 Thread Michele Comitini
2010/11/18 Phyo Arkar :
> Very cool framework .
>
> But how web2py gonna work with as it have no serverside support for python ?
>
> We may be have to run 2 servers 1 for web2py and just 1 alone for Pushes ..

Yes and you probably need to build a module if you want interactions
between APE and Web2Py, not only browser to browser...

http://www.ape-project.org/wiki/index.php/How_to_create_a_server_Module


It would be nicer supporting only html5 websockets, using
http://pypi.python.org/pypi/Spawning/  as Web2Py http server...


>
> Anyone have used it in real applications?
>
> On Tue, Nov 16, 2010 at 3:54 AM, Michele Comitini
>  wrote:
>>
>> Does anyone use this with web2py?
>>
>> http://www.ape-project.org/ajax-push.html
>>
>> seems interesting!
>>
>> mic
>
>


[web2py] Re: New style 1.89.X forms seem washed out?

2010-11-18 Thread dederocks
Hi Ron,

I have two web2py running, one on ubunto 10.10, and the other on
windows 7. Both look very similar (buttons appear slightly taller on
ubuntu), and I don't see any of the problems you mentionned: controls
wahsed out, lack of color change for buttons selected, none of this
happens on both versions. I run the source (not trunk) on ubuntu, and
trunk on W7.
At least it's possible to have it run properly...
André

On 18 nov, 08:25, ron_m  wrote:
> I did a fresh download, unpacked, ran the welcome application and hit
> the register button and the form looks the same as my application. I
> don't see a way to attach a screen snapshot in the web interface, I
> guess I need to use the email interface to do that.
>
> Ron
>
> On Nov 17, 10:12 pm, Phyo Arkar  wrote:
>
> > You seem to got CSS messed up.
>
> > On 11/18/10, ron_m  wrote:
>
> > > I don't want to sound unappreciative of the new look for the
> > > application, it is a lot of good work and a definite improvement over
> > > all. Maybe I messed something up, I don't think so, but here is what I
> > > find unusual now.
>
> > > All form controls seem washed out, there are almost no visible borders
> > > on text areas, check boxes are barely visible on the background unless
> > > checked, push buttons are barely visible other than the text on the
> > > button. The control with focus used to have a light green background
> > > but now there is no change in color. In the previous version the
> > > default form input controls had some color.
>
> > > The text input fields are not very tall, in fact select boxes don't
> > > even show the full height of the font. I fixed that by changing the
> > > input text, input password and select height from 16px to 20px in
> > > base.css
>
> > > I can fix this myself but I am wondering if anyone else is also seeing
> > > this.
>
> > > I am running Ubuntu 10.04.1 with Firefox 3.6.12. I have also played
> > > around with the LCD panel brightness and contrast but not much
> > > difference is apparent in the look.
>
> > > Thanks
> > > Ron
>
>


[web2py] Re: New style 1.89.X forms seem washed out?

2010-11-18 Thread villas
Hi Ron

I agree.  The controls in the standard Welcome app are not as visible
as they should be.  The Admin app is much, much better.

I thought it may have been given a washed-out look so that this would
encourage us to make our own styles.  However,  this is no reason why
we cannot have a little more contrast,  especially on the submit
button.

-D

On Nov 18, 7:25 am, ron_m  wrote:
> I did a fresh download, unpacked, ran the welcome application and hit
> the register button and the form looks the same as my application. I
> don't see a way to attach a screen snapshot in the web interface, I
> guess I need to use the email interface to do that.
>
> Ron
>
> On Nov 17, 10:12 pm, Phyo Arkar  wrote:
>
> > You seem to got CSS messed up.
>
> > On 11/18/10, ron_m  wrote:
>
> > > I don't want to sound unappreciative of the new look for the
> > > application, it is a lot of good work and a definite improvement over
> > > all. Maybe I messed something up, I don't think so, but here is what I
> > > find unusual now.
>
> > > All form controls seem washed out, there are almost no visible borders
> > > on text areas, check boxes are barely visible on the background unless
> > > checked, push buttons are barely visible other than the text on the
> > > button. The control with focus used to have a light green background
> > > but now there is no change in color. In the previous version the
> > > default form input controls had some color.
>
> > > The text input fields are not very tall, in fact select boxes don't
> > > even show the full height of the font. I fixed that by changing the
> > > input text, input password and select height from 16px to 20px in
> > > base.css
>
> > > I can fix this myself but I am wondering if anyone else is also seeing
> > > this.
>
> > > I am running Ubuntu 10.04.1 with Firefox 3.6.12. I have also played
> > > around with the LCD panel brightness and contrast but not much
> > > difference is apparent in the look.
>
> > > Thanks
> > > Ron
>
>


[web2py] Re: How do we add projects or post a request for a new job on expert exchange?

2010-11-18 Thread mdipierro
Are you talking about experts4solutions?

Let me clarify. It is NOT a site where people post jobs and we compete
for the lowest bid like some other sites. Quite the opposite. We go
for quality.

It is a place where people who need a job done can see who the
qualified web2py programmers are and the programmers listed may be
expensive. They contact the members directly and discuss price with
them.

Clients may contact experts4solutions directly (i.e. me) and I can
redirect them to the appropriate members.

We will only list open source projects that are completed, as an
example tools we have contributed to develop, not projects developed
for clients. Projects for clients are most likely developed on a
confidential basis.

I know some experts have been contacted already so this is public. I
was hoping this would grow to at least 100 members and I am hoping to
have time to post some sample contracts and legal documents to help
people get started.

Massimo


On Nov 17, 11:28 pm, Jason Brower  wrote:
> I want to start recommending people come to this site for Jobs and
> Projects... is that happening yet?


[web2py] Re: session not saving variables?

2010-11-18 Thread mdipierro
Three possibilities:
- you are storing in session something that is not pickable
- file system permissions error
- browser cookies disabled

On Nov 18, 12:45 am, Crim  wrote:
> so my website was working yesterday and now for some reason the
> session variables arnt saving at certain points
>
> namely when i try this
>
> 
> 
> 
>  size="50" />
>  onchange="document.ex.nav.value =
> document.ex.s.options[document.ex.s.selectedIndex]
> .value;document.ex.s.value=''">
>
> 
>
> {{var =  db.executesql("""SELECT TOP 1000 [ID]
>       ,[Price]
>       ,[Airport-From-Name]
>       ,[Airport-From-State]
>       ,[Airport-From-City]
>       ,[Airport-To-Name]
>       ,[Airport-To-State]
>       ,[Airport-To-City]
>   FROM [master].[dbo].[Flight]
>   WHERE [Airport-From-City] = ? AND [Airport-From-State]= ? AND
> [Airport-From-Name]= ?;""", (a[1], a[2], a[0]), True)
>   }}
> 
> {{for row in var:}}
> {{=row}}{{pass}}
> 
>
> 
>
> 
> 
>
> after i send something to the server the page refreshes and the
> session is cleared
>
> i dont know why this is happening now and it wasnt a day ago
>
> ... it was all working fine xD
>
> thanks a lot for any information ^ ^ ill be up at 7ish to respond but
> i raly have to sleep :( i have been trying to fix this for a while
> now


[web2py] Re: postgresql error ... (relation "auth_user" already exists)

2010-11-18 Thread mdipierro
This is a reasonable error now.

when you change a field type (but not the name) web2py tries to
convert the data. In this case postgres fails because it does not know
how to convert dates to integers.

You have to do it in multiple steps:

- remove the field from define_table
- run appadmin once (field will be dropped)
- add the field again with same name and different type
- run appadmin once (new field will be created)

web2py will not try to attepmt to post the data in the column and it
will be lost, but no error.



On Nov 18, 1:20 am, Johann Spies  wrote:
> On 16 November 2010 21:48, Carlos  wrote:
>
>
>
> > Johann, please send the files when you get this error too.
>
> It happened just now again.  I  have changed the type of a field from 'date'
> to 'integer' (I want None or year) and the following typical error occured:
>
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
>
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "/home/js/web2py/applications/kb/models/kb5.py"
> , line 229,
> in 
>     signature)
>   File "/home/js/web2py/gluon/sql.py", line 1378, in define_table
>     t._create(migrate=migrate, fake_migrate=fake_migrate)
>   File "/home/js/web2py/gluon/sql.py", line 1874, in _create
>     fake_migrate=fake_migrate)
>   File "/home/js/web2py/gluon/sql.py", line 1947, in _migrate
>     self._db._execute(sub_query)
>   File "/home/js/web2py/gluon/sql.py", line 1033, in 
>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> ProgrammingError: column "datum__tmp" is of type integer but
> expression is of type date
> LINE 1: UPDATE outeur_instansie SET datum__tmp=datum;
>                                                ^
> HINT:  You will need to rewrite or cast the expression.
>
>  Error snapshot [image: help] Detailed traceback description
>
> (column "datum__tmp" is of type integer
> but expression is of type date LINE 1: UPDATE outeur_instansie SET
> datum__tmp=datum; ^ HINT: You will need to rewrite or cast the expression. )
> Regards
> Johann
>
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


[web2py] Re: experts4solutions.com again

2010-11-18 Thread mdipierro
No. ;-)

On Nov 17, 9:40 pm, Nathan Freeze  wrote:
> Massimo, your bio is missing a pic. Is it okay to endorse you? :)
>
> On Wed, Nov 17, 2010 at 9:23 PM, mdipierro  wrote:
> > I have implemented an endorsement mechanism. Existing members can see
> > and endorse new applicants. New applications should contact existing
> > members by email and request an endorsement.
> > 5 endorsements qualify for acceptance as an expert. Endorsements can
> > be withdrawn. Endorsements are confidential. I can override this and I
> > will for known web2py contributors.
>
> > You apply by simply logging in into the system.
>
> > I am happy to say that at least 3 members of the group have already
> > been contacted with job offers.
>
> > Please DO NOT ENDORSE users who did not post a decent picture or
> > profile, even if you know they are good web2py programmers.
>
> > If you have already been approved because you are a web2py contributor
> > but you have posted no picture, a scary picture (yes you!), or no
> > profile, please correct it.
>
> > Everybody can register a new affiliated company, a new project and/or
> > a new skill. But they I will have to approve them. I do not want to
> > make the list of skills too long. Projects must be based on web2py,
> > tested and deployed. Companies but say in the web site that they
> > provide web2py support (although not exclusively).
>
> > Massimo
>
>


[web2py] Re: Precise behaviour of "compute" on record update

2010-11-18 Thread mdipierro
true. the text should be fixed.

On Nov 18, 1:46 am, cjrh  wrote:
> Regarding the "compute" attribute of a Field object, the book says
> this:
>
> "compute is an optional function. If a record is inserted and there is
> no value for a field that has a compute attribute, the value is
> calculated by passing the record (as a dict) to the compute function."
>
> My current testing, on 1.89.3, shows that compute will run not only
> when a record is inserted, but indeed every time any other field in
> that same record is updated.   I have a field that is a uuid which is
> only supposed to be calculated once, on insertion.     Also, the
> compute function is passed the current record field values as a dict,
> but that excludes any value the Field with compute() might currently
> have.
>
> In my opinion, the text in the book is misleading.  Thoughts?


Re: [web2py] New style 1.89.X forms seem washed out?

2010-11-18 Thread Martín Mulone
2010/11/18 ron_m 

>
> The text input fields are not very tall, in fact select boxes don't
> even show the full height of the font. I fixed that by changing the
> input text, input password and select height from 16px to 20px in
> base.css
>
> Ron


I think massimo change to 16 px, because originally was in 22px.

Anyways you can always customize it.

Change this in base.css

input[type=submit], input[type=button], button {
margin: 0px;
height: 22px;
background: #eaeaea;
color: #555;
border: 1px solid #dedede;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
}

change background to something like background: #a1a1a1;

-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


Re: [web2py] Re: Upgrade problem

2010-11-18 Thread Kenneth Lundström

What can I do to fix this? What kind of path issue is this?


Kenneth


hmmm. I can make the error go away but this is a path issue

On Nov 17, 3:31 pm, Kenneth Lundström
wrote:

I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.

I m running Linux, Apache and mod_wsgi. Is this too an file permission
problem. I still can t create a new application with admin. Don t know
where to start looking for the problem.

Kenneth

Version
web2py Version 1.89.1 (2010-11-12 15:14:36)
Python Python 2.6.5: /usr/bin/python
Traceback

Traceback (most recent call last):
File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 1146, in
File "/data/domains/web2py/gluon/globals.py", line 96, in
self._caller = lambda f: f()
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 200, in upgrade_web2py
(success, error) = upgrade(request)
File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
file.close()
UnboundLocalError: local variable 'file' referenced before assignment

Error snapshot help Detailed traceback description

(local variable 'file' referenced
before assignment)




[web2py] Re: Please help: Are these errors?

2010-11-18 Thread mdipierro
fixed in trunk

On Nov 18, 1:47 am, Seeker  wrote:
> Hi guys,
> Please help:
>
> Could someone please confirm whether the following two issues are
> indeed errors or if I am simply doing something wrong.  They have both
> been around for a while now and I am surprised that they have not been
> noticed yet - which makes me think I may be causing the problem.
>
> Background:
> ===
> Using Windows 7 operating system
> Python 2.6
> The errors appear in both the trunk and Windows binary editions
>
> Steps for Error 1:
> 
> - Use the application wizard.
> - Create an application with the following database specification.
> Notice that the 'dog' table is related to the 'person' table, BUT the
> tables are specified in the incorrect sequence:
>
> table: dog
> field definition in wizard: name
> field definition in wizard: owner person
>
> table person
> field definition in wizard: name
> field definition in wizard: age integer
>
> - Using the generated application; choose 'dog select' from the menu.
> - An error is generated:
>   File "E:\Dev\w2p\web2py_hg\gluon\sql.py", line 1537, in
> __allocate
>   raise RuntimeError, "Using a recursive select but encountered a
> broken reference"
>   RuntimeError: Using a recursive select but encountered a broken
> reference
>
> Error 2:
> 
> - Use the appadmin for any application 
> (eg:http://127.0.0.1:8000/myapp3/appadmin/index)
> - Click the link to list the content of any table which already
> contains a few records. (eg:http://127.0.0.1:8000/myapp3/appadmin/select/...)
> - Click the 'view' link next to any of the records 
> (eg:http://127.0.0.1:8000/myapp3/appadmin/mytable_read/1)
> - An error results: 'invalid function'
>
> Thanks for helping.


[web2py] Re: list:reference and orderby

2010-11-18 Thread mdipierro
What is your requires statement?

On Nov 18, 1:53 am, Johann Spies  wrote:
> On 17 November 2010 16:48, mdipierro  wrote:
>
> > IS_IN_DB(...,orderby=...)
>
> Thanks.  Now I get
>
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "/home/js/web2py/applications/init/models/kb5.py"
> , line
> 189, in 
>     orderby = 'instansie.naam' )),
>   File "/home/js/web2py/gluon/validators.py", line 368, in __init__
>     (ktable, kfield) = str(self.field).split('.')
> ValueError: need more than 1 value to unpack
>
>  Error snapshot [image: help] Detailed traceback description
>
> (need more than 1 value to unpack)
>
> The model:
>
> db.define_table('instansie_nuwename',
>                 Field('nuutste', db.instansie,
>                       requires = IS_IN_DB(db, 'instansie.id','%(naam)s',
> orderby = 'instansie.naam' )),
>                 Field('vorige', 'list:reference instansie',
>                       requires = IS_IN_DB('instansie.id','%(naam)s',multiple
> = True,
>                                           orderby = 'instansie.naam' )),
>                 Field('jaar', label = 'Tot watter jaar?'),
>                 signature)
> db.instansie_nuwename.nuutste.represent = lambda id: db.instansie(id).naam
>
> Regards
>
> Johann
>
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Branko Vukelic
Things you could do:

1. Use a picture of you looking natural.
2. Write a short biography that tells our clients why they might want
to consider hiring you.
3. Add a link to your previous work so clients can see what you've
done in the past.
4. Add any contact information to make it easier for clients to contact you.

Things you might want to avoid:

1. Do not upload cartoons, copyrighted work, or images that do not
represent you.
2. Do not upload huge images. Even though images are scaled down using
CSS rules, they still take the same amount of time and bandwidth to
reach the clients' browsers. Crop the images to 100x100px for best
results.
3. Do not shorten your bio to statements like "I am a programmer."
(most clients know that we're a group of developers based on
information on the homepage).
4. Show off your markmin skillz
(http://www.web2py.com/examples/static/markmin.html) but don't overdo,
and don't break the page layout.

An example of a good profile page:

http://experts4solutions.com/e4s/default/expert/2

Example of a bad profile page:

http://experts4solutions.com/e4s/default/expert/1 :)



On Thu, Nov 18, 2010 at 1:04 PM, mdipierro  wrote:
> No. ;-)
>
> On Nov 17, 9:40 pm, Nathan Freeze  wrote:
>> Massimo, your bio is missing a pic. Is it okay to endorse you? :)
>>
>> On Wed, Nov 17, 2010 at 9:23 PM, mdipierro  wrote:
>> > I have implemented an endorsement mechanism. Existing members can see
>> > and endorse new applicants. New applications should contact existing
>> > members by email and request an endorsement.
>> > 5 endorsements qualify for acceptance as an expert. Endorsements can
>> > be withdrawn. Endorsements are confidential. I can override this and I
>> > will for known web2py contributors.
>>
>> > You apply by simply logging in into the system.
>>
>> > I am happy to say that at least 3 members of the group have already
>> > been contacted with job offers.
>>
>> > Please DO NOT ENDORSE users who did not post a decent picture or
>> > profile, even if you know they are good web2py programmers.
>>
>> > If you have already been approved because you are a web2py contributor
>> > but you have posted no picture, a scary picture (yes you!), or no
>> > profile, please correct it.
>>
>> > Everybody can register a new affiliated company, a new project and/or
>> > a new skill. But they I will have to approve them. I do not want to
>> > make the list of skills too long. Projects must be based on web2py,
>> > tested and deployed. Companies but say in the web site that they
>> > provide web2py support (although not exclusively).
>>
>> > Massimo
>>
>>



-- 
Branko Vukelić

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

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

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


[web2py] Re: Upgrade problem

2010-11-18 Thread mdipierro
I do not have enough information to debug this. I suggest get 1.89.3
and see if you still have the problem, then I will suggest a test.

Massimo

On Nov 18, 6:06 am, Kenneth Lundström 
wrote:
> What can I do to fix this? What kind of path issue is this?
>
> Kenneth
>
> > hmmm. I can make the error go away but this is a path issue
>
> > On Nov 17, 3:31 pm, Kenneth Lundstr m
> > wrote:
> >> I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
>
> >> I m running Linux, Apache and mod_wsgi. Is this too an file permission
> >> problem. I still can t create a new application with admin. Don t know
> >> where to start looking for the problem.
>
> >> Kenneth
>
> >> Version
> >> web2py Version 1.89.1 (2010-11-12 15:14:36)
> >> Python Python 2.6.5: /usr/bin/python
> >> Traceback
>
> >> Traceback (most recent call last):
> >> File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
> >> exec ccode in environment
> >> File "/data/domains/web2py/applications/admin/controllers/default.py",
> >> line 1146, in
> >> File "/data/domains/web2py/gluon/globals.py", line 96, in
> >> self._caller = lambda f: f()
> >> File "/data/domains/web2py/applications/admin/controllers/default.py",
> >> line 200, in upgrade_web2py
> >> (success, error) = upgrade(request)
> >> File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
> >> file.close()
> >> UnboundLocalError: local variable 'file' referenced before assignment
>
> >> Error snapshot help Detailed traceback description
>
> >> (local variable 'file' referenced
> >> before assignment)
>
>


[web2py] Re: Please help: Are these errors?

2010-11-18 Thread Seeker
Thanks Massimo, but I am up to date on trunk (change set 1223
mercurial), but both the problems still persist.




On Nov 18, 2:06 pm, mdipierro  wrote:
> fixed in trunk
>
> On Nov 18, 1:47 am, Seeker  wrote:
>
>
>
> > Hi guys,
> > Please help:
>
> > Could someone please confirm whether the following two issues are
> > indeed errors or if I am simply doing something wrong.  They have both
> > been around for a while now and I am surprised that they have not been
> > noticed yet - which makes me think I may be causing the problem.
>
> > Background:
> > ===
> > Using Windows 7 operating system
> > Python 2.6
> > The errors appear in both the trunk and Windows binary editions
>
> > Steps for Error 1:
> > 
> > - Use the application wizard.
> > - Create an application with the following database specification.
> > Notice that the 'dog' table is related to the 'person' table, BUT the
> > tables are specified in the incorrect sequence:
>
> > table: dog
> > field definition in wizard: name
> > field definition in wizard: owner person
>
> > table person
> > field definition in wizard: name
> > field definition in wizard: age integer
>
> > - Using the generated application; choose 'dog select' from the menu.
> > - An error is generated:
> >   File "E:\Dev\w2p\web2py_hg\gluon\sql.py", line 1537, in
> > __allocate
> >   raise RuntimeError, "Using a recursive select but encountered a
> > broken reference"
> >   RuntimeError: Using a recursive select but encountered a broken
> > reference
>
> > Error 2:
> > 
> > - Use the appadmin for any application 
> > (eg:http://127.0.0.1:8000/myapp3/appadmin/index)
> > - Click the link to list the content of any table which already
> > contains a few records. 
> > (eg:http://127.0.0.1:8000/myapp3/appadmin/select/...)
> > - Click the 'view' link next to any of the records 
> > (eg:http://127.0.0.1:8000/myapp3/appadmin/mytable_read/1)
> > - An error results: 'invalid function'
>
> > Thanks for helping.- Hide quoted text -
>
> - Show quoted text -


[web2py] Guido on pep8

2010-11-18 Thread mdipierro
http://mail.python.org/pipermail/python-dev/2010-November/105681.html

:-)


Re: [web2py] Re: Upgrade problem

2010-11-18 Thread Kenneth Lundström
The Upgrade problem I can´t test of course but now I manually upgraded 
to 1.89.3 and still have the problem with creating a new application.



Kenneth


I do not have enough information to debug this. I suggest get 1.89.3
and see if you still have the problem, then I will suggest a test.

Massimo

On Nov 18, 6:06 am, Kenneth Lundström
wrote:

What can I do to fix this? What kind of path issue is this?

Kenneth


hmmm. I can make the error go away but this is a path issue
On Nov 17, 3:31 pm, Kenneth Lundstr m
wrote:

I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
I m running Linux, Apache and mod_wsgi. Is this too an file permission
problem. I still can t create a new application with admin. Don t know
where to start looking for the problem.
Kenneth
Version
web2py Version 1.89.1 (2010-11-12 15:14:36)
Python Python 2.6.5: /usr/bin/python
Traceback
Traceback (most recent call last):
File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 1146, in
File "/data/domains/web2py/gluon/globals.py", line 96, in
self._caller = lambda f: f()
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 200, in upgrade_web2py
(success, error) = upgrade(request)
File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
file.close()
UnboundLocalError: local variable 'file' referenced before assignment
Error snapshot help Detailed traceback description
(local variable 'file' referenced
before assignment)






[web2py] Re: Please help: Are these errors?

2010-11-18 Thread mdipierro
I am confused. With the new code in trunk, there should not be a
'view' link in appadmin select.

On Nov 18, 6:20 am, Seeker  wrote:
> Thanks Massimo, but I am up to date on trunk (change set 1223
> mercurial), but both the problems still persist.
>
> On Nov 18, 2:06 pm, mdipierro  wrote:
>
> > fixed in trunk
>
> > On Nov 18, 1:47 am, Seeker  wrote:
>
> > > Hi guys,
> > > Please help:
>
> > > Could someone please confirm whether the following two issues are
> > > indeed errors or if I am simply doing something wrong.  They have both
> > > been around for a while now and I am surprised that they have not been
> > > noticed yet - which makes me think I may be causing the problem.
>
> > > Background:
> > > ===
> > > Using Windows 7 operating system
> > > Python 2.6
> > > The errors appear in both the trunk and Windows binary editions
>
> > > Steps for Error 1:
> > > 
> > > - Use the application wizard.
> > > - Create an application with the following database specification.
> > > Notice that the 'dog' table is related to the 'person' table, BUT the
> > > tables are specified in the incorrect sequence:
>
> > > table: dog
> > > field definition in wizard: name
> > > field definition in wizard: owner person
>
> > > table person
> > > field definition in wizard: name
> > > field definition in wizard: age integer
>
> > > - Using the generated application; choose 'dog select' from the menu.
> > > - An error is generated:
> > >   File "E:\Dev\w2p\web2py_hg\gluon\sql.py", line 1537, in
> > > __allocate
> > >   raise RuntimeError, "Using a recursive select but encountered a
> > > broken reference"
> > >   RuntimeError: Using a recursive select but encountered a broken
> > > reference
>
> > > Error 2:
> > > 
> > > - Use the appadmin for any application 
> > > (eg:http://127.0.0.1:8000/myapp3/appadmin/index)
> > > - Click the link to list the content of any table which already
> > > contains a few records. 
> > > (eg:http://127.0.0.1:8000/myapp3/appadmin/select/...)
> > > - Click the 'view' link next to any of the records 
> > > (eg:http://127.0.0.1:8000/myapp3/appadmin/mytable_read/1)
> > > - An error results: 'invalid function'
>
> > > Thanks for helping.- Hide quoted text -
>
> > - Show quoted text -
>
>


[web2py] Re: Please help: Are these errors?

2010-11-18 Thread mdipierro
My bad. I did not push the change. Please check again in trunk.

On Nov 18, 6:20 am, Seeker  wrote:
> Thanks Massimo, but I am up to date on trunk (change set 1223
> mercurial), but both the problems still persist.
>
> On Nov 18, 2:06 pm, mdipierro  wrote:
>
> > fixed in trunk
>
> > On Nov 18, 1:47 am, Seeker  wrote:
>
> > > Hi guys,
> > > Please help:
>
> > > Could someone please confirm whether the following two issues are
> > > indeed errors or if I am simply doing something wrong.  They have both
> > > been around for a while now and I am surprised that they have not been
> > > noticed yet - which makes me think I may be causing the problem.
>
> > > Background:
> > > ===
> > > Using Windows 7 operating system
> > > Python 2.6
> > > The errors appear in both the trunk and Windows binary editions
>
> > > Steps for Error 1:
> > > 
> > > - Use the application wizard.
> > > - Create an application with the following database specification.
> > > Notice that the 'dog' table is related to the 'person' table, BUT the
> > > tables are specified in the incorrect sequence:
>
> > > table: dog
> > > field definition in wizard: name
> > > field definition in wizard: owner person
>
> > > table person
> > > field definition in wizard: name
> > > field definition in wizard: age integer
>
> > > - Using the generated application; choose 'dog select' from the menu.
> > > - An error is generated:
> > >   File "E:\Dev\w2p\web2py_hg\gluon\sql.py", line 1537, in
> > > __allocate
> > >   raise RuntimeError, "Using a recursive select but encountered a
> > > broken reference"
> > >   RuntimeError: Using a recursive select but encountered a broken
> > > reference
>
> > > Error 2:
> > > 
> > > - Use the appadmin for any application 
> > > (eg:http://127.0.0.1:8000/myapp3/appadmin/index)
> > > - Click the link to list the content of any table which already
> > > contains a few records. 
> > > (eg:http://127.0.0.1:8000/myapp3/appadmin/select/...)
> > > - Click the 'view' link next to any of the records 
> > > (eg:http://127.0.0.1:8000/myapp3/appadmin/mytable_read/1)
> > > - An error results: 'invalid function'
>
> > > Thanks for helping.- Hide quoted text -
>
> > - Show quoted text -
>
>


[web2py] Re: Upgrade problem

2010-11-18 Thread mdipierro
what is you configuration (source/binary, apache/rocket)?

On Nov 18, 6:35 am, Kenneth Lundström 
wrote:
> The Upgrade problem I can t test of course but now I manually upgraded
> to 1.89.3 and still have the problem with creating a new application.
>
> Kenneth
>
> > I do not have enough information to debug this. I suggest get 1.89.3
> > and see if you still have the problem, then I will suggest a test.
>
> > Massimo
>
> > On Nov 18, 6:06 am, Kenneth Lundstr m
> > wrote:
> >> What can I do to fix this? What kind of path issue is this?
>
> >> Kenneth
>
> >>> hmmm. I can make the error go away but this is a path issue
> >>> On Nov 17, 3:31 pm, Kenneth Lundstr m
> >>> wrote:
>  I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
>  I m running Linux, Apache and mod_wsgi. Is this too an file permission
>  problem. I still can t create a new application with admin. Don t know
>  where to start looking for the problem.
>  Kenneth
>  Version
>  web2py Version 1.89.1 (2010-11-12 15:14:36)
>  Python Python 2.6.5: /usr/bin/python
>  Traceback
>  Traceback (most recent call last):
>  File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
>  exec ccode in environment
>  File "/data/domains/web2py/applications/admin/controllers/default.py",
>  line 1146, in
>  File "/data/domains/web2py/gluon/globals.py", line 96, in
>  self._caller = lambda f: f()
>  File "/data/domains/web2py/applications/admin/controllers/default.py",
>  line 200, in upgrade_web2py
>  (success, error) = upgrade(request)
>  File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
>  file.close()
>  UnboundLocalError: local variable 'file' referenced before assignment
>  Error snapshot help Detailed traceback description
>  (local variable 'file' referenced
>  before assignment)
>
>


Re: [web2py] Re: Upgrade problem

2010-11-18 Thread Kenneth Lundström

Apache, mod_wsgi, Linux, MySQL, source


Kenneth


what is you configuration (source/binary, apache/rocket)?

On Nov 18, 6:35 am, Kenneth Lundström
wrote:

The Upgrade problem I can t test of course but now I manually upgraded
to 1.89.3 and still have the problem with creating a new application.

Kenneth


I do not have enough information to debug this. I suggest get 1.89.3
and see if you still have the problem, then I will suggest a test.
Massimo
On Nov 18, 6:06 am, Kenneth Lundstr m
wrote:

What can I do to fix this? What kind of path issue is this?
Kenneth

hmmm. I can make the error go away but this is a path issue
On Nov 17, 3:31 pm, Kenneth Lundstr m
wrote:

I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
I m running Linux, Apache and mod_wsgi. Is this too an file permission
problem. I still can t create a new application with admin. Don t know
where to start looking for the problem.
Kenneth
Version
web2py Version 1.89.1 (2010-11-12 15:14:36)
Python Python 2.6.5: /usr/bin/python
Traceback
Traceback (most recent call last):
File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 1146, in
File "/data/domains/web2py/gluon/globals.py", line 96, in
self._caller = lambda f: f()
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 200, in upgrade_web2py
(success, error) = upgrade(request)
File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
file.close()
UnboundLocalError: local variable 'file' referenced before assignment
Error snapshot help Detailed traceback description
(local variable 'file' referenced
before assignment)






Re: [web2py] Guido on pep8

2010-11-18 Thread Bruno Rocha
+1 :)  // Shutting the mouth of the purist pythonistas who criticized web2py
API

2010/11/18 mdipierro 

> http://mail.python.org/pipermail/python-dev/2010-November/105681.html
>
> :-)




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Customize the Appearance of the menu

2010-11-18 Thread Martín Mulone
In the last version of web2py you can pass A() helper instead of URL, so you
can customize as you want. View the new welcome.

For example, this change menu if there log in:

models/menu.py

if is_user_logged_in():
response.menu += [
(T('My account'), False, A(T('My account'),_href='javascript:
void(0);'), [
 (T('Upload'), False, A(T('Upload'),_title=T("Upload your
application"),_href=URL(request.application,'default','upload'))),
 (T('Profile'), False,
URL(request.application,'default','user/profile')),
 (T('Logout'), False,
URL(request.application,'default','user/logout')),
   ])
]
else:
response.menu += [
(T('Login to upload'), False,
URL(request.application,'default','user/login'), [])
]



2010/11/18 Joe J 

> Hi all, I'm looking to customize the appearance if the menu on a per
> controller basis.  I found some code in the "old" book that seems to
> do this.
> However, when I try to run the below code, I get a "two many values to
> unpack error".  Does anyone know who I might go about doing this?
>
> Any help is much appreciated.
> Thanks,
> Joe
>
> In the controller, I have code as follows:
>response.menu=[['civilized',True,URL('default','index')],
>   ['test',False,URL('default','index')]]
>
>
> In my View, I'm coding the following:
>   {{if not response.menu:}}
>Browse strong>
>Signup
>   {{else:}}
> {{for _name,_active,_link in response.menu:}}
>   {{=_name}}
> {{pass}}
>   {{pass}}
>
>
>
>
> Traceback (most recent call last):
>  File "/Users/jjasinsk/Sites/web2py/web2py/gluon/restricted.py", line
> 188, in restricted
>exec ccode in environment
>  File "/Users/jjasinsk/Sites/web2py/web2py/applications/evesch/views/
> default/index.html", line 38, in 
> ValueError: too many values to unpack
>



-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


[web2py] Losing sessions

2010-11-18 Thread Bruno Rocha
Is there someone else having problems to keep sessions in 1.89.3 + apache
mod_wsgi ??

My app is creating a new session on every new request.

(I am runnnig survey cloud applicance, with few changes)

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Upgrade problem

2010-11-18 Thread mdipierro
I see the problem but I do not understand why you have it. This should
manifest itself when you upgrade, not when you create a new app. Can
you list steps to reproduce the problem?

I am close to fixing it...

On Nov 17, 3:31 pm, Kenneth Lundström 
wrote:
> I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
>
> I m running Linux, Apache and mod_wsgi. Is this too an file permission
> problem. I still can t create a new application with admin. Don t know
> where to start looking for the problem.
>
> Kenneth
>
> Version
> web2py Version 1.89.1 (2010-11-12 15:14:36)
> Python Python 2.6.5: /usr/bin/python
> Traceback
>
> Traceback (most recent call last):
> File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
> exec ccode in environment
> File "/data/domains/web2py/applications/admin/controllers/default.py",
> line 1146, in 
> File "/data/domains/web2py/gluon/globals.py", line 96, in 
> self._caller = lambda f: f()
> File "/data/domains/web2py/applications/admin/controllers/default.py",
> line 200, in upgrade_web2py
> (success, error) = upgrade(request)
> File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
> file.close()
> UnboundLocalError: local variable 'file' referenced before assignment
>
> Error snapshot help Detailed traceback description
>
> (local variable 'file' referenced
> before assignment)


[web2py] Re: Losing sessions

2010-11-18 Thread mdipierro
This

http://web2py.com/examples/session_examples/counter

runs on 1.89.3 and apache+mod_wsgi

On Nov 18, 6:57 am, Bruno Rocha  wrote:
> Is there someone else having problems to keep sessions in 1.89.3 + apache
> mod_wsgi ??
>
> My app is creating a new session on every new request.
>
> (I am runnnig survey cloud applicance, with few changes)
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Precise behaviour of "compute" on record update

2010-11-18 Thread cjrh
"I have a field that is a uuid which is
only supposed to be calculated once, on insertion."

Best way to do this currently?  I would use "default" if within the
context of a controller, but these are records I create manually in
admin.  There is a field that I want populated with a newly-calculated
uuid, but only on insertion of a new record, and it must not be
recalculated again.


[web2py] Re: Customize the Appearance of the menu

2010-11-18 Thread annet
Hi Joe,

The code in the view works:


  {{if not response.menu:}}
Browse
Sign up
  {{else:}}
{{for _name,_active,_link in response.menu:}}
  
{{=_name}}
  
{{pass}}
  {{pass}}



However, when trying to reproduce the problem I noticed the following:
given this menu:

response.menu=[
['Index',request.function=='index',URL(r=request,f='index')],
['Mock_a',request.function=='mock_a',URL(r=request,f='mock_a')],
['Mock_b',request.function=='mock_b',URL(r=request,f='mock_b')]]

there's no problem, however, when I remove response.menu, and expose a
function, I get the ValueError you got. Now when I set
response.menu=[], and expose the function, the view is displayed as
expected.

I can't account for this behaviour but I hope this observation will
help you solve the problem.


Kind regards,

Annet.


Re: [web2py] Re: Upgrade problem

2010-11-18 Thread Kenneth Lundström

- unpacked the source package
- did a chown apache:web2py on all files
- login in to admin
- write the name of the new application and press create
- get the unable to create application "test"

Upgrade problem, the same, but
- select upgrade
- press YES
- get the error ticket

I don´t know what else to write.


Kenneth


I see the problem but I do not understand why you have it. This should
manifest itself when you upgrade, not when you create a new app. Can
you list steps to reproduce the problem?

I am close to fixing it...

On Nov 17, 3:31 pm, Kenneth Lundström
wrote:

I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.

I m running Linux, Apache and mod_wsgi. Is this too an file permission
problem. I still can t create a new application with admin. Don t know
where to start looking for the problem.

Kenneth

Version
web2py Version 1.89.1 (2010-11-12 15:14:36)
Python Python 2.6.5: /usr/bin/python
Traceback

Traceback (most recent call last):
File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 1146, in
File "/data/domains/web2py/gluon/globals.py", line 96, in
self._caller = lambda f: f()
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 200, in upgrade_web2py
(success, error) = upgrade(request)
File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
file.close()
UnboundLocalError: local variable 'file' referenced before assignment

Error snapshot help Detailed traceback description

(local variable 'file' referenced
before assignment)




Re: [web2py] Re: Losing sessions

2010-11-18 Thread Bruno Rocha
That is running here locally too. (
http://192.168.0.7/examples/session_examples/counter)

I think the problem is in SurveyCloud app or in some change that I've made
on that.
that was working tomorrow, I made no changes and now it is killing sessions.

I will change the answer.sa record by the request.client instead of
response.session_id and solve the problem later.

Thank you.



2010/11/18 mdipierro 

> This
>
> http://web2py.com/examples/session_examples/counter
>
> runs on 1.89.3 and apache+mod_wsgi
>
> On Nov 18, 6:57 am, Bruno Rocha  wrote:
> > Is there someone else having problems to keep sessions in 1.89.3 + apache
> > mod_wsgi ??
> >
> > My app is creating a new session on every new request.
> >
> > (I am runnnig survey cloud applicance, with few changes)
> >
> > --
> >
> > Bruno Rochahttp://about.me/rochacbruno/bio
>



-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Re: Losing sessions

2010-11-18 Thread Bruno Rocha
replace('tomorrow','yesterday')

2010/11/18 Bruno Rocha 

> That is running here locally too. (
> http://192.168.0.7/examples/session_examples/counter)
>
> I think the problem is in SurveyCloud app or in some change that I've made
> on that.
> that was working tomorrow, I made no changes and now it is killing
> sessions.
>
> I will change the answer.sa record by the request.client instead of
> response.session_id and solve the problem later.
>
> Thank you.
>
>
>
> 2010/11/18 mdipierro 
>
> This
>>
>> http://web2py.com/examples/session_examples/counter
>>
>> runs on 1.89.3 and apache+mod_wsgi
>>
>> On Nov 18, 6:57 am, Bruno Rocha  wrote:
>> > Is there someone else having problems to keep sessions in 1.89.3 +
>> apache
>> > mod_wsgi ??
>> >
>> > My app is creating a new session on every new request.
>> >
>> > (I am runnnig survey cloud applicance, with few changes)
>> >
>> > --
>> >
>> > Bruno Rochahttp://about.me/rochacbruno/bio
>>
>
>
>
> --
>
> Bruno Rocha
> http://about.me/rochacbruno/bio
>



-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: session not saving variables?

2010-11-18 Thread Crim
Suppose i am storing something that is not pickable why would it clear
all my other values at the same time too


On Nov 18, 6:00 am, mdipierro  wrote:
> Three possibilities:
> - you are storing in session something that is not pickable
> - file system permissions error
> - browser cookies disabled
>
> On Nov 18, 12:45 am, Crim  wrote:
>
>
>
>
>
>
>
> > so my website was working yesterday and now for some reason the
> > session variables arnt saving at certain points
>
> > namely when i try this
>
> > 
> > 
> > 
> >  > size="50" />
> >  > onchange="document.ex.nav.value =
> > document.ex.s.options[document.ex.s.selectedIndex]
> > .value;document.ex.s.value=''">
>
> > 
>
> > {{var =  db.executesql("""SELECT TOP 1000 [ID]
> >       ,[Price]
> >       ,[Airport-From-Name]
> >       ,[Airport-From-State]
> >       ,[Airport-From-City]
> >       ,[Airport-To-Name]
> >       ,[Airport-To-State]
> >       ,[Airport-To-City]
> >   FROM [master].[dbo].[Flight]
> >   WHERE [Airport-From-City] = ? AND [Airport-From-State]= ? AND
> > [Airport-From-Name]= ?;""", (a[1], a[2], a[0]), True)
> >   }}
> > 
> > {{for row in var:}}
> > {{=row}}{{pass}}
> > 
>
> > 
>
> > 
> > 
>
> > after i send something to the server the page refreshes and the
> > session is cleared
>
> > i dont know why this is happening now and it wasnt a day ago
>
> > ... it was all working fine xD
>
> > thanks a lot for any information ^ ^ ill be up at 7ish to respond but
> > i raly have to sleep :( i have been trying to fix this for a while
> > now


Re: [web2py] session not saving variables?

2010-11-18 Thread Bruno Rocha
Same problem here.

Yesterday that was working well, today the sessions are being created in
every request.

I am watching the app/sessions folder ( one new file per second )

File system permissions not changed

2010/11/18 Crim 

> so my website was working yesterday and now for some reason the
> session variables arnt saving at certain points
>
> namely when i try this
>
> 
> 
> 
>  size="50" />
>  onchange="document.ex.nav.value =
> document.ex.s.options[document.ex.s.selectedIndex]
> .value;document.ex.s.value=''">
>
> 
>
> {{var =  db.executesql("""SELECT TOP 1000 [ID]
>  ,[Price]
>  ,[Airport-From-Name]
>  ,[Airport-From-State]
>  ,[Airport-From-City]
>  ,[Airport-To-Name]
>  ,[Airport-To-State]
>  ,[Airport-To-City]
>  FROM [master].[dbo].[Flight]
>  WHERE [Airport-From-City] = ? AND [Airport-From-State]= ? AND
> [Airport-From-Name]= ?;""", (a[1], a[2], a[0]), True)
>  }}
> 
> {{for row in var:}}
> {{=row}}{{pass}}
> 
>
> 
>
> 
> 
>
> after i send something to the server the page refreshes and the
> session is cleared
>
> i dont know why this is happening now and it wasnt a day ago
>
> ... it was all working fine xD
>
> thanks a lot for any information ^ ^ ill be up at 7ish to respond but
> i raly have to sleep :( i have been trying to fix this for a while
> now




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Please help: Are these errors?

2010-11-18 Thread Seeker
:-) Thanks.  will do.

On Nov 18, 2:45 pm, mdipierro  wrote:
> My bad. I did not push the change. Please check again in trunk.
>
> On Nov 18, 6:20 am, Seeker  wrote:
>
>
>
> > Thanks Massimo, but I am up to date on trunk (change set 1223
> > mercurial), but both the problems still persist.
>
> > On Nov 18, 2:06 pm, mdipierro  wrote:
>
> > > fixed in trunk
>
> > > On Nov 18, 1:47 am, Seeker  wrote:
>
> > > > Hi guys,
> > > > Please help:
>
> > > > Could someone please confirm whether the following two issues are
> > > > indeed errors or if I am simply doing something wrong.  They have both
> > > > been around for a while now and I am surprised that they have not been
> > > > noticed yet - which makes me think I may be causing the problem.
>
> > > > Background:
> > > > ===
> > > > Using Windows 7 operating system
> > > > Python 2.6
> > > > The errors appear in both the trunk and Windows binary editions
>
> > > > Steps for Error 1:
> > > > 
> > > > - Use the application wizard.
> > > > - Create an application with the following database specification.
> > > > Notice that the 'dog' table is related to the 'person' table, BUT the
> > > > tables are specified in the incorrect sequence:
>
> > > > table: dog
> > > > field definition in wizard: name
> > > > field definition in wizard: owner person
>
> > > > table person
> > > > field definition in wizard: name
> > > > field definition in wizard: age integer
>
> > > > - Using the generated application; choose 'dog select' from the menu.
> > > > - An error is generated:
> > > >   File "E:\Dev\w2p\web2py_hg\gluon\sql.py", line 1537, in
> > > > __allocate
> > > >   raise RuntimeError, "Using a recursive select but encountered a
> > > > broken reference"
> > > >   RuntimeError: Using a recursive select but encountered a broken
> > > > reference
>
> > > > Error 2:
> > > > 
> > > > - Use the appadmin for any application 
> > > > (eg:http://127.0.0.1:8000/myapp3/appadmin/index)
> > > > - Click the link to list the content of any table which already
> > > > contains a few records. 
> > > > (eg:http://127.0.0.1:8000/myapp3/appadmin/select/...)
> > > > - Click the 'view' link next to any of the records 
> > > > (eg:http://127.0.0.1:8000/myapp3/appadmin/mytable_read/1)
> > > > - An error results: 'invalid function'
>
> > > > Thanks for helping.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: Precise behaviour of "compute" on record update

2010-11-18 Thread mdipierro
>>> db=DAL()
>>> db.define_table('xxx',Field('yyy',writable=False,readable=False))
>>> db.xxx.yyy.default=lambda: 'hello world'
>>> db.xxx.insert()
1
>>> print db.xxx(1).yyy
hello world

default can be a lambda.


On Nov 18, 7:05 am, cjrh  wrote:
> "I have a field that is a uuid which is
> only supposed to be calculated once, on insertion."
>
> Best way to do this currently?  I would use "default" if within the
> context of a controller, but these are records I create manually in
> admin.  There is a field that I want populated with a newly-calculated
> uuid, but only on insertion of a new record, and it must not be
> recalculated again.


[web2py] Re: Upgrade problem

2010-11-18 Thread mdipierro
Thanks Kenneth,

the traceback you posted applies to the second problem and I
understand that. I am scratching my head on why that traceback would
also apply to the first problem.

Massimo

On Nov 18, 7:09 am, Kenneth Lundström 
wrote:
> - unpacked the source package
> - did a chown apache:web2py on all files
> - login in to admin
> - write the name of the new application and press create
> - get the unable to create application "test"
>
> Upgrade problem, the same, but
> - select upgrade
> - press YES
> - get the error ticket
>
> I don t know what else to write.
>
> Kenneth
>
> > I see the problem but I do not understand why you have it. This should
> > manifest itself when you upgrade, not when you create a new app. Can
> > you list steps to reproduce the problem?
>
> > I am close to fixing it...
>
> > On Nov 17, 3:31 pm, Kenneth Lundstr m
> > wrote:
> >> I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
>
> >> I m running Linux, Apache and mod_wsgi. Is this too an file permission
> >> problem. I still can t create a new application with admin. Don t know
> >> where to start looking for the problem.
>
> >> Kenneth
>
> >> Version
> >> web2py Version 1.89.1 (2010-11-12 15:14:36)
> >> Python Python 2.6.5: /usr/bin/python
> >> Traceback
>
> >> Traceback (most recent call last):
> >> File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
> >> exec ccode in environment
> >> File "/data/domains/web2py/applications/admin/controllers/default.py",
> >> line 1146, in
> >> File "/data/domains/web2py/gluon/globals.py", line 96, in
> >> self._caller = lambda f: f()
> >> File "/data/domains/web2py/applications/admin/controllers/default.py",
> >> line 200, in upgrade_web2py
> >> (success, error) = upgrade(request)
> >> File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
> >> file.close()
> >> UnboundLocalError: local variable 'file' referenced before assignment
>
> >> Error snapshot help Detailed traceback description
>
> >> (local variable 'file' referenced
> >> before assignment)
>
>


Re: [web2py] bug in the book or in the code? linkedin instruction

2010-11-18 Thread Kuba Kucharski
one more thing, w/o registration process I cannot do:
auth.settings.register_onaccept=lambda
form:auth.add_permission(auth.user_group(form.vars.id),'create','my_table')

how to handle it then? I tried to search for the place in the code
where the group for the user is created but I cannot find it easily

-- 
Kuba


[web2py] Standalone DAL - connection to sqlite db - running web2py

2010-11-18 Thread Ole Martin Maeland
Hi,

I am trying to connect to sqlite db that works fine with a small web2py
applicaiton.


connection parameters:

>>> dbfolder='C:\web2py\web2py\applications\teqb\databases'

>>> db = dal.DAL('sqlite://storage', folder=dbfolder)

error message:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\site-packages\gluon\dal.py", line 2031, in __init__
self._logger = Logger(folder)
  File "C:\Python27\lib\site-packages\gluon\dal.py", line 140, in __init__
self.file = open(os.path.join(folder,name),'a')
IOError: [Errno 22] invalid mode ('a') or filename:
'C:\\web2py\\web2py\x07pplications\teqb\\databases\\sql.log'

any ide how I could get this to work?

regards
Martin


[web2py] Re: Standalone DAL - connection to sqlite db - running web2py

2010-11-18 Thread mdipierro
I think you do not have write access on this file/folder

On Nov 18, 7:36 am, Ole Martin Maeland  wrote:
> Hi,
>
> I am trying to connect to sqlite db that works fine with a small web2py
> applicaiton.
>
> connection parameters:
>
> >>> dbfolder='C:\web2py\web2py\applications\teqb\databases'
> >>> db = dal.DAL('sqlite://storage', folder=dbfolder)
>
> error message:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Python27\lib\site-packages\gluon\dal.py", line 2031, in __init__
>     self._logger = Logger(folder)
>   File "C:\Python27\lib\site-packages\gluon\dal.py", line 140, in __init__
>     self.file = open(os.path.join(folder,name),'a')
> IOError: [Errno 22] invalid mode ('a') or filename:
> 'C:\\web2py\\web2py\x07pplications\teqb\\databases\\sql.log'
>
> any ide how I could get this to work?
>
> regards
> Martin


Re: [web2py] experts4solutions.com again

2010-11-18 Thread Bruno Rocha
Endorsement has only 'no' option?

You endorse: no  (your
your/no endorsement is confidential)

Where can I endorse someone?

2010/11/18 mdipierro 

> I have implemented an endorsement mechanism. Existing members can see
> and endorse new applicants. New applications should contact existing
> members by email and request an endorsement.
> 5 endorsements qualify for acceptance as an expert. Endorsements can
> be withdrawn. Endorsements are confidential. I can override this and I
> will for known web2py contributors.
>
> You apply by simply logging in into the system.
>
> I am happy to say that at least 3 members of the group have already
> been contacted with job offers.
>
> Please DO NOT ENDORSE users who did not post a decent picture or
> profile, even if you know they are good web2py programmers.
>
> If you have already been approved because you are a web2py contributor
> but you have posted no picture, a scary picture (yes you!), or no
> profile, please correct it.
>
> Everybody can register a new affiliated company, a new project and/or
> a new skill. But they I will have to approve them. I do not want to
> make the list of skills too long. Projects must be based on web2py,
> tested and deployed. Companies but say in the web site that they
> provide web2py support (although not exclusively).
>
> Massimo




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] experts4solutions.com again

2010-11-18 Thread Bruno Rocha
humm, I just figure out that I have to click in 'no' to toggle it to yes!

not so clear.

2010/11/18 Bruno Rocha 

> Endorsement has only 'no' option?
>
> You endorse: no  (your
> your/no endorsement is confidential)
>
> Where can I endorse someone?
>
> 2010/11/18 mdipierro 
>
> I have implemented an endorsement mechanism. Existing members can see
>> and endorse new applicants. New applications should contact existing
>> members by email and request an endorsement.
>> 5 endorsements qualify for acceptance as an expert. Endorsements can
>> be withdrawn. Endorsements are confidential. I can override this and I
>> will for known web2py contributors.
>>
>> You apply by simply logging in into the system.
>>
>> I am happy to say that at least 3 members of the group have already
>> been contacted with job offers.
>>
>> Please DO NOT ENDORSE users who did not post a decent picture or
>> profile, even if you know they are good web2py programmers.
>>
>> If you have already been approved because you are a web2py contributor
>> but you have posted no picture, a scary picture (yes you!), or no
>> profile, please correct it.
>>
>> Everybody can register a new affiliated company, a new project and/or
>> a new skill. But they I will have to approve them. I do not want to
>> make the list of skills too long. Projects must be based on web2py,
>> tested and deployed. Companies but say in the web site that they
>> provide web2py support (although not exclusively).
>>
>> Massimo
>
>
>
>
> --
>
> Bruno Rocha
> http://about.me/rochacbruno/bio
>



-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] VirtualField Issues

2010-11-18 Thread VijayS
Hello,

 I am new to web2py, and this group. I was conversing on IRC and it
was suggested by dingding1 that I should post this here.

I think there's a bug with virtualfields. It seems that if I try to
use a select() statement with only one field name, then virtualfields
will fail to work as it cannot find the other dependent fields it
needs to calculate the desired output.

So if this is desired behavior, it is not mentioned in the book (3rd
ed), and it seems to be counter intuitve as it seems like the
virtualclass should have access to all elements regardless of the
select query being run on it.

see following example code http://pastie.textmate.org/1308330

class MyVirtualFields(object):
def production_total(self):
return
self.production.production_shift_1+self.production.production_shift_2+self.production.production_shift_3
def production_net(self):
return
self.production.production_shift_1+self.production.production_shift_2+self.production.production_shift_3-
self.production.production_rejection
def lid_total(self):
return
self.production.lid_shift_1+self.production.lid_shift_2+self.production.lid_shift_3
#NOTE virtual fields cause a problem with SELCT() statements. In the
select statement if you don't include the required fields for the
calculation, it will give an error! This is a bug!
#crashes on the following query
#rows = db(db.production.date_id ==
date.today()).select(db.production.delivered)
#if i comment our the select criteria as shown below, then it works
fine
#rows = db(db.production.date_id ==
date.today()).select()#db.production.delivered)
db.production.virtualfields.append(MyVirtualFields())

is this a valid, or just flawed understanding on my part?
maybe it makes sense to not have virtualfields access to all fields,
because that would mean fetching all data from server all the time,
thereby slowing down.
but then it should allow a switch for disabling it's evaluation or
something so that when running code that doesn't require the
virtualfield then it can skip the evaluation.

Thank you for your patience.

Vijay


Re: [web2py] Re: Standalone DAL - connection to sqlite db - running web2py

2010-11-18 Thread Ole Martin Maeland
Hi Massimo,


I have administrator access on the folder. The database is running a small
web2py application that is crypted. Do I have to pass the crypt string to
the db, or do I have to use administrator password in order to access it.

I reach it by using SQLite Manager..


regards
Martin



On Thu, Nov 18, 2010 at 3:06 PM, mdipierro  wrote:

> I think you do not have write access on this file/folder
>
> On Nov 18, 7:36 am, Ole Martin Maeland  wrote:
> > Hi,
> >
> > I am trying to connect to sqlite db that works fine with a small web2py
> > applicaiton.
> >
> > connection parameters:
> >
> > >>> dbfolder='C:\web2py\web2py\applications\teqb\databases'
> > >>> db = dal.DAL('sqlite://storage', folder=dbfolder)
> >
> > error message:
> >
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "C:\Python27\lib\site-packages\gluon\dal.py", line 2031, in
> __init__
> > self._logger = Logger(folder)
> >   File "C:\Python27\lib\site-packages\gluon\dal.py", line 140, in
> __init__
> > self.file = open(os.path.join(folder,name),'a')
> > IOError: [Errno 22] invalid mode ('a') or filename:
> > 'C:\\web2py\\web2py\x07pplications\teqb\\databases\\sql.log'
> >
> > any ide how I could get this to work?
> >
> > regards
> > Martin
>



-- 
Hilsen
Ole Martin
Mob: 95227471


[web2py] Re: PostgreSQL super slowdowns

2010-11-18 Thread Chris
I added your limitby code to some places.
I haven't seen the same slowdowns recently, though, so it's hard to
tell what happened - maybe it's from a fresh install of postgresql?
We'll see if it comes back.

On Nov 1, 11:01 pm, KMax  wrote:
> Please check .first() or .last() usage.
> With Postgres for some reason, all data are transfered to DAL, and on
> w2p side first or last recored selected.
>
> Solution also are easy use:
> .select(limitby=(0,1)).first()
> or
> select(limitby=(0,1),orderby=~db.papers.id).first()
> or
> .select(limitby=(0,1),orderby=db.papers.id).first().
>
> orderby=~ and orderby= will give you last or first for .first()
> and .last() - since only one record are returned from db.
>
> Hope I score.
>
> On 29 ÏËÔ, 12:53, Chris  wrote:
>
>
>
>
>
>
>
> > Hey,
>
> > I've noticed some serious slowdowns ever since I switched from SQLite
> > to Postgres. Pages will take MINUTES to load - it's kind of
> > fascinating.
>
> > I don't have the full explanation for what's going on yet but I do
> > have some clues. I've noticed it happens locally, and in a specific
> > way:
>
> > 1) I load the page up in one browser and it loads and reloads fine.
> > 2) When I open the page up in another browser or in an incognito
> > session on the same machine, the page request hangs, usually for
> > longer than two minutes.
>
> > I don't know for sure that it's Postgres related, but I don't remember
> > seeing this on SQLite.
>
> > This is something I really need to fix! Can anyone reproduce this? Are
> > there profilers or particular places in the code I can tag?
>
> > Thanks! - Chris


Re: [web2py] Re: Upgrade problem

2010-11-18 Thread Kenneth Lundström

OK, I have no idea if they are related, it was just a thought on my part.


Kenneth


Thanks Kenneth,

the traceback you posted applies to the second problem and I
understand that. I am scratching my head on why that traceback would
also apply to the first problem.

Massimo

On Nov 18, 7:09 am, Kenneth Lundström
wrote:

- unpacked the source package
- did a chown apache:web2py on all files
- login in to admin
- write the name of the new application and press create
- get the unable to create application "test"

Upgrade problem, the same, but
- select upgrade
- press YES
- get the error ticket

I don t know what else to write.

Kenneth


I see the problem but I do not understand why you have it. This should
manifest itself when you upgrade, not when you create a new app. Can
you list steps to reproduce the problem?
I am close to fixing it...
On Nov 17, 3:31 pm, Kenneth Lundstr m
wrote:

I tried to upgrade version 1.89.1 to 1.89.3. I got the following error.
I m running Linux, Apache and mod_wsgi. Is this too an file permission
problem. I still can t create a new application with admin. Don t know
where to start looking for the problem.
Kenneth
Version
web2py Version 1.89.1 (2010-11-12 15:14:36)
Python Python 2.6.5: /usr/bin/python
Traceback
Traceback (most recent call last):
File "/data/domains/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 1146, in
File "/data/domains/web2py/gluon/globals.py", line 96, in
self._caller = lambda f: f()
File "/data/domains/web2py/applications/admin/controllers/default.py",
line 200, in upgrade_web2py
(success, error) = upgrade(request)
File "/data/domains/web2py/gluon/admin.py", line 427, in upgrade
file.close()
UnboundLocalError: local variable 'file' referenced before assignment
Error snapshot help Detailed traceback description
(local variable 'file' referenced
before assignment)






[web2py] Re: experts4solutions.com again

2010-11-18 Thread selecta
A bit off topic question -
I am currently happily employed and developing web2py based open
source applications, but when this changes I might want to have a foot
in the door for finding a job hacking web2py apps.
Should i register at experts4solutions and state that I am currently
not interested in jobs or should I register when I really have the
need for it?

On Nov 18, 3:34 pm, Bruno Rocha  wrote:
> humm, I just figure out that I have to click in 'no' to toggle it to yes!
>
> not so clear.
>
> 2010/11/18 Bruno Rocha 
>
>
>
>
>
> > Endorsement has only 'no' option?
>
> > You endorse: no  (your
> > your/no endorsement is confidential)
>
> > Where can I endorse someone?
>
> > 2010/11/18 mdipierro 
>
> > I have implemented an endorsement mechanism. Existing members can see
> >> and endorse new applicants. New applications should contact existing
> >> members by email and request an endorsement.
> >> 5 endorsements qualify for acceptance as an expert. Endorsements can
> >> be withdrawn. Endorsements are confidential. I can override this and I
> >> will for known web2py contributors.
>
> >> You apply by simply logging in into the system.
>
> >> I am happy to say that at least 3 members of the group have already
> >> been contacted with job offers.
>
> >> Please DO NOT ENDORSE users who did not post a decent picture or
> >> profile, even if you know they are good web2py programmers.
>
> >> If you have already been approved because you are a web2py contributor
> >> but you have posted no picture, a scary picture (yes you!), or no
> >> profile, please correct it.
>
> >> Everybody can register a new affiliated company, a new project and/or
> >> a new skill. But they I will have to approve them. I do not want to
> >> make the list of skills too long. Projects must be based on web2py,
> >> tested and deployed. Companies but say in the web site that they
> >> provide web2py support (although not exclusively).
>
> >> Massimo
>
> > --
>
> > Bruno Rocha
> >http://about.me/rochacbruno/bio
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: social network, event planners, and the like?

2010-11-18 Thread selecta
some parts are implemented (plugin based) in the project that I will
submit in the application exhibition 2.0 ...

On Nov 17, 8:42 pm, mdipierro  wrote:
> Not exactly but this is a good place to start:
>
> http://web2py.com/appliances/default/show/71
>
> On Nov 17, 12:59 pm, Carlos  wrote:
>
>
>
> > Hi,
>
> > In a future project I might need capabilities like social network,
> > event planners (e.g. weddings, parties), and the like.
>
> > I'm wondering if there's something already out there - preferably free
> > open source, and obviously developed with web2py?, or at least in
> > python?.
>
> > If there's nothing, is it recommended to start from scratch with
> > web2py, or interface to external systems (e.g. elgg.org) from web2py?.
>
> > If external systems, customizations will likely be required.
>
> > Any help / advice on this matter is greatly appreciated - thanks!,
>
> >    Carlos


Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Jason Brower
That would be up to you.  I know I have registered.

On Thu, 2010-11-18 at 07:10 -0800, selecta wrote:

> A bit off topic question -
> I am currently happily employed and developing web2py based open
> source applications, but when this changes I might want to have a foot
> in the door for finding a job hacking web2py apps.
> Should i register at experts4solutions and state that I am currently
> not interested in jobs or should I register when I really have the
> need for it?
> 
> On Nov 18, 3:34 pm, Bruno Rocha  wrote:
> > humm, I just figure out that I have to click in 'no' to toggle it to yes!
> >
> > not so clear.
> >
> > 2010/11/18 Bruno Rocha 
> >
> >
> >
> >
> >
> > > Endorsement has only 'no' option?
> >
> > > You endorse: no  (your
> > > your/no endorsement is confidential)
> >
> > > Where can I endorse someone?
> >
> > > 2010/11/18 mdipierro 
> >
> > > I have implemented an endorsement mechanism. Existing members can see
> > >> and endorse new applicants. New applications should contact existing
> > >> members by email and request an endorsement.
> > >> 5 endorsements qualify for acceptance as an expert. Endorsements can
> > >> be withdrawn. Endorsements are confidential. I can override this and I
> > >> will for known web2py contributors.
> >
> > >> You apply by simply logging in into the system.
> >
> > >> I am happy to say that at least 3 members of the group have already
> > >> been contacted with job offers.
> >
> > >> Please DO NOT ENDORSE users who did not post a decent picture or
> > >> profile, even if you know they are good web2py programmers.
> >
> > >> If you have already been approved because you are a web2py contributor
> > >> but you have posted no picture, a scary picture (yes you!), or no
> > >> profile, please correct it.
> >
> > >> Everybody can register a new affiliated company, a new project and/or
> > >> a new skill. But they I will have to approve them. I do not want to
> > >> make the list of skills too long. Projects must be based on web2py,
> > >> tested and deployed. Companies but say in the web site that they
> > >> provide web2py support (although not exclusively).
> >
> > >> Massimo
> >
> > > --
> >
> > > Bruno Rocha
> > >http://about.me/rochacbruno/bio
> >
> > --
> >
> > Bruno Rochahttp://about.me/rochacbruno/bio




Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Jason Brower

I didn't endorse him because I wanted to follow the rule. :D
On Thu, 2010-11-18 at 04:04 -0800, mdipierro wrote:

> No. ;-)
> 
> On Nov 17, 9:40 pm, Nathan Freeze  wrote:
> > Massimo, your bio is missing a pic. Is it okay to endorse you? :)
> >
> > On Wed, Nov 17, 2010 at 9:23 PM, mdipierro  wrote:
> > > I have implemented an endorsement mechanism. Existing members can see
> > > and endorse new applicants. New applications should contact existing
> > > members by email and request an endorsement.
> > > 5 endorsements qualify for acceptance as an expert. Endorsements can
> > > be withdrawn. Endorsements are confidential. I can override this and I
> > > will for known web2py contributors.
> >
> > > You apply by simply logging in into the system.
> >
> > > I am happy to say that at least 3 members of the group have already
> > > been contacted with job offers.
> >
> > > Please DO NOT ENDORSE users who did not post a decent picture or
> > > profile, even if you know they are good web2py programmers.
> >
> > > If you have already been approved because you are a web2py contributor
> > > but you have posted no picture, a scary picture (yes you!), or no
> > > profile, please correct it.
> >
> > > Everybody can register a new affiliated company, a new project and/or
> > > a new skill. But they I will have to approve them. I do not want to
> > > make the list of skills too long. Projects must be based on web2py,
> > > tested and deployed. Companies but say in the web site that they
> > > provide web2py support (although not exclusively).
> >
> > > Massimo
> >
> >


<>

Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Kenneth Lundström
I´m too happily employed but doing some web2py development on my spare 
time. You never know when a big,perfect job comes looking for you. If 
your not on the list it might go to somebody else.



Kenneth


A bit off topic question -
I am currently happily employed and developing web2py based open
source applications, but when this changes I might want to have a foot
in the door for finding a job hacking web2py apps.
Should i register at experts4solutions and state that I am currently
not interested in jobs or should I register when I really have the
need for it?

On Nov 18, 3:34 pm, Bruno Rocha  wrote:

humm, I just figure out that I have to click in 'no' to toggle it to yes!

not so clear.

2010/11/18 Bruno Rocha






Endorsement has only 'no' option?
You endorse: no  (your
your/no endorsement is confidential)
Where can I endorse someone?
2010/11/18 mdipierro
I have implemented an endorsement mechanism. Existing members can see

and endorse new applicants. New applications should contact existing
members by email and request an endorsement.
5 endorsements qualify for acceptance as an expert. Endorsements can
be withdrawn. Endorsements are confidential. I can override this and I
will for known web2py contributors.
You apply by simply logging in into the system.
I am happy to say that at least 3 members of the group have already
been contacted with job offers.
Please DO NOT ENDORSE users who did not post a decent picture or
profile, even if you know they are good web2py programmers.
If you have already been approved because you are a web2py contributor
but you have posted no picture, a scary picture (yes you!), or no
profile, please correct it.
Everybody can register a new affiliated company, a new project and/or
a new skill. But they I will have to approve them. I do not want to
make the list of skills too long. Projects must be based on web2py,
tested and deployed. Companies but say in the web site that they
provide web2py support (although not exclusively).
Massimo

--
Bruno Rocha
http://about.me/rochacbruno/bio

--

Bruno Rochahttp://about.me/rochacbruno/bio




Re: [web2py] Re: PostgreSQL super slowdowns

2010-11-18 Thread Michele Comitini
LIMITing results to max 1, is a good practice when you expect at most 1 result.

On postgresql it is very important to create indexes to have huge
performance boosts.

Check your slow queries with the EXPLAIN command (see on
postgresql.org) and make appropriate indexes.
Also do cluster long tables (see the CLUSTER command) and maintain
CLUSTERing at regular intervals.
After that no other db can beat postgesql, no way ;-)

mic

2010/11/18 Chris :
> I added your limitby code to some places.
> I haven't seen the same slowdowns recently, though, so it's hard to
> tell what happened - maybe it's from a fresh install of postgresql?
> We'll see if it comes back.
>
> On Nov 1, 11:01 pm, KMax  wrote:
>> Please check .first() or .last() usage.
>> With Postgres for some reason, all data are transfered to DAL, and on
>> w2p side first or last recored selected.
>>
>> Solution also are easy use:
>> .select(limitby=(0,1)).first()
>> or
>> select(limitby=(0,1),orderby=~db.papers.id).first()
>> or
>> .select(limitby=(0,1),orderby=db.papers.id).first().
>>
>> orderby=~ and orderby= will give you last or first for .first()
>> and .last() - since only one record are returned from db.
>>
>> Hope I score.
>>
>> On 29 ÏËÔ, 12:53, Chris  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Hey,
>>
>> > I've noticed some serious slowdowns ever since I switched from SQLite
>> > to Postgres. Pages will take MINUTES to load - it's kind of
>> > fascinating.
>>
>> > I don't have the full explanation for what's going on yet but I do
>> > have some clues. I've noticed it happens locally, and in a specific
>> > way:
>>
>> > 1) I load the page up in one browser and it loads and reloads fine.
>> > 2) When I open the page up in another browser or in an incognito
>> > session on the same machine, the page request hangs, usually for
>> > longer than two minutes.
>>
>> > I don't know for sure that it's Postgres related, but I don't remember
>> > seeing this on SQLite.
>>
>> > This is something I really need to fix! Can anyone reproduce this? Are
>> > there profilers or particular places in the code I can tag?
>>
>> > Thanks! - Chris


Re: [web2py] Re: How do we add projects or post a request for a new job on expert exchange?

2010-11-18 Thread Jason Brower
That would be awesome!
I think we could have a more pertinent way to find people to work with
with a simple search were you could type what kind of project you are
wanting to do and it response with people with a particular ranking and
relavence.  It would also be nice to get "recommended" by our clients.
BR,
Jason Brower

On Thu, 2010-11-18 at 03:59 -0800, mdipierro wrote:

> Are you talking about experts4solutions?
> 
> Let me clarify. It is NOT a site where people post jobs and we compete
> for the lowest bid like some other sites. Quite the opposite. We go
> for quality.
> 
> It is a place where people who need a job done can see who the
> qualified web2py programmers are and the programmers listed may be
> expensive. They contact the members directly and discuss price with
> them.
> 
> Clients may contact experts4solutions directly (i.e. me) and I can
> redirect them to the appropriate members.
> 
> We will only list open source projects that are completed, as an
> example tools we have contributed to develop, not projects developed
> for clients. Projects for clients are most likely developed on a
> confidential basis.
> 
> I know some experts have been contacted already so this is public. I
> was hoping this would grow to at least 100 members and I am hoping to
> have time to post some sample contracts and legal documents to help
> people get started.
> 
> Massimo
> 
> 
> On Nov 17, 11:28 pm, Jason Brower  wrote:
> > I want to start recommending people come to this site for Jobs and
> > Projects... is that happening yet?




Re: [web2py] Re: social network, event planners, and the like?

2010-11-18 Thread Jason Brower
I have a product that is going to be my main income that does event
planning.  It has social aspects as well.  If your interested in helping
make the project go further, please contact me privately and I can show
you how it works and you can give feedback on what you would like.
I have used it at 4 projects so far and I have 6 more planned for this
next year.
BR,
Jason Brower
On Thu, 2010-11-18 at 07:14 -0800, selecta wrote:

> some parts are implemented (plugin based) in the project that I will
> submit in the application exhibition 2.0 ...
> 
> On Nov 17, 8:42 pm, mdipierro  wrote:
> > Not exactly but this is a good place to start:
> >
> > http://web2py.com/appliances/default/show/71
> >
> > On Nov 17, 12:59 pm, Carlos  wrote:
> >
> >
> >
> > > Hi,
> >
> > > In a future project I might need capabilities like social network,
> > > event planners (e.g. weddings, parties), and the like.
> >
> > > I'm wondering if there's something already out there - preferably free
> > > open source, and obviously developed with web2py?, or at least in
> > > python?.
> >
> > > If there's nothing, is it recommended to start from scratch with
> > > web2py, or interface to external systems (e.g. elgg.org) from web2py?.
> >
> > > If external systems, customizations will likely be required.
> >
> > > Any help / advice on this matter is greatly appreciated - thanks!,
> >
> > >Carlos




[web2py] Re: VirtualField Issues

2010-11-18 Thread mdipierro
You make a good point. The code must be revised to take care of this
situation. I need to think about it.

On Nov 18, 8:20 am, VijayS  wrote:
> Hello,
>
>  I am new to web2py, and this group. I was conversing on IRC and it
> was suggested by dingding1 that I should post this here.
>
> I think there's a bug with virtualfields. It seems that if I try to
> use a select() statement with only one field name, then virtualfields
> will fail to work as it cannot find the other dependent fields it
> needs to calculate the desired output.
>
> So if this is desired behavior, it is not mentioned in the book (3rd
> ed), and it seems to be counter intuitve as it seems like the
> virtualclass should have access to all elements regardless of the
> select query being run on it.
>
> see following example codehttp://pastie.textmate.org/1308330
>
> class MyVirtualFields(object):
>     def production_total(self):
>         return
> self.production.production_shift_1+self.production.production_shift_2+self.production.production_shift_3
>     def production_net(self):
>         return
> self.production.production_shift_1+self.production.production_shift_2+self.production.production_shift_3-
> self.production.production_rejection
>     def lid_total(self):
>         return
> self.production.lid_shift_1+self.production.lid_shift_2+self.production.lid_shift_3
> #NOTE virtual fields cause a problem with SELCT() statements. In the
> select statement if you don't include the required fields for the
> calculation, it will give an error! This is a bug!
> #crashes on the following query
> #    rows = db(db.production.date_id ==
> date.today()).select(db.production.delivered)
> #if i comment our the select criteria as shown below, then it works
> fine
> #    rows = db(db.production.date_id ==
> date.today()).select()#db.production.delivered)
> db.production.virtualfields.append(MyVirtualFields())
>
> is this a valid, or just flawed understanding on my part?
> maybe it makes sense to not have virtualfields access to all fields,
> because that would mean fetching all data from server all the time,
> thereby slowing down.
> but then it should allow a switch for disabling it's evaluation or
> something so that when running code that doesn't require the
> virtualfield then it can skip the evaluation.
>
> Thank you for your patience.
>
> Vijay


[web2py] Re: Standalone DAL - connection to sqlite db - running web2py

2010-11-18 Thread mdipierro
I do not understand the meaning of "web2py application that is
crypted"

On Nov 18, 8:56 am, Ole Martin Maeland  wrote:
> Hi Massimo,
>
> I have administrator access on the folder. The database is running a small
> web2py application that is crypted. Do I have to pass the crypt string to
> the db, or do I have to use administrator password in order to access it.
>
> I reach it by using SQLite Manager..
>
> regards
> Martin
>
>
>
> On Thu, Nov 18, 2010 at 3:06 PM, mdipierro  wrote:
> > I think you do not have write access on this file/folder
>
> > On Nov 18, 7:36 am, Ole Martin Maeland  wrote:
> > > Hi,
>
> > > I am trying to connect to sqlite db that works fine with a small web2py
> > > applicaiton.
>
> > > connection parameters:
>
> > > >>> dbfolder='C:\web2py\web2py\applications\teqb\databases'
> > > >>> db = dal.DAL('sqlite://storage', folder=dbfolder)
>
> > > error message:
>
> > > Traceback (most recent call last):
> > >   File "", line 1, in 
> > >   File "C:\Python27\lib\site-packages\gluon\dal.py", line 2031, in
> > __init__
> > >     self._logger = Logger(folder)
> > >   File "C:\Python27\lib\site-packages\gluon\dal.py", line 140, in
> > __init__
> > >     self.file = open(os.path.join(folder,name),'a')
> > > IOError: [Errno 22] invalid mode ('a') or filename:
> > > 'C:\\web2py\\web2py\x07pplications\teqb\\databases\\sql.log'
>
> > > any ide how I could get this to work?
>
> > > regards
> > > Martin
>
> --
> Hilsen
> Ole Martin
> Mob: 95227471


Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Bruno Rocha
Some questions about projects page:
http://experts4solutions.com/e4s/default/projects

Can I add any public website that I've create powered by web2py ? (even if
not a corporate site)
Can I add a public website even wothout this source code?
Can I add any application that I am not the creator, just the contributor
(i.e web2py examples app) ?
Can I add some briefing+screenshots of closed source not public apps I've
made for my clients (with permission ) ?

At blouweb we have 4 products made with web2py (all closed source), we are
creating some public websites, corporate and personal sites (closed source
too), and I contribute with 2 applications made with web2py, what can I
post?


-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: experts4solutions.com again

2010-11-18 Thread mdipierro
I think for now we should only list people who are available to do
work, even if only on a part time bases. We could add a flag
(available, not available) but people not avaiable would not be
listed.

On Nov 18, 9:10 am, selecta  wrote:
> A bit off topic question -
> I am currently happily employed and developing web2py based open
> source applications, but when this changes I might want to have a foot
> in the door for finding a job hacking web2py apps.
> Should i register at experts4solutions and state that I am currently
> not interested in jobs or should I register when I really have the
> need for it?
>
> On Nov 18, 3:34 pm, Bruno Rocha  wrote:
>
> > humm, I just figure out that I have to click in 'no' to toggle it to yes!
>
> > not so clear.
>
> > 2010/11/18 Bruno Rocha 
>
> > > Endorsement has only 'no' option?
>
> > > You endorse: no  (your
> > > your/no endorsement is confidential)
>
> > > Where can I endorse someone?
>
> > > 2010/11/18 mdipierro 
>
> > > I have implemented an endorsement mechanism. Existing members can see
> > >> and endorse new applicants. New applications should contact existing
> > >> members by email and request an endorsement.
> > >> 5 endorsements qualify for acceptance as an expert. Endorsements can
> > >> be withdrawn. Endorsements are confidential. I can override this and I
> > >> will for known web2py contributors.
>
> > >> You apply by simply logging in into the system.
>
> > >> I am happy to say that at least 3 members of the group have already
> > >> been contacted with job offers.
>
> > >> Please DO NOT ENDORSE users who did not post a decent picture or
> > >> profile, even if you know they are good web2py programmers.
>
> > >> If you have already been approved because you are a web2py contributor
> > >> but you have posted no picture, a scary picture (yes you!), or no
> > >> profile, please correct it.
>
> > >> Everybody can register a new affiliated company, a new project and/or
> > >> a new skill. But they I will have to approve them. I do not want to
> > >> make the list of skills too long. Projects must be based on web2py,
> > >> tested and deployed. Companies but say in the web site that they
> > >> provide web2py support (although not exclusively).
>
> > >> Massimo
>
> > > --
>
> > > Bruno Rocha
> > >http://about.me/rochacbruno/bio
>
> > --
>
> > Bruno Rochahttp://about.me/rochacbruno/bio
>
>


[web2py] Re: experts4solutions.com again

2010-11-18 Thread mdipierro
If you are fully employed but willing to take some part time work it
is perfectly ok to be listed.

On Nov 18, 9:21 am, Kenneth Lundström 
wrote:
> I m too happily employed but doing some web2py development on my spare
> time. You never know when a big,perfect job comes looking for you. If
> your not on the list it might go to somebody else.
>
> Kenneth
>
> > A bit off topic question -
> > I am currently happily employed and developing web2py based open
> > source applications, but when this changes I might want to have a foot
> > in the door for finding a job hacking web2py apps.
> > Should i register at experts4solutions and state that I am currently
> > not interested in jobs or should I register when I really have the
> > need for it?
>
> > On Nov 18, 3:34 pm, Bruno Rocha  wrote:
> >> humm, I just figure out that I have to click in 'no' to toggle it to yes!
>
> >> not so clear.
>
> >> 2010/11/18 Bruno Rocha
>
> >>> Endorsement has only 'no' option?
> >>> You endorse: no  (your
> >>> your/no endorsement is confidential)
> >>> Where can I endorse someone?
> >>> 2010/11/18 mdipierro
> >>> I have implemented an endorsement mechanism. Existing members can see
>  and endorse new applicants. New applications should contact existing
>  members by email and request an endorsement.
>  5 endorsements qualify for acceptance as an expert. Endorsements can
>  be withdrawn. Endorsements are confidential. I can override this and I
>  will for known web2py contributors.
>  You apply by simply logging in into the system.
>  I am happy to say that at least 3 members of the group have already
>  been contacted with job offers.
>  Please DO NOT ENDORSE users who did not post a decent picture or
>  profile, even if you know they are good web2py programmers.
>  If you have already been approved because you are a web2py contributor
>  but you have posted no picture, a scary picture (yes you!), or no
>  profile, please correct it.
>  Everybody can register a new affiliated company, a new project and/or
>  a new skill. But they I will have to approve them. I do not want to
>  make the list of skills too long. Projects must be based on web2py,
>  tested and deployed. Companies but say in the web site that they
>  provide web2py support (although not exclusively).
>  Massimo
> >>> --
> >>> Bruno Rocha
> >>>http://about.me/rochacbruno/bio
> >> --
>
> >> Bruno Rochahttp://about.me/rochacbruno/bio
>
>


[web2py] Re: experts4solutions.com again

2010-11-18 Thread DenesL

Two comments:

1) In the title, experts4solutions is missing a t

2) We should have some mechanism to prevent email address harvesting,
no one wants to get spammed.

Denes


Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Bruno Rocha
>
>
>
> 2) We should have some mechanism to prevent email address harvesting,
> no one wants to get spammed.
>
>
Better to have a simple contact form(with captcha) that sends a message
directly to the expert mail.
just like the 'mail me' button in http://about.me/rochacbruno/bio

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: How do we add projects or post a request for a new job on expert exchange?

2010-11-18 Thread mdipierro
I am working on some sample legal agreements. The points to make are:
- the client hires you not experts4solutions
- experts4solutions can sell you code review and long term support but
that is optional
- clients who take a job via experts4solutions should meet some
guidelines (suggest the client solutions based on recommended
technologies on the web site and follow good practice, ask the client
to reviews the expert when job done).

I can draft this but I will discuss it with members.



On Nov 18, 9:39 am, Jason Brower  wrote:
> That would be awesome!
> I think we could have a more pertinent way to find people to work with
> with a simple search were you could type what kind of project you are
> wanting to do and it response with people with a particular ranking and
> relavence.  It would also be nice to get "recommended" by our clients.
> BR,
> Jason Brower
>
> On Thu, 2010-11-18 at 03:59 -0800, mdipierro wrote:
> > Are you talking about experts4solutions?
>
> > Let me clarify. It is NOT a site where people post jobs and we compete
> > for the lowest bid like some other sites. Quite the opposite. We go
> > for quality.
>
> > It is a place where people who need a job done can see who the
> > qualified web2py programmers are and the programmers listed may be
> > expensive. They contact the members directly and discuss price with
> > them.
>
> > Clients may contact experts4solutions directly (i.e. me) and I can
> > redirect them to the appropriate members.
>
> > We will only list open source projects that are completed, as an
> > example tools we have contributed to develop, not projects developed
> > for clients. Projects for clients are most likely developed on a
> > confidential basis.
>
> > I know some experts have been contacted already so this is public. I
> > was hoping this would grow to at least 100 members and I am hoping to
> > have time to post some sample contracts and legal documents to help
> > people get started.
>
> > Massimo
>
> > On Nov 17, 11:28 pm, Jason Brower  wrote:
> > > I want to start recommending people come to this site for Jobs and
> > > Projects... is that happening yet?
>
>


[web2py] Re: Standalone DAL - connection to sqlite db - running web2py

2010-11-18 Thread mart
Hey,

It took me a few tries before getting this to work. So, I see 2 things
that you may want to try to look at:

1) I don't really use windows, but I think the first line is
problematic. (unless more recent windows versions have gotten smarter
about slashes?).

>>> dbfolder='C:\web2py\web2py\applications\teqb\databases'
>>> db = dal.DAL('sqlite://storage', folder=dbfolder)

should be:

>>> dbfolder='C:/web2py/web2py/applications/teqb/databases'
(or you can escape the back slash (C:\\web2py\\web2py\\...))

2) I remember importing DAL was a little finicky (sometimes).  SO, you
may want to try drilling down one more level in you import:

instead of
>>> db = dal.DAL('sqlite://storage', folder=dbfolder)

you may want to try:
from .gluon.dal import DAL
>>> db = DAL('sqlite://storage', folder=dbfolder)


I do the following without any problems on Mac, linux and windows: I
have 2 instances of web2py, some both running on the same machine, so
stand alone is renamed with "blue" prefixes (blueDAL, bluedb,
blueTHIS, blueTHAT, etc. and gluon is renamed to blueSQL in case they
run 2 different versions of web2py, I want to quickly and visually set
them apart when reading script.


tail,head = os.path.split(sys.argv[0])

dataFiles = ["storage.sqlite",
 "sql.log"]
dbFolder = "{0}/blueLite/db_storage".format(tail)

try:
for f in os.listdir(dbFolder):
if ".table" in f:
fTable = "{0}/{1}".format(dbFolder,f)
os.remove(fTable)
print("removed {0}".format(fTable))
for dFile in dataFiles:
os.remove("{0}/blueLite/db_storage/{1}".format(tail,dFile))
print("removed {0}/blueLite/db_storage/
{1}".format(tail,dFile))
except Exception as errObj:
print(str(errObj))

from blueLite.pyUtils.sql.blueSQL.dal import DAL as blueDal
from blueLite.pyUtils.sql.blueSQL.dal import SQLField
bluedb = blueDal("sqlite://storage.sqlite", folder="{0}/blueLite/
db_storage".format(tail))
bluedb.define_table('cmdObjects',
   SQLField('name'),
   SQLField('pyModule'),
   SQLField('pyPath'),
   SQLField('cmdProperties','blob'),
   SQLField('dict_objCmd','blob'),
   SQLField('dfo_objCmd', 'blob'),
   SQLField('etree_objCmd','blob'))
bluedb.commit()

Then I pass bluedb to all other classes which is why I use the full
path when pointing to the DB folder (NEVER relative).
hope it helps.


Mart :)

On Nov 18, 9:56 am, Ole Martin Maeland  wrote:
> Hi Massimo,
>
> I have administrator access on the folder. The database is running a small
> web2py application that is crypted. Do I have to pass the crypt string to
> the db, or do I have to use administrator password in order to access it.
>
> I reach it by using SQLite Manager..
>
> regards
> Martin
>
>
>
> On Thu, Nov 18, 2010 at 3:06 PM, mdipierro  wrote:
> > I think you do not have write access on this file/folder
>
> > On Nov 18, 7:36 am, Ole Martin Maeland  wrote:
> > > Hi,
>
> > > I am trying to connect to sqlite db that works fine with a small web2py
> > > applicaiton.
>
> > > connection parameters:
>
> > > >>> dbfolder='C:\web2py\web2py\applications\teqb\databases'
> > > >>> db = dal.DAL('sqlite://storage', folder=dbfolder)
>
> > > error message:
>
> > > Traceback (most recent call last):
> > >   File "", line 1, in 
> > >   File "C:\Python27\lib\site-packages\gluon\dal.py", line 2031, in
> > __init__
> > >     self._logger = Logger(folder)
> > >   File "C:\Python27\lib\site-packages\gluon\dal.py", line 140, in
> > __init__
> > >     self.file = open(os.path.join(folder,name),'a')
> > > IOError: [Errno 22] invalid mode ('a') or filename:
> > > 'C:\\web2py\\web2py\x07pplications\teqb\\databases\\sql.log'
>
> > > any ide how I could get this to work?
>
> > > regards
> > > Martin
>
> --
> Hilsen
> Ole Martin
> Mob: 95227471


[web2py] striped tables

2010-11-18 Thread Bruno Rocha
Now I am using this code: http://pastebin.com/BbizfpcE to create striped
tables with a Row object.

Is there an easy way? can SQLTABLE be striped?

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: striped tables

2010-11-18 Thread Bruno Rocha
Without the enumerate works if we do have an id:
http://pastebin.com/h0bnZjqR

2010/11/18 Bruno Rocha 

> Now I am using this code: http://pastebin.com/BbizfpcE to create striped
> tables with a Row object.
>
> Is there an easy way? can SQLTABLE be striped?
>
> --
>
> Bruno Rocha
> http://about.me/rochacbruno/bio
>



-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Re: decimal validator by default or not

2010-11-18 Thread Richard Vézina
Ok... I could set it to : (0,00.99) for example.

Thanks!

Richard

On Wed, Nov 17, 2010 at 6:00 PM, mdipierro  wrote:

> 4,2 have to do with precision, not range.
>
> On Nov 17, 4:18 pm, Richard Vézina 
> wrote:
> > Ok,
> >
> > I think I wrongly define the IS_DECIMAL_IN_RANGE
> >
> > I set it to (0,99.99)
> >
> > And now the validators works.
> >
> > Still wondering if IS_DECIMAL_IN_RANGE as to be explicitly define since
> the
> > decimal(4,2) were already available
> >
> > Richard
> >
> > On Wed, Nov 17, 2010 at 4:06 PM, Richard Vézina <
> ml.richard.vez...@gmail.com
> >
> > > wrote:
> > > Just to be sure... Data are entered in english... Mean if we entered
> > > exactly this in the form fiel : 123.123
> >
> > > On Wed, Nov 17, 2010 at 3:59 PM, Jonathan Lundell  >wrote:
> >
> > >> On Nov 17, 2010, at 12:26 PM, mdipierro wrote:
> >
> > >> > could be. Not sure what that means for decimal numbers.
> >
> > >> FWIW, I took a look at the Python decimal module, and it requires '.'
> as
> > >> the decimal separator. So any conversion is going to have to happen
> before
> > >> Decimal gets the string.
> >
> > >> > On Nov 17, 2:07 pm, Richard Vézina 
> > >> > wrote:
> > >> >> I use postgresql and local in postgres are : fr_CA.UTF-8
> >
> > >> >> Could it be the reason of the problem?
> >
> > >> >> Richard
> >
> > >> >> On Wed, Nov 17, 2010 at 2:37 PM, mdipierro <
> mdipie...@cs.depaul.edu>
> > >> wrote:
> > >> >>> BTW... why are you getting the traceback in french? If your python
> is
> > >> >>> localized, could this affect the meaning of . in sqlite?
> >
> > >> >>> On Nov 17, 9:43 am, Richard Vézina 
> > >> >>> wrote:
> > >>  Hello,
> >
> > >>  I wonder if it is normal that I get ticket in that case :
> >
> > >>  Model :
> >
> > >>  Field('field1','decimal(4,2)'),
> >
> > >>  If I insert in form generate with crud.create(db.table1) this
> value :
> > >>  123.123
> >
> > >>  I get ticket :
> >
> > >>  Error traceback
> >
> > >>  1.
> > >>  2.
> > >>  3.
> > >>  4.
> > >>  5.
> > >>  6.
> > >>  7.
> > >>  8.
> > >>  9.
> > >>  10.
> > >>  11.
> > >>  12.
> > >>  13.
> > >>  14.
> > >>  15.
> > >>  16.
> > >>  17.
> > >>  18.
> > >>  19.
> > >>  20.
> > >>  21.
> >
> > >>  Traceback (most recent call last):
> > >>    File "/web2py/gluon/restricted.py", line 188, in restricted
> > >>  exec ccode in environment
> > >>    File "/web2py/applications/app/controllers/test.py", line 552,
> in
> > >> >>> 
> > >>    File "/web2py/gluon/globals.py", line 96, in 
> > >>  self._caller = lambda f: f()
> > >>    File "/web2py/gluon/tools.py", line 2270, in f
> > >>  return action(*a, **b)
> > >>    File "/web2py/applications/app/controllers/test.py", line 372,
> in
> > >> >>> update
> > >>  if form.accepts(request.vars, session):
> > >>    File "/web2py/gluon/sqlhtml.py", line 1144, in accepts
> > >>  self.table._db(self.table.id == self.record.id
> ).update(**fields)
> > >>    File "/web2py/gluon/sql.py", line 3484, in update
> > >>  self._db._execute(query)
> > >>    File "/web2py/gluon/sql.py", line 1026, in 
> > >>  self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> > >>  DataError: ERREUR:  champ numérique en dehors des limites
> > >>  DETAIL:  Un champ de précision 4 et d'échelle 2 doit être arrondi
> à
> > >> une
> > >> >>> valeur
> > >>  absolue inférieure à 10^2.
> >
> > >>  I thought that the validator will show up a error...
> >
> > >>  Do I have to use IS_DECIMAL_IN_RANGE and why since I precised the
> > >> decimal
> > >>  limit in the model???
> >
> > >>  Regards.
> >
> > >>  Richard
> >
> >
>


[web2py] Re: decimal validator by default or not

2010-11-18 Thread mdipierro
If we were to do it I would have gone for

(-99.99,+99.99)

On Nov 18, 10:50 am, Richard Vézina 
wrote:
> Ok... I could set it to : (0,00.99) for example.
>
> Thanks!
>
> Richard
>
> On Wed, Nov 17, 2010 at 6:00 PM, mdipierro  wrote:
> > 4,2 have to do with precision, not range.
>
> > On Nov 17, 4:18 pm, Richard Vézina 
> > wrote:
> > > Ok,
>
> > > I think I wrongly define the IS_DECIMAL_IN_RANGE
>
> > > I set it to (0,99.99)
>
> > > And now the validators works.
>
> > > Still wondering if IS_DECIMAL_IN_RANGE as to be explicitly define since
> > the
> > > decimal(4,2) were already available
>
> > > Richard
>
> > > On Wed, Nov 17, 2010 at 4:06 PM, Richard Vézina <
> > ml.richard.vez...@gmail.com
>
> > > > wrote:
> > > > Just to be sure... Data are entered in english... Mean if we entered
> > > > exactly this in the form fiel : 123.123
>
> > > > On Wed, Nov 17, 2010 at 3:59 PM, Jonathan Lundell  > >wrote:
>
> > > >> On Nov 17, 2010, at 12:26 PM, mdipierro wrote:
>
> > > >> > could be. Not sure what that means for decimal numbers.
>
> > > >> FWIW, I took a look at the Python decimal module, and it requires '.'
> > as
> > > >> the decimal separator. So any conversion is going to have to happen
> > before
> > > >> Decimal gets the string.
>
> > > >> > On Nov 17, 2:07 pm, Richard Vézina 
> > > >> > wrote:
> > > >> >> I use postgresql and local in postgres are : fr_CA.UTF-8
>
> > > >> >> Could it be the reason of the problem?
>
> > > >> >> Richard
>
> > > >> >> On Wed, Nov 17, 2010 at 2:37 PM, mdipierro <
> > mdipie...@cs.depaul.edu>
> > > >> wrote:
> > > >> >>> BTW... why are you getting the traceback in french? If your python
> > is
> > > >> >>> localized, could this affect the meaning of . in sqlite?
>
> > > >> >>> On Nov 17, 9:43 am, Richard Vézina 
> > > >> >>> wrote:
> > > >>  Hello,
>
> > > >>  I wonder if it is normal that I get ticket in that case :
>
> > > >>  Model :
>
> > > >>  Field('field1','decimal(4,2)'),
>
> > > >>  If I insert in form generate with crud.create(db.table1) this
> > value :
> > > >>  123.123
>
> > > >>  I get ticket :
>
> > > >>  Error traceback
>
> > > >>  1.
> > > >>  2.
> > > >>  3.
> > > >>  4.
> > > >>  5.
> > > >>  6.
> > > >>  7.
> > > >>  8.
> > > >>  9.
> > > >>  10.
> > > >>  11.
> > > >>  12.
> > > >>  13.
> > > >>  14.
> > > >>  15.
> > > >>  16.
> > > >>  17.
> > > >>  18.
> > > >>  19.
> > > >>  20.
> > > >>  21.
>
> > > >>  Traceback (most recent call last):
> > > >>    File "/web2py/gluon/restricted.py", line 188, in restricted
> > > >>      exec ccode in environment
> > > >>    File "/web2py/applications/app/controllers/test.py", line 552,
> > in
> > > >> >>> 
> > > >>    File "/web2py/gluon/globals.py", line 96, in 
> > > >>      self._caller = lambda f: f()
> > > >>    File "/web2py/gluon/tools.py", line 2270, in f
> > > >>      return action(*a, **b)
> > > >>    File "/web2py/applications/app/controllers/test.py", line 372,
> > in
> > > >> >>> update
> > > >>      if form.accepts(request.vars, session):
> > > >>    File "/web2py/gluon/sqlhtml.py", line 1144, in accepts
> > > >>      self.table._db(self.table.id == self.record.id
> > ).update(**fields)
> > > >>    File "/web2py/gluon/sql.py", line 3484, in update
> > > >>      self._db._execute(query)
> > > >>    File "/web2py/gluon/sql.py", line 1026, in 
> > > >>      self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> > > >>  DataError: ERREUR:  champ numérique en dehors des limites
> > > >>  DETAIL:  Un champ de précision 4 et d'échelle 2 doit être arrondi
> > à
> > > >> une
> > > >> >>> valeur
> > > >>  absolue inférieure à 10^2.
>
> > > >>  I thought that the validator will show up a error...
>
> > > >>  Do I have to use IS_DECIMAL_IN_RANGE and why since I precised the
> > > >> decimal
> > > >>  limit in the model???
>
> > > >>  Regards.
>
> > > >>  Richard
>
>


[web2py] Re: striped tables

2010-11-18 Thread villas
> Is there an easy way? can SQLTABLE be striped?

SQLTABLE already has  so you just style those
classes.

-D


[web2py] Re: New style 1.89.X forms seem washed out?

2010-11-18 Thread mdipierro
I actually like it as it is.

On Nov 18, 10:58 am, Ron McOuat  wrote:
> I added email subscription so now I can attach a PNG of what I see on Ubuntu
> 10.04 default install.
>
> I will fix it for my own purposes, but am wondering if there is room to
> consider improving the defaults?
>
> Ron
>
> On Thu, Nov 18, 2010 at 4:05 AM, Martín Mulone wrote:
>
>
>
> > 2010/11/18 ron_m 
>
> >> The text input fields are not very tall, in fact select boxes don't
> >> even show the full height of the font. I fixed that by changing the
> >> input text, input password and select height from 16px to 20px in
> >> base.css
>
> >> Ron
>
> > I think massimo change to 16 px, because originally was in 22px.
>
> > Anyways you can always customize it.
>
> > Change this in base.css
>
> > input[type=submit], input[type=button], button {
> > margin: 0px;
> > height: 22px;
> >  background: #eaeaea;
> > color: #555;
> > border: 1px solid #dedede;
> >     -moz-border-radius: 2px;
> >     -webkit-border-radius: 2px;
> > border-radius: 2px;
> > }
>
> > change background to something like background: #a1a1a1;
>
> > --
> > My blog:http://martin.tecnodoc.com.ar
> > My portfolio *spanish*:http://www.tecnodoc.com.ar
> > Checkout my last proyect instant-press:http://www.instant2press.com
>
>
>
>  Screenshot.png
> 95KViewDownload


Re: [web2py] Re: web2py converts the data to thml chars from controller to view

2010-11-18 Thread Daniel Gonzalez
Hi!

Thx! It looks that all that i need was the TAG() helper :)

Regards!


El mar, 16-11-2010 a las 01:46 -0800, villas escribió:
> Hi Demetrio
> 
> Take a look at the XML helper:
> 
> http://web2py.com/book/default/chapter/05
> 
> Regards,  D
> 
> On Nov 16, 12:52 am, demetrio  wrote:
> > Hi everyone!
> >
> > When I try to send html code to a view web2py automatically converts
> > it to html characters (i.e.: the character "<" is converted to "<")
> >
> > There is any way to make the unescape the data?
> >
> > Thanks in advance.
> >
> > demetrio




[web2py] model definition

2010-11-18 Thread Richard Vézina
Hello,

I would clarify my understanding a bit... In the book it says :

Notice that requires=... is enforced at the level of forms, required=True is
enforced at the level of the DAL (insert), while notnull, unique and
ondeleteare enforced at the level of the database. While they sometimes may
seem redundant, it is important to maintain the distinction when programming
with the DAL.

So, here my sql (postgres) :

CREATE TABLE table1
(
  table1_id serial NOT NULL,
  result1 integer NOT NULL,
  result2 numeric(10,2) NOT NULL,
  seizure_date date NOT NULL,
  CONSTRAINT table1_id PRIMARY KEY (table1_id),
)


My web2py model should be :

db.define_table('table1',
Field('table1_id','id'),
Field('result1','integer',
notnull=True,
requires=IS_NOT_EMPTY(),
required=IS_NOT_EMPTY()),
Field('result2','decimal(10,2)',
notnull=True,
requires=IS_NOT_EMPTY(),
required=IS_NOT_EMPTY()),
Field('seizure_date','date',
readable=False,
writable=False,
default=request.now,
notnull=True,
requires=IS_NOT_EMPTY(),
required=IS_NOT_EMPTY()),
migrate=False,
sequence_name='table1_table1_id_seq')

notnull= generate the NOT NULL constraint of the sql script generated by
web2py?
requires= tell the validator to trigger on blank submit field?
required= tell the DAL to not pass a empty field to de database?

Thanks

Richard


[web2py] Directory app

2010-11-18 Thread Carlos
Hi,

I was wondering if a Directory app has been implemented in web2py?.

With similar features as described in the following thread:

http://groups.google.com/group/web2py/browse_thread/thread/b6019d54d4ec8f23/09892cb7d92b15c3

This is related to my inquiries about Social Networking and Event
Planners features, as described in the following thread:

http://groups.google.com/group/web2py/browse_thread/thread/6cb3c121229506f8/e1aacd216ce75353

Thanks!,

   Carlos


[web2py] Re: social network, event planners, and the like?

2010-11-18 Thread Carlos
Hi selecta,

When can I see your project?, will it be free open-source?, what
features does it have?.

Unless no info should not be revealed before this exhibition?, which
btw when will it be?.

Thanks,

   Carlos


On Nov 18, 9:14 am, selecta  wrote:
> some parts are implemented (plugin based) in the project that I will
> submit in the application exhibition 2.0 ...
>
> On Nov 17, 8:42 pm, mdipierro  wrote:
>
>
>
>
>
>
>
> > Not exactly but this is a good place to start:
>
> >http://web2py.com/appliances/default/show/71
>
> > On Nov 17, 12:59 pm, Carlos  wrote:
>
> > > Hi,
>
> > > In a future project I might need capabilities like social network,
> > > event planners (e.g. weddings, parties), and the like.
>
> > > I'm wondering if there's something already out there - preferably free
> > > open source, and obviously developed with web2py?, or at least in
> > > python?.
>
> > > If there's nothing, is it recommended to start from scratch with
> > > web2py, or interface to external systems (e.g. elgg.org) from web2py?.
>
> > > If external systems, customizations will likely be required.
>
> > > Any help / advice on this matter is greatly appreciated - thanks!,
>
> > >    Carlos


Re: [web2py] Re: web2py converts the data to thml chars from controller to view

2010-11-18 Thread Bruno Rocha
You can call your function with .load extension

app/default/action.load

2010/11/18 Daniel Gonzalez 

> Hi!
>
> Thx! It looks that all that i need was the TAG() helper :)
>
> Regards!
>
>
> El mar, 16-11-2010 a las 01:46 -0800, villas escribió:
> > Hi Demetrio
> >
> > Take a look at the XML helper:
> >
> > http://web2py.com/book/default/chapter/05
> >
> > Regards,  D
> >
> > On Nov 16, 12:52 am, demetrio  wrote:
> > > Hi everyone!
> > >
> > > When I try to send html code to a view web2py automatically converts
> > > it to html characters (i.e.: the character "<" is converted to "<")
> > >
> > > There is any way to make the unescape the data?
> > >
> > > Thanks in advance.
> > >
> > > demetrio
>
>
>


-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] session not saving variables?

2010-11-18 Thread Bruno Rocha
Can it be a matter of current server datetime problems?



def is_expired(self, seconds = 3600):now =
datetime.datetime.today()if not self._last_timestamp or \
  self._last_timestamp + \

datetime.timedelta(seconds = seconds) > now:
 self._last_timestamp = nowreturn Falseelse:
 return True



where the session expiration is being set?

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: session not saving variables?

2010-11-18 Thread mdipierro
sessions never expire although there is an admin/cron job that deletes
them.

On Nov 18, 12:08 pm, Bruno Rocha  wrote:
> Can it be a matter of current server datetime problems?
>
> def is_expired(self, seconds = 3600):        now =
> datetime.datetime.today()        if not self._last_timestamp or \
>           self._last_timestamp + \
>
>                     datetime.timedelta(seconds = seconds) > now:
>      self._last_timestamp = now            return False        else:
>          return True
>
> where the session expiration is being set?
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: session not saving variables?

2010-11-18 Thread mdipierro
auth sessions (in session.auth) do expire

On Nov 18, 12:08 pm, Bruno Rocha  wrote:
> Can it be a matter of current server datetime problems?
>
> def is_expired(self, seconds = 3600):        now =
> datetime.datetime.today()        if not self._last_timestamp or \
>           self._last_timestamp + \
>
>                     datetime.timedelta(seconds = seconds) > now:
>      self._last_timestamp = now            return False        else:
>          return True
>
> where the session expiration is being set?
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Validate dynamically generated select SQLFORM.factory

2010-11-18 Thread Kostas M
It seems I don't understand what is the problem. Isn't the intended
action the form to have errors if nothing is selected?
This is checked with the: if form.accepts(request.vars, session): ...

> My app throws an error if you click the submit button without selecting an 
> item from the list in the form.
>
> I have tried adding 'zero=T('Choose one')', both with and without adding the 
> string 'Choose one' to the list 'options'. What would the best way to 
> validate this be?


[web2py] replace delete with inactive

2010-11-18 Thread Carlos
Hi,

I'm trying to replace the built-in delete behavior in crud.update
(deletable=True) with a boolean active field instead, in order to NOT
do a hard-delete of any records but instead a soft-delete via the
active flag.

I'm also using onaccept=crud.archive.

I successfully manage to cancel the delete operation (currently in all
cases for testing purposes) via the following just before the
crud.update:

   if request.vars: del request.vars.delete_this_record

But when the crud.update is executed (with crud.archive) and the
delete checkbox is on, I get the following error:

(insert or update on table
"entity_archive" violates foreign key constraint
"entity_archive_current_record_fkey"
DETAIL:  Key (current_record)=(6) is not present in table "entity".)

Note that the record is NOT deleted (as expected), and therefore I
don't understand why crud.archive is complaining about it.

Also note that crud.update (with crud.archive) works ok when the
delete checkbox is off.

I've checked request.vars and I don't see any problems.

Can you please help?.

Thanks,

   Carlos


[web2py] Re: replace delete with inactive

2010-11-18 Thread mdipierro
good point.

This will work:

if request.post_vars.delete_this_record:
del request.post_vars.delete_this_record
db.t_person.active.update=False

there are two problems in your example:
- you are using request.vars and not request.post_vars which crud uses
and therefore the variable is not deleted
- web2py actually deletes the record but that breaks the references,
the db raises an exception, web2py catches it and rollsback, so the
record is still there.

Massimo

On Nov 18, 1:14 pm, Carlos  wrote:
> Hi,
>
> I'm trying to replace the built-in delete behavior in crud.update
> (deletable=True) with a boolean active field instead, in order to NOT
> do a hard-delete of any records but instead a soft-delete via the
> active flag.
>
> I'm also using onaccept=crud.archive.
>
> I successfully manage to cancel the delete operation (currently in all
> cases for testing purposes) via the following just before the
> crud.update:
>
>    if request.vars: del request.vars.delete_this_record
>
> But when the crud.update is executed (with crud.archive) and the
> delete checkbox is on, I get the following error:
>
> (insert or update on table
> "entity_archive" violates foreign key constraint
> "entity_archive_current_record_fkey"
> DETAIL:  Key (current_record)=(6) is not present in table "entity".)
>
> Note that the record is NOT deleted (as expected), and therefore I
> don't understand why crud.archive is complaining about it.
>
> Also note that crud.update (with crud.archive) works ok when the
> delete checkbox is off.
>
> I've checked request.vars and I don't see any problems.
>
> Can you please help?.
>
> Thanks,
>
>    Carlos


[web2py] Re: Precise behaviour of "compute" on record update

2010-11-18 Thread cjrh
On Nov 18, 3:46 pm, mdipierro  wrote:
> >>> db=DAL()
> >>> db.define_table('xxx',Field('yyy',writable=False,readable=False))
> >>> db.xxx.yyy.default=lambda: 'hello world'
> >>> db.xxx.insert()
> 1
> >>> print db.xxx(1).yyy
>
> hello world
>
> default can be a lambda.

I did not know that.  I'm going to update the book.


[web2py] Migrations questions (help!)

2010-11-18 Thread Lorin Rivers
My database is PostgreSQL

I have tables defined in my ../models/db.py

Now I want to add some fields to one of the tables defined there. The table has 
data in it already.

I tried modifying the original table definition but that didn't actually change 
the table's structure.

Where should I make these changes? I have a model (rounding.py) that creates a 
new table in the database defined in db.py. That worked after some finagling (I 
think I had to drop the table and have the model recreate it, but it didn't 
have data yet).

So what is the best method for making incremental changes to databases?

I'm stuck and need some help.

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




[web2py] Re: replace delete with inactive

2010-11-18 Thread Carlos
Thanks Massimo !

On Nov 18, 1:41 pm, mdipierro  wrote:
> good point.
>
> This will work:
>
>     if request.post_vars.delete_this_record:
>         del request.post_vars.delete_this_record
>         db.t_person.active.update=False
>
> there are two problems in your example:
> - you are using request.vars and not request.post_vars which crud uses
> and therefore the variable is not deleted
> - web2py actually deletes the record but that breaks the references,
> the db raises an exception, web2py catches it and rollsback, so the
> record is still there.
>
> Massimo
>
> On Nov 18, 1:14 pm, Carlos  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm trying to replace the built-in delete behavior in crud.update
> > (deletable=True) with a boolean active field instead, in order to NOT
> > do a hard-delete of any records but instead a soft-delete via the
> > active flag.
>
> > I'm also using onaccept=crud.archive.
>
> > I successfully manage to cancel the delete operation (currently in all
> > cases for testing purposes) via the following just before the
> > crud.update:
>
> >    if request.vars: del request.vars.delete_this_record
>
> > But when the crud.update is executed (with crud.archive) and the
> > delete checkbox is on, I get the following error:
>
> > (insert or update on table
> > "entity_archive" violates foreign key constraint
> > "entity_archive_current_record_fkey"
> > DETAIL:  Key (current_record)=(6) is not present in table "entity".)
>
> > Note that the record is NOT deleted (as expected), and therefore I
> > don't understand why crud.archive is complaining about it.
>
> > Also note that crud.update (with crud.archive) works ok when the
> > delete checkbox is off.
>
> > I've checked request.vars and I don't see any problems.
>
> > Can you please help?.
>
> > Thanks,
>
> >    Carlos


[web2py] Re: Migrations questions (help!)

2010-11-18 Thread VP
Unless you have migration set to False, these things should be
automatic.



On Nov 18, 1:53 pm, Lorin Rivers  wrote:
> My database is PostgreSQL
>
> I have tables defined in my ../models/db.py
>
> Now I want to add some fields to one of the tables defined there. The table 
> has data in it already.
>
> I tried modifying the original table definition but that didn't actually 
> change the table's structure.
>
> Where should I make these changes? I have a model (rounding.py) that creates 
> a new table in the database defined in db.py. That worked after some 
> finagling (I think I had to drop the table and have the model recreate it, 
> but it didn't have data yet).
>
> So what is the best method for making incremental changes to databases?
>
> I'm stuck and need some help.
>
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)


Re: [web2py] Re: Migrations questions (help!)

2010-11-18 Thread Lorin Rivers
They are not set to false.

I'm coming from a slight rails perspective (some experience with it). In rails, 
migrations are sequential. If you want to add a field to a table, you create a 
new migration that only does that.

Regarding my question, then, do most people just edit the model (i.e., add a 
field, change a field's type, and so on)?

On Nov 18, 2010, at 14:29 , VP wrote:

> Unless you have migration set to False, these things should be
> automatic.
> 
> 
> 
> On Nov 18, 1:53 pm, Lorin Rivers  wrote:
>> My database is PostgreSQL
>> 
>> I have tables defined in my ../models/db.py
>> 
>> Now I want to add some fields to one of the tables defined there. The table 
>> has data in it already.
>> 
>> I tried modifying the original table definition but that didn't actually 
>> change the table's structure.
>> 
>> Where should I make these changes? I have a model (rounding.py) that creates 
>> a new table in the database defined in db.py. That worked after some 
>> finagling (I think I had to drop the table and have the model recreate it, 
>> but it didn't have data yet).
>> 
>> So what is the best method for making incremental changes to databases?
>> 
>> I'm stuck and need some help.
>> 
>> --
>> Lorin Rivers
>> Mosasaur: Killer Technical Marketing 
>> 
>> 512/203.3198 (m)

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




Re: [web2py] Re: Migrations questions (help!)

2010-11-18 Thread Kenneth Lundström
Correct, you edit the db.py file and reload a page and the database is 
updated.



Kenneth


They are not set to false.

I'm coming from a slight rails perspective (some experience with it). In rails, 
migrations are sequential. If you want to add a field to a table, you create a 
new migration that only does that.

Regarding my question, then, do most people just edit the model (i.e., add a 
field, change a field's type, and so on)?

On Nov 18, 2010, at 14:29 , VP wrote:


Unless you have migration set to False, these things should be
automatic.



On Nov 18, 1:53 pm, Lorin Rivers  wrote:

My database is PostgreSQL

I have tables defined in my ../models/db.py

Now I want to add some fields to one of the tables defined there. The table has 
data in it already.

I tried modifying the original table definition but that didn't actually change 
the table's structure.

Where should I make these changes? I have a model (rounding.py) that creates a 
new table in the database defined in db.py. That worked after some finagling (I 
think I had to drop the table and have the model recreate it, but it didn't 
have data yet).

So what is the best method for making incremental changes to databases?

I'm stuck and need some help.

--
Lorin Rivers
Mosasaur: Killer Technical Marketing

512/203.3198 (m)




[web2py] Re: verification login

2010-11-18 Thread mattynoce
i don't know if there is way to do this through settings but i
invented my own method to log in a user after verification. the user
has registered and thus has a row in auth_user.

in the model:
auth.settings.registration_requires_verification = True
auth.settings.verify_email_next = '/init/default/verifiedPage'
auth.settings.verify_email_onaccept = lambda form: __afterVerify(form)

def __afterVerify(form):
# find the user and log him/her in
user = db.auth_user[form.id]
__logInUser(user)

# separated this function in case it could be useful elsewhere
def __logInUser(user):
from gluon.storage import Storage
session.auth = Storage(user=user, last_visit=request.now,
expiration=auth.settings.expiration)


On Nov 17, 1:26 pm, mattynoce  wrote:
> hi, i hope this is an easy question, but i didn't find answers
> elsewhere in the forum.
>
> here's what i'm looking to do:
>
> 1) a parent registers with the site
> 2) the parent registers her child using just an email address
> 3) the child receives the verification email, and clicks on the link
> 4) the child then finishes the rest of the registration
>
> the part i'm having trouble with is the transition from (3) to (4). in
> (2) i was able to do a custom form to create the user and populate the
> registration_key field, no problem. but what i would like to do is
> have clicking on the verification link actually log in the user, and
> then use updates to set the rest of the variables.
>
> this isn't a security risk because it's just registration and there's
> no data about the child in the system. basically, i want the child to
> be logged in BEFORE having to set a password, then change it inside.
> is there a command i can use that will log a user in, or a way to set
> verification to automatically log in a user?
>
> thanks,
>
> matt


[web2py] Bug in response.stream

2010-11-18 Thread Clayton
The chunk_size seems to be ignored in response.stream

def stream(
self,
stream,
chunk_size = DEFAULT_CHUNK_SIZE,
request=None,
):
"""
if a controller function::

return response.stream(file, 100)

the file content will be streamed at 100 bytes at the time
"""

if isinstance(stream, (str, unicode)):
stream_file_or_304_or_206(stream, request=request,
  headers=self.headers)  NOT
PASSED IN TO stream_file_or_304_206!!

Thanks,

Clayton


[web2py] Re: verification login

2010-11-18 Thread mdipierro
I am assuming you are not using Janraion Oauth, etc.

1) make sure the db.auth_user has a
Field('registration_completed','boolean',default=True,writable=False,readable=False)
(default must be True if regular use go thought normal registration
process)
and a Field('parent_user','reference
auth_user',writable=False,readable=False)

2) in model make sure everybody has a completed registration

if auth.user and not auth.user.registration_completed and not
request.function=='user':
redirect(URL('default','user/profile'))

3) create an action to allows parents to register children:

@auth.requires_login()
def register_child()
auth.settings.registration_requires_verification=True
# show only the email!
for field in db.auth_user:
if field.name!='email':
field.writable=field
# defaul parent to registrar
db.auth_user.parent_user=auth.user_id
# copy current user info and restore it after form processed
parent = auth.user
form=auth.register(next=None) # do not redirect inside
auth.user=session.auth.user=parent
# redirect if form accepted
if form.vars and not form.errors: redirect(URL('index'))
return dict(form=form)

This should work. Let us know if it does or does not.

On Nov 17, 3:26 pm, mattynoce  wrote:
> hi, i hope this is an easy question, but i didn't find answers
> elsewhere in the forum.
>
> here's what i'm looking to do:
>
> 1) a parent registers with the site
> 2) the parent registers her child using just an email address
> 3) the child receives the verification email, and clicks on the link
> 4) the child then finishes the rest of the registration
>
> the part i'm having trouble with is the transition from (3) to (4). in
> (2) i was able to do a custom form to create the user and populate the
> registration_key field, no problem. but what i would like to do is
> have clicking on the verification link actually log in the user, and
> then use updates to set the rest of the variables.
>
> this isn't a security risk because it's just registration and there's
> no data about the child in the system. basically, i want the child to
> be logged in BEFORE having to set a password, then change it inside.
> is there a command i can use that will log a user in, or a way to set
> verification to automatically log in a user?
>
> thanks,
>
> matt


[web2py] Re: Migrations questions (help!)

2010-11-18 Thread mdipierro
As a rails user, would you share your experience with web2py so far?
What you like, what you do not, what you think rails is better at?
We'll defend ourselves but not take any offense. This can help us
improve.

Massimo

On Nov 18, 2:47 pm, Lorin Rivers  wrote:
> They are not set to false.
>
> I'm coming from a slight rails perspective (some experience with it). In 
> rails, migrations are sequential. If you want to add a field to a table, you 
> create a new migration that only does that.
>
> Regarding my question, then, do most people just edit the model (i.e., add a 
> field, change a field's type, and so on)?
>
> On Nov 18, 2010, at 14:29 , VP wrote:
>
>
>
> > Unless you have migration set to False, these things should be
> > automatic.
>
> > On Nov 18, 1:53 pm, Lorin Rivers  wrote:
> >> My database is PostgreSQL
>
> >> I have tables defined in my ../models/db.py
>
> >> Now I want to add some fields to one of the tables defined there. The 
> >> table has data in it already.
>
> >> I tried modifying the original table definition but that didn't actually 
> >> change the table's structure.
>
> >> Where should I make these changes? I have a model (rounding.py) that 
> >> creates a new table in the database defined in db.py. That worked after 
> >> some finagling (I think I had to drop the table and have the model 
> >> recreate it, but it didn't have data yet).
>
> >> So what is the best method for making incremental changes to databases?
>
> >> I'm stuck and need some help.
>
> >> --
> >> Lorin Rivers
> >> Mosasaur: Killer Technical Marketing 
> >> 
> >> 512/203.3198 (m)
>
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)


Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Branko Vukelic
On Thu, Nov 18, 2010 at 5:01 PM, Bruno Rocha  wrote:
> Some questions about projects
> page: http://experts4solutions.com/e4s/default/projects
> Can I add any public website that I've create powered by web2py ? (even if
> not a corporate site)
> Can I add a public website even wothout this source code?
> Can I add any application that I am not the creator, just the contributor
> (i.e web2py examples app) ?
> Can I add some briefing+screenshots of closed source not public apps I've
> made for my clients (with permission ) ?
> At blouweb we have 4 products made with web2py (all closed source), we are
> creating some public websites, corporate and personal sites (closed source
> too), and I contribute with 2 applications made with web2py, what can I
> post?

All of above? e4s is a site that invites members to make money, so you
should be able to show off your projects regardless of the license.

-- 
Branko Vukelić

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

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

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


[web2py] Re: Bug in response.stream

2010-11-18 Thread mdipierro
Not a bug.

chunk_size applies when you are returning a file-like object that
needs to be streamed. If you return a string, it is not streamed.

Massimo



On Nov 18, 3:04 pm, Clayton  wrote:
> The chunk_size seems to be ignored in response.stream
>
>     def stream(
>         self,
>         stream,
>         chunk_size = DEFAULT_CHUNK_SIZE,
>         request=None,
>         ):
>         """
>         if a controller function::
>
>             return response.stream(file, 100)
>
>         the file content will be streamed at 100 bytes at the time
>         """
>
>         if isinstance(stream, (str, unicode)):
>             stream_file_or_304_or_206(stream, request=request,
>                                       headers=self.headers)  NOT
> PASSED IN TO stream_file_or_304_206!!
>
> Thanks,
>
> Clayton


[web2py] Re: experts4solutions.com again

2010-11-18 Thread mdipierro
There are two options:

1) you can list all the projects you worked on, whether or no web2py
related, whether or not open source, in your page profile. You can add
links and you can add pictures. There are no restrictions because you
are advertising yourself.

2) you can submit projects to the list of projects of
experts4solutions. I will control this although we can discuss rules
and a process for listing those projects. I want the list long but I
also want the list to be a signature list of the best open source
projects or publicly visible projects. Closed source projects that are
not public should not be listed. Projects that are public but are not
professionally looking should not be listed. The point is to advertise
the skills of the group, not the project.

Ideally I would like the list to contains at one of the following:
- One CMS (InstantPress?)
- One LMS (we are talking about that, open source and we can all
consult and offer it to our local schools)
- One Medical app (working on that but kind of stuck on other things)
- One Online Store app (we have the Estore but we can make something
better)
- One ERP (Mariano is working on that).
(all open source)

Massimo

On Nov 18, 3:30 pm, Branko Vukelic  wrote:
> On Thu, Nov 18, 2010 at 5:01 PM, Bruno Rocha  wrote:
> > Some questions about projects
> > page: http://experts4solutions.com/e4s/default/projects
> > Can I add any public website that I've create powered by web2py ? (even if
> > not a corporate site)
> > Can I add a public website even wothout this source code?
> > Can I add any application that I am not the creator, just the contributor
> > (i.e web2py examples app) ?
> > Can I add some briefing+screenshots of closed source not public apps I've
> > made for my clients (with permission ) ?
> > At blouweb we have 4 products made with web2py (all closed source), we are
> > creating some public websites, corporate and personal sites (closed source
> > too), and I contribute with 2 applications made with web2py, what can I
> > post?
>
> All of above? e4s is a site that invites members to make money, so you
> should be able to show off your projects regardless of the license.
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


Re: [web2py] Re: Migrations questions (help!)

2010-11-18 Thread Lorin Rivers
I self-taught hacker (I would never describe myself as a programmer), I found 
rails to be less clear, it seem to be unnecessarily terse. I hate how ruby 
loops, I can never remember the syntax.

I find that DHH's personality flavors the framework (in a bad way) as your 
personality flavors web2py in a positive way.

It's hard to get used to blocks defined by indentation.

I wish there were more examples of simple things like the one I mentioned 
previously.

I find the migrations to not work that well and fail silently.

Overall, I'm loving web2py and growing to appreciate Python.


On Nov 18, 2010, at 15:12 , mdipierro wrote:

> As a rails user, would you share your experience with web2py so far?
> What you like, what you do not, what you think rails is better at?
> We'll defend ourselves but not take any offense. This can help us
> improve.
> 
> Massimo
> 
> On Nov 18, 2:47 pm, Lorin Rivers  wrote:
>> They are not set to false.
>> 
>> I'm coming from a slight rails perspective (some experience with it). In 
>> rails, migrations are sequential. If you want to add a field to a table, you 
>> create a new migration that only does that.
>> 
>> Regarding my question, then, do most people just edit the model (i.e., add a 
>> field, change a field's type, and so on)?
>> 
>> On Nov 18, 2010, at 14:29 , VP wrote:
>> 
>> 
>> 
>>> Unless you have migration set to False, these things should be
>>> automatic.
>> 
>>> On Nov 18, 1:53 pm, Lorin Rivers  wrote:
 My database is PostgreSQL
>> 
 I have tables defined in my ../models/db.py
>> 
 Now I want to add some fields to one of the tables defined there. The 
 table has data in it already.
>> 
 I tried modifying the original table definition but that didn't actually 
 change the table's structure.
>> 
 Where should I make these changes? I have a model (rounding.py) that 
 creates a new table in the database defined in db.py. That worked after 
 some finagling (I think I had to drop the table and have the model 
 recreate it, but it didn't have data yet).
>> 
 So what is the best method for making incremental changes to databases?
>> 
 I'm stuck and need some help.
>> 
 --
 Lorin Rivers
 Mosasaur: Killer Technical Marketing 
 
 512/203.3198 (m)
>> 
>> --
>> Lorin Rivers
>> Mosasaur: Killer Technical Marketing 
>> 
>> 512/203.3198 (m)

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




[web2py] Re: Migrations questions (help!)

2010-11-18 Thread mdipierro

> I find the migrations to not work that well and fail silently.

there is one catch with migrations. If you use sqlite, you cannot
change the type of field because sqlite will accept but will not
actually change the column type. It is because sqlite has limited
ALTER TABLE support.

Massimo

>
> Overall, I'm loving web2py and growing to appreciate Python.
>
> On Nov 18, 2010, at 15:12 , mdipierro wrote:
>
>
>
> > As a rails user, would you share your experience with web2py so far?
> > What you like, what you do not, what you think rails is better at?
> > We'll defend ourselves but not take any offense. This can help us
> > improve.
>
> > Massimo
>
> > On Nov 18, 2:47 pm, Lorin Rivers  wrote:
> >> They are not set to false.
>
> >> I'm coming from a slight rails perspective (some experience with it). In 
> >> rails, migrations are sequential. If you want to add a field to a table, 
> >> you create a new migration that only does that.
>
> >> Regarding my question, then, do most people just edit the model (i.e., add 
> >> a field, change a field's type, and so on)?
>
> >> On Nov 18, 2010, at 14:29 , VP wrote:
>
> >>> Unless you have migration set to False, these things should be
> >>> automatic.
>
> >>> On Nov 18, 1:53 pm, Lorin Rivers  wrote:
>  My database is PostgreSQL
>
>  I have tables defined in my ../models/db.py
>
>  Now I want to add some fields to one of the tables defined there. The 
>  table has data in it already.
>
>  I tried modifying the original table definition but that didn't actually 
>  change the table's structure.
>
>  Where should I make these changes? I have a model (rounding.py) that 
>  creates a new table in the database defined in db.py. That worked after 
>  some finagling (I think I had to drop the table and have the model 
>  recreate it, but it didn't have data yet).
>
>  So what is the best method for making incremental changes to databases?
>
>  I'm stuck and need some help.
>
>  --
>  Lorin Rivers
>  Mosasaur: Killer Technical Marketing 
>  
>  512/203.3198 (m)
>
> >> --
> >> Lorin Rivers
> >> Mosasaur: Killer Technical Marketing 
> >> 
> >> 512/203.3198 (m)
>
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)


[web2py] Re: Bug in response.stream

2010-11-18 Thread Clayton
Ok, thanks for that. However, when I call response.stream(myfilename,
request=request), it seems to stream it in 64K chunks, and tracing the
code confirms it as far as I can see.

I'm confused because despite passing in chunk_size as a parameter, it
had no effect on the streaming. Also I'm not understanding the
documentation then:

>> response.stream(file, chunk_size): when a controller returns it, web2py 
>> streams the file content back to the client in blocks of size chunk_size.

Does that mean that if file is a filename, then chunk_size is ignored?
Why wouldn't it be passed in to the stream_file_or_304_or_206 call?

Finally, the documentation doesn't seem entirely clear that if
"request" is not passed in as a parameter, it won't stream correctly
(or at least that's my experience... it always restarted from the
beginning ignoring the http header range).

Thanks,

Clayton

On Nov 18, 4:41 pm, mdipierro  wrote:
> Not a bug.
>
> chunk_size applies when you are returning a file-like object that
> needs to be streamed. If you return a string, it is not streamed.
>
> Massimo
>
> On Nov 18, 3:04 pm, Clayton  wrote:
>
>
>
>
>
>
>
> > The chunk_size seems to be ignored in response.stream
>
> >     def stream(
> >         self,
> >         stream,
> >         chunk_size = DEFAULT_CHUNK_SIZE,
> >         request=None,
> >         ):
> >         """
> >         if a controller function::
>
> >             return response.stream(file, 100)
>
> >         the file content will be streamed at 100 bytes at the time
> >         """
>
> >         if isinstance(stream, (str, unicode)):
> >             stream_file_or_304_or_206(stream, request=request,
> >                                       headers=self.headers)  NOT
> > PASSED IN TO stream_file_or_304_206!!
>
> > Thanks,
>
> > Clayton


[web2py] Typo in Official Web2py book

2010-11-18 Thread karl simon
Not sure if this is the place to post this, but, I think there is a
typo in the Official Web2py book in chapter 10:
http://web2py.com/book/default/chapter/10

In the section labeled "The Ajax Function:

{{extend 'layout.html'}}





I believe id="name" should be name="name".  I tried it with id="name"
and it doesn't work correctly.  The same problem exists in the section
labeled "Eval Target"



Re: [web2py] Re: experts4solutions.com again

2010-11-18 Thread Bruno Rocha
I have one E-store online here: http://natalanimal.com.br/

I want to list the sites I've made, and I want to include my contribution to
web2py with mainsite/examples app, also I want to list some public visible
websites. Where should I point this? on my profile or in projects?

Will web2py itself be included as a project?

PS:
Carlos Yamandu is working on an ERP too:
https://bitbucket.org/yamandu/yamachine-erp/src

I am improving e-store and survey Cloud, also I am working on a Scrum
Management System (will be open source)



-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: problem whith admin

2010-11-18 Thread Jose
Daniel Gonzalez,

The patch works well for me. Thanks

Jose


[web2py] Re: gluon/contrib/login_methods/linkedin_account.py - anyone deployed this?

2010-11-18 Thread Carl
Michele, I have the germ of something that works.
Your code outline was pretty close...

In a controller function...

auth.settings.login_form =
LinkedInAccount(globals(),CLIENT_ID,CLIENT_SECRET, AUTH_URL,
TOKEN_URL, ACCESS_TOKEN_URL)
token = auth.settings.login_form.accessToken()
if token is None:
# add handling
pass
else:
from gluon.contrib.login_methods.linkedin import LinkedIn
api = LinkedIn(CLIENT_ID, CLIENT_SECRET, 'http://
afterthefact.org/')
api.access_token = token.key
api.access_token_secret = token.secret

# free to call methods of LinkedIn class. E.g., GetProfile()
profile = api.GetProfile()

Seemingly a little ugly but a self-written class 'LinkedInAccount'
derived from OAuthAccount can be married with Özgür Vatansever's
LinkedIn class. The former authenticates with LinkedIn and the latter
retrieves most of the data.

thanks M for the pointer



On Nov 16, 10:20 am, Carl  wrote:
> ah ha!
>
> I do have a class based on OAuthAccount working but it never occurred
> to me to build 'sideways' and plug LinkedIn into my solution.
>
> I'll give it a go. thanks for responding.
>
> On Nov 15, 9:52 pm, Michele Comitini 
> wrote:
>
>
>
>
>
>
>
> > Never tested, just a suggestion write something similar in your model
> > (see:http://code.google.com/r/michelecomitini-facebookaccess/source/browse...
>
> > class LinkedinTest(OAuthAccount):
> >     def get_user(self):
> >         if self.accessToken() is not None:
> >             client = oauth.Client(self.consumer, self.accessToken())
> >             resp, content =
> > client.request('https://api.linkedin.com/v1/people/~:(id,first-name,last-name)')
> >             if resp['status'] != '200':
> >                 # cannot get user info. should check status
> >                 return None
> >             x = dom.parseString(content)
> >             firstname = 
> > x.getElementsByTagName('first-name')[0].firstChild.data
> >             username = firstname + ' '
> > +x.getElementsByTagName('last-name')[0].firstChild.data
> >             uid = x.getElementsByTagName('id')[0].firstChild.data
> >             return dict(username=username, name=firstname, 
> > registration_id=uid)
>
> > auth.settings.login_form=LinkedinTest(globals(),CLIENT_ID,CLIENT_SECRET,
> > AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL)
>
> > api = LinkedIn(api_key, api_secret, callback_url)
>
> > api.access_token=auth.settings.login_form.accessToken()
>
> > now you should be able to use the linkedin api, skipping the OAuth
> > code embedded into it.
>
> > 2010/11/15 Carl :
>
> > > Has anyone got gluon/contrib/login_methods/linked_account.py working?
>
> > > I've built directly upon /gluon/contrib/login_methods/
> > > oauth10a_account.py with my own specific LinkedIn code but having
> > > foundhttp://code.google.com/p/python-linkedin/Iwanted to use this
> > > to avoid reinventing the wheel (Özgür Vatansever's linkedin.py looks
> > > clean and has broad support for LinkedIn's API).
>
> > > But, linkedin.py doesn't look finished; for example:
> > > (from web2py 1.89.1)
>
> > > Line 43.
> > > result = self.request.vars.verifier
>
> > > The vars variable sets 'oauth_verifier' on returning from the LinkedIn
> > > website but not 'verifier'.
>
> > > Anyone tread this path?


  1   2   >