[web2py] Re: mailing with pgp

2012-04-27 Thread szimszon
It seems that the gnupg home is still not set correctly.

Could you post from python shell (where code is working)
import os
print os.environ

And above modify the tools.py (after that you have to restart web2py I 
guess) and post the printed os.environ output. Without sensitive data :)


2012. április 27., péntek 5:15:12 UTC+2 időpontban weheh a következőt írta:
>
> I took the additional step of checking all the mail.settings... keys and 
> they are all set to values that look correct. I also retested the gpg 
> --list-secret-keys my_from_addr...@xyz.com and it produces a set of codes 
> consistent with recognizing my address. 
>
> The failure is happening in this block of code in tools.py:
> if sign:
> import string
> core.check_version( None )
> pin = string.replace( payload_in.as_string(), '\n', '\r\n' 
> )
> plain = core.Data( pin )
> sig = core.Data()
> c = core.Context()
> c.set_armor( 1 )
> c.signers_clear()
> # search for signing key for From:
> for sigkey in c.op_keylist_all( self.settings.sender, 1 ):
> # !!! THIS BLOCK OF CODE IS NEVER GETTING EXECUTED
> if sigkey.can_sign:
> c.signers_add( sigkey )
> if not c.signers_enum( 0 ):
>
Put here:
import os
print os.environ


# THIS IS WHERE THE ERROR MESSAGE IS GETTING GENERATED
> self.error = 'No key for signing [%s]' % 
> self.settings.sender
> return False
>
> For some reason, c.op_keylist_all(...) is returning nothing so no signers 
> are added to the list. I tried running this code standalone from inside a 
> python shell and it seemed to work. Could it be an environmental variable 
> isn't getting propagated to tools.py?
>
>

[web2py] SQLFORM

2012-04-27 Thread Vibhor Purandare
 I want to change position of Lables ;created in SQLFORM  ???
Please Help


Re: [web2py] Re: Cookbook recipe for nginx/uwsgi woes

2012-04-27 Thread rif
I had the same issue and I solved by adding plugin python in the uwsgi 
web2py configuration:


python 
<--HERE
127.0.0.1:9001
/home/www-data/web2py/

wsgihandler



joi, 12 aprilie 2012, 09:23:39 UTC+3, Bruce Wade a scris:
>
> I am having the exact same problem with uwsgi
>
> 2012/04/12 06:16:49 [error] 9428#0: *1 upstream prematurely closed 
> connection while reading response header from upstream, client: 
> 108.172.101.4, server: 50.18.67.206, request: "GET / HTTP/1.1", upstream: 
> "uwsgi://127.0.0.1:9001", host: "50.18.67.206"
>
> I tested and I can get to my static files using nginx without a problem so 
> I know that isn't the issue.
>
> Thinking maybe sticking with apache is a better more stable solution?
>
> On Wed, Apr 11, 2012 at 2:05 PM, Michele Comitini 
> <*
> *> wrote:
>
>> To handle static request using "alias" instead of "root" with regexp
>> should work better
>>
>>
>>  set $web2pyroot 
>>
>>
>>location ~ ^/(.*)/static/(.*) {
>> alias $web2pyroot/applications/$1/static/$2;
>>}
>>
>> mic
>>
>>
>> Il 11 aprile 2012 18:23, pbreit <* **> ha 
>> scritto:
>> > Looks like it is having trouble with a file in /static. This is how I 
>> serve
>> > /static:
>> >
>> > location /static {
>> > root /opt/web2py/applications/myapp/;
>> > }
>> >
>> > You may just need to add the appname to:
>> > root  /home/www-data/web2py/applications/
>> >
>> > Also, I don't know if you need that extra stuff on the location line.
>>
>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

Re: [web2py] Re: Creating a table or a an entry in a DB from index()

2012-04-27 Thread Khalil KHAMLICHI
IMHO, models should be read only once (start), and then upon admin wish by
using some sort of reload, I believe this kind of realtime configuration of
web2py comes at a huge cost of performance and no percieved benefets, here
is a  real world example, I have applications running for years now, the
code never changed, but still those applications at each and every request
read model file and process it for each one of the thousand of requests per
day.
I might be wrong.
On Apr 27, 2012 5:58 AM, "Anthony"  wrote:

> But the problem is that the data entered from, say index() is not
>> available at db.py. Am I right?
>> If a user enters entries to table "table_names", will db.py see them? Are
>> the data persistent?
>>
>
> Alan is suggesting that the index function would store the user input in a
> database table, and then the db.py model file would read that database
> table (on subsequent requests) and use the metadata stored there to
> generate the table definition for the user's table. This is one of three
> suggestions I made on SO:
> http://stackoverflow.com/questions/10317214/web2py-create-table-from-user-input/10318253#10318253.
> Did you try any of those solutions?
>
>
>> Also my understanding from reading the online book is that the model
>> files are run once when starting the application. Could you tell me how I
>> can make the for-loop run after each user enters a entry in the table?
>
>
> No, model files are run on every request, not just upon starting the
> application (actually, there is no "starting the application" --
> application code is simply run on each request, and only upon requests).
>
> Anthony
>
>>


Re: [web2py] Re: Ubuntu and Python3

2012-04-27 Thread Khalil KHAMLICHI
I prefer the name of web2py to web3py, besides web2py is already offering
us web3 functionalities.
On Apr 26, 2012 4:22 PM, "Sebastian E. Ovide" 
wrote:

> just wondering if having web3py in python 3 will give us some problem with
> some share hosting
>
> On Thu, Apr 26, 2012 at 2:52 PM, Johann Spies wrote:
>
>> That article says that Python 2.7 will still be part of Ubuntu so there
>> should not be a problem.
>>
>> Regards
>> Johann
>>
>>
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>>
>
>
> --
> Sebastian E. Ovide
>
>
>
>


[web2py] Re: mailing with pgp

2012-04-27 Thread szimszon
Now I tested the tools.py and I can set the GUNPGHOME with 
mail.settings.gpg_home = '/dir/to/where/is/.gnupg' and works. I set it 
wrong place than I can't sign the mail.

2012. április 27., péntek 5:15:12 UTC+2 időpontban weheh a következőt írta:
>
> I took the additional step of checking all the mail.settings... keys and 
> they are all set to values that look correct. I also retested the gpg 
> --list-secret-keys my_from_addr...@xyz.com and it produces a set of codes 
> consistent with recognizing my address. 
>
> The failure is happening in this block of code in tools.py:
> if sign:
> import string
> core.check_version( None )
> pin = string.replace( payload_in.as_string(), '\n', '\r\n' 
> )
> plain = core.Data( pin )
> sig = core.Data()
> c = core.Context()
> c.set_armor( 1 )
> c.signers_clear()
> # search for signing key for From:
> for sigkey in c.op_keylist_all( self.settings.sender, 1 ):
> # !!! THIS BLOCK OF CODE IS NEVER GETTING EXECUTED
> if sigkey.can_sign:
> c.signers_add( sigkey )
> if not c.signers_enum( 0 ):
> # THIS IS WHERE THE ERROR MESSAGE IS GETTING GENERATED
> self.error = 'No key for signing [%s]' % 
> self.settings.sender
> return False
>
> For some reason, c.op_keylist_all(...) is returning nothing so no signers 
> are added to the list. I tried running this code standalone from inside a 
> python shell and it seemed to work. Could it be an environmental variable 
> isn't getting propagated to tools.py?
>
>

[web2py] Re: ATTENTION before upgrading to trunk....

2012-04-27 Thread Simon Lukell
Anyone storing Facebook IDs will hit that limit, so as a PostgreSQL shop 
developing lots of FB apps, we can't wait for this to be released.  

On Friday, 27 April 2012 04:40:06 UTC+10, villas wrote:
>
> Thinking more about this,  an INTEGER will generally store over 2 billion 
> records.  Is the reason for updating to BIGINT due to someone having hit 
> that limit?  
>
> An inner voice is saying:  "Can't the person who has breached that limit 
> be asked to create his own tables instead of giving all the rest of us the 
> inconvenience?".  I shall now replace my tin-foil hat.
>


[web2py] Re: ATTENTION before upgrading to trunk....

2012-04-27 Thread Simon Lukell
Anyone storing Facebook IDs will hit that limit, so as a PostgreSQL shop 
developing lots of FB apps, we can't wait for this to be released.

Should have some test results on Monday


On Friday, 27 April 2012 04:40:06 UTC+10, villas wrote:
>
> Thinking more about this,  an INTEGER will generally store over 2 billion 
> records.  Is the reason for updating to BIGINT due to someone having hit 
> that limit?  
>
> An inner voice is saying:  "Can't the person who has breached that limit 
> be asked to create his own tables instead of giving all the rest of us the 
> inconvenience?".  I shall now replace my tin-foil hat.
>


[web2py] Re: ATTENTION before upgrading to trunk....

2012-04-27 Thread stefaan

>
>
> An inner voice is saying:  "Can't the person who has breached that limit 
> be asked to create his own tables instead of giving all the rest of us the 
> inconvenience?". 
>

An inner voice is saying: "640K [rows] ought to be enough for anybody" ? ;)



[web2py] Re: How do I show my views code in a web2py page

2012-04-27 Thread Anthony
And of course, you can always pass the code in from the controller:

def index():
return dict(code="{{some code}}")

Anthony

On Friday, April 27, 2012 1:35:57 AM UTC-4, Anthony wrote:
>
> Several options:
>
> *Pure HTML:*
>
> {{some code}}
>
>
> *Python string formatting:*
>
> {{='{%s}' % '{some code}'}}
>
>
> *Python function (defined in model or module):*
>
> def wrap(code):
> return '{{%s}}' % code
>
> and then in the view:
>
> {{=wrap('some code')}}
>
>
> *Javascript:*
>
> 
> jQuery(function() {
>   jQuery('.code').html(function(index, oldhtml) {
> return '{'+'{'+oldhtml+'}}'
>   })
> })
> 
> some code
>
>
> *Read from external file:*
>
> {{import os}}
> {{=open(os.path.join(request.folder, 'views/myview.html'), 'rb').read()}}
>
>
> You can also take advantage of the web2py CODE() helper to get nice code 
> formatting of the template code. See 
> http://web2py.com/books/default/chapter/29/5#Built-in-helpers.
>
> Anthony
>
> On Thursday, April 26, 2012 8:44:43 AM UTC-4, LMisi wrote:
>>
>> Hi
>>
>> I would like to show some view's code in my web2py page. But the first 
>> {{}} symbols in the html generate execution instead of pure displaying 
>> (showing).
>> I can generate decent html code from my python files, and shows in my 
>> page, but views... 
>>
>> Thanks
>>
>

[web2py] Postgres error

2012-04-27 Thread Loreia
Hi,

I define two tables in my application as:

db.define_table( "block_names"
   , Field("block_name" ,default=None)
)

db.define_table( "block_data"
   , Field("block_names_id" ,default=None)
   , Field("product_number" ,default=None)
   , Field("product_revision"   ,default=None)
   , Field("product_path"   ,default=None)
   , Field("branch" ,default=None)
   , Field("bat_file_path"  ,default=None)
   , Field("toolbox",default=None)
)

I am trying to run following query:
rows = db((db.block_names.id > 0)
 &(db.block_names.id == 
db.block_data.block_names_id)).select(db.block_names.block_name, 
db.block_data.ALL)

And I get this error:
  File ".../sqr_enumerate_pairs.py", line 77, in EnumeratePairs
&(db.block_names.id == 
db.block_data.block_names_id)).select(db.block_names.block_name, 
db.block_data.ALL)
  File "/.../web2py/gluon/dal.py", line 7578, in select
return adapter.select(self.query,fields,attributes)
  File "/.../web2py/gluon/dal.py", line 1315, in select
rows = response(sql)
  File "/.../web2py/gluon/dal.py", line 1305, in response
self.execute(sql)
  File "/.../web2py/gluon/dal.py", line 1392, in execute
return self.log_execute(*a, **b)
  File "/.../web2py/gluon/dal.py", line 1386, in log_execute
ret = self.cursor.execute(*a, **b)
ProgrammingError: operator does not exist: integer = character varying at 
character 309
HINT:  No operator matches the given name and argument type(s). You might 
need to add explicit type casts.

I am using latest 1.99.7 Web2py, latest 9.1.2 Postgres, and latest 2.4.4 
psycopg2 driver.

Any help is welcomed :-)

BR
Loreia


[web2py] Re: SQLFORM.factory Field2 depends on Field1

2012-04-27 Thread Massimo Di Pierro
IS_IN_SET(getFamilies(form.vars.Segment

should be

IS_IN_SET(getFamilies(request.vars.Segment

but I would not set this validator in models, I would set it in controller 
function, where needed.

On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>
> Okay, I want to make the second field of a SQLFORM.factory depend on what 
> is chosen in the first field...  something like this...
>
> form = SQLFORM.factory(
> Field('PN', requires=IS_NOT_EMPTY()),
> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
> Field('Family', 
> requires=IS_IN_SET(getFamilies(form.vars.Segment
> ...
>
> Of course I can't use form.vars.Segment until the form is submitted, so 
> how can I accomplish this?
>
> So that the field 'Family' takes the value of the field 'Segment', does a 
> calculation and returns the appropriate list of families.
>
> I'm super new to web programming, so I apologize in advance if this is a 
> dumb question.
>
>
>
>
>
On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>
> Okay, I want to make the second field of a SQLFORM.factory depend on what 
> is chosen in the first field...  something like this...
>
> form = SQLFORM.factory(
> Field('PN', requires=IS_NOT_EMPTY()),
> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
> Field('Family', 
> requires=IS_IN_SET(getFamilies(form.vars.Segment
> ...
>
> Of course I can't use form.vars.Segment until the form is submitted, so 
> how can I accomplish this?
>
> So that the field 'Family' takes the value of the field 'Segment', does a 
> calculation and returns the appropriate list of families.
>
> I'm super new to web programming, so I apologize in advance if this is a 
> dumb question.
>
>
>
>
>

[web2py] Re: crud.create causes an id problem

2012-04-27 Thread Massimo Di Pierro
Please open a ticket about this.

On Thursday, 26 April 2012 13:21:34 UTC-5, villas wrote:
>
> Just a thought...  if you are trying to create a new table which has a 
> 'bigint' id,  this may be incompatible if it references an existing table 
> which has an 'integer' id. 
>
> Regards,
> David
>


[web2py] Re: How can I combine Facebook login and regular login?

2012-04-27 Thread Massimo Di Pierro
Look into this:

/gluon/contrib/login_methods/extended_login_form.py 

On Thursday, 26 April 2012 23:30:34 UTC-5, Kenny wrote:
>
> So I think I successfully implemented Facebook login. However, I have a 
> problem combining with regular login.
>
> Because as the book stated, I did
>
> auth.settings.actions_disabled=['register','change_password','request_reset_password','profile']
>
> so I can't use regular register/login
>
> How can I combine them together? Thank you.
>


[web2py] Re: SQLFORM

2012-04-27 Thread Anthony
Look into the "formstyle" argument (you could try using "divs" or "ul", 
plus some CSS): http://web2py.com/books/default/chapter/29/7#SQLFORM. If 
that doesn't get you what you want, check out 
http://web2py.com/books/default/chapter/29/7#Custom-forms (form.custom.label, 
etc.).

Anthony

On Friday, April 27, 2012 3:43:02 AM UTC-4, Vibhor Purandare wrote:
>
>  I want to change position of Lables ;created in SQLFORM  ???
> Please Help
>


Re: [web2py] Re: Cookbook recipe for nginx/uwsgi woes

2012-04-27 Thread Bruce Wade
I have used this process to set up 3 servers now with uwsgi + nginx =
http://library.linode.com/web-servers/nginx/python-uwsgi/ubuntu-10.10-maverick

On Fri, Apr 27, 2012 at 1:16 AM, rif  wrote:

> I had the same issue and I solved by adding plugin python in the uwsgi
> web2py configuration:
>
> 
> python
>   <--HERE
> 127.0.0.1:9001
> /home/www-data/web2py/
> 
> wsgihandler
> 
> 
>
> joi, 12 aprilie 2012, 09:23:39 UTC+3, Bruce Wade a scris:
>>
>> I am having the exact same problem with uwsgi
>>
>> 2012/04/12 06:16:49 [error] 9428#0: *1 upstream prematurely closed
>> connection while reading response header from upstream, client:
>> 108.172.101.4, server: 50.18.67.206, request: "GET / HTTP/1.1", upstream:
>> "uwsgi://127.0.0.1:9001", host: "50.18.67.206"
>>
>> I tested and I can get to my static files using nginx without a problem
>> so I know that isn't the issue.
>>
>> Thinking maybe sticking with apache is a better more stable solution?
>>
>> On Wed, Apr 11, 2012 at 2:05 PM, Michele Comitini 
>> <*
>> *> wrote:
>>
>>>  To handle static request using "alias" instead of "root" with regexp
>>> should work better
>>>
>>>
>>>  set $web2pyroot 
>>>
>>>
>>>location ~ ^/(.*)/static/(.*) {
>>> alias $web2pyroot/applications/$1/**static/$2;
>>>}
>>>
>>> mic
>>>
>>>
>>> Il 11 aprile 2012 18:23, pbreit <* **> ha
>>> scritto:
>>>
>>> > Looks like it is having trouble with a file in /static. This is how I
>>> serve
>>> > /static:
>>> >
>>> > location /static {
>>> > root /opt/web2py/applications/**myapp/;
>>> > }
>>> >
>>> > You may just need to add the appname to:
>>> > root  /home/www-data/web2py/**applications/
>>> >
>>> > Also, I don't know if you need that extra stuff on the location line.
>>>
>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com  -
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Re: ATTENTION before upgrading to trunk....

2012-04-27 Thread Bruce Wade
Guess you haven't worked on really popular sites ;)

On Fri, Apr 27, 2012 at 4:20 AM, stefaan  wrote:

>
>> An inner voice is saying:  "Can't the person who has breached that limit
>> be asked to create his own tables instead of giving all the rest of us the
>> inconvenience?".
>>
>
> An inner voice is saying: "640K [rows] ought to be enough for anybody" ?
> ;)
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Postgres error

2012-04-27 Thread Bruce Wade
(db.block_names.id == db.block_data.block_names_id)
db.block_names.id is an integer
db.block_data.block_names_id is a character varying.

update db.define_tables("block_data",
 Field("block_names_id", "integer", default=None)

On Fri, Apr 27, 2012 at 5:00 AM, Loreia  wrote:

> Hi,
>
> I define two tables in my application as:
>
> db.define_table( "block_names"
>, Field("block_name" ,default=None)
> )
>
> db.define_table( "block_data"
>, Field("block_names_id" ,default=None)
>, Field("product_number" ,default=None)
>, Field("product_revision"   ,default=None)
>, Field("product_path"   ,default=None)
>, Field("branch" ,default=None)
>, Field("bat_file_path"  ,default=None)
>, Field("toolbox",default=None)
> )
>
> I am trying to run following query:
> rows = db((db.block_names.id > 0)
>  &(db.block_names.id ==
> db.block_data.block_names_id)).select(db.block_names.block_name,
> db.block_data.ALL)
>
> And I get this error:
>   File ".../sqr_enumerate_pairs.py", line 77, in EnumeratePairs
> &(db.block_names.id ==
> db.block_data.block_names_id)).select(db.block_names.block_name,
> db.block_data.ALL)
>   File "/.../web2py/gluon/dal.py", line 7578, in select
> return adapter.select(self.query,fields,attributes)
>   File "/.../web2py/gluon/dal.py", line 1315, in select
> rows = response(sql)
>   File "/.../web2py/gluon/dal.py", line 1305, in response
> self.execute(sql)
>   File "/.../web2py/gluon/dal.py", line 1392, in execute
> return self.log_execute(*a, **b)
>   File "/.../web2py/gluon/dal.py", line 1386, in log_execute
> ret = self.cursor.execute(*a, **b)
> ProgrammingError: operator does not exist: integer = character varying at
> character 309
> HINT:  No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>
> I am using latest 1.99.7 Web2py, latest 9.1.2 Postgres, and latest 2.4.4
> psycopg2 driver.
>
> Any help is welcomed :-)
>
> BR
> Loreia
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Re: Cookies and Sessions

2012-04-27 Thread Yago
I think i  screw up answering because i don't see it, what i wanted to do 
basically was to avoid registration, so i could put the name and some data 
in the cookies and use it to identify him and even retrieve some data(how 
many times they connected to me) and things like that. I know they could 
delete their cookies but i don`t really care about it, so the main purpose 
was identification and learning. So know that i was recommended not to use 
cookies i'd like to know if i could do this with sessions.
*
*
If you don't use session.forget() sessions aren't deleted? 

> as long as the code is executed within the same session by the same user 
> (provided the user has not deleted session cookies and the session did not 
> expire).

 
that's what the book says and what does it mean being in the same session 
if it isn't deleted?? sessions expire?? session cookies means that web2py 
stores sessions in cookies?  

But if sessions are not deleted and they have a unique 
id I could possibly use this to identify the user without using a login! 

Thanks, Yago


[web2py] Re: Cookies and Sessions

2012-04-27 Thread Anthony

>
> I'm quite new to web2py and a noob at it. I've been struggling with the 
> difference between cookies and sessions. For what I've read the main 
> difference is that you store cookies on the clients side and sessions on 
> the server side


Yes, cookies are sent back and forth between the server and the client. You 
create a cookie on the server and it gets sent to the client. The client 
will then send it back with every request (until it expires). Although 
sessions are stored on the server (in files by default, though they can 
also be stored in the database), cookies are also involved in the 
implementation of sessions. In order to associate a particular server-side 
session with a particular client, a session cookie is passed between the 
client and server with a unique key that identifies the session on the 
server.
 

> also that cookies expire and sessions get erased when you close the 
> browser! 


Technically, the server-side session does not get erased when you close the 
browser (though you can explicitly clean up old session files using a 
script like this one: 
http://code.google.com/p/web2py/source/browse/scripts/sessions2trash.py). 
However, the session cookie on the browser does get deleted by the browser 
when you close the browser. Any cookie that does not have an expiration set 
is considered a session cookie by the browser and deleted when the browser 
quits. As a result, even though the old session file may remain on the 
server, it is no longer accessible once the associated cookie is no longer 
being sent back by the browser.
 

> But I have plenty of questions about them and how to use them(in web2py)
>
> *1. What can you store in them? *
> *I've seen till now that you can store a dict and lists 
> in a session, and I'm having trouble using cookies but I guess text is the 
> only thing you can store...  *
>

Technically, text is the only thing you can store in either, but non-string 
objects can be pickled and unpickled for storage in both sessions and 
cookies. So, you should be able to store dicts and lists in sessions and 
cookies -- web2py will handle the pickling and unpickling. More complex 
objects cannot be stored unless you define special pickling and unpickling 
functions for them (which is the case for Row and Rows objects, for 
example).
 

> *
> *
> *2. When are they deleted?*
>*According to what I googled cookies expire after a 
> certain time(I've seen you can set this in w2p) and sessions are deleted 
> when you exit the browser*
>

Answered above. 

 

> **
> *3. Could you use cookies as temporary DB?*
> ***If I'm right and can only store text I guess this 
> would be complicated, but then the question is if you can modify the 
> expiring time so it never expires unless the user deletes it? *
> *I mean you could use it to store user statistics for 
> example? This is one of the things I want to implement but having trouble 
> doing it. Let me show you what I'm trying *
> *
> *
> *I first do this **
> def cookieCreate():
> 
> response.cookies['cookie_test'] = 1
> response.cookies['cookie_test']['expires'] = 24 * 3600
> response.cookies['cookie_test']['path'] = '/'
> then*
> *
>  if request.cookies.has_key('cookie_test'):
> value = request.cookies['cookie_test'].value
> response.cookies['cookie_prueba'] = str( 1 + int(value)) 
> #Shouldn't this update the cookie on the clients side?
> else: 
> cookieCreate()
> As you can see, I want to implement a sort of counter that doesn't get 
> deleted to develop some statistics later(how many games he played for 
> example), and don't want to have a DB yet ( I want to learn how to work 
> with cookies)*
>

Yes, the above should work, though I notice your last line references 
'cookie_prueba' -- perhaps you meant that to be 'cookie_test' (so it will 
increment the value of 'cookie_test' on each request). Try response.flash = 
response.cookies['cookie_test'].value, and on each page refresh you should 
see the flash message increment by one.

*
> *
> *4. Where are they stored?*
> *   **  I imagine cookies are stored where the browser 
> decides, then why the "path"? *
>

The "path" attribute tells the browser with which URL requests to send the 
cookie -- it refers to the URL path (i.e., the part of the URL after the 
domain). Setting the path to "/" tells the browser to send the cookie to 
all URLs within the domain (i.e., all paths). See 
http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Path. 
 

> *and while session exists where are they stored?*
>

By default in /applications/yourapp/sessions, but you can also store them 
in the database. See http://web2py.com/books/default/chapter/29/4#session.
 

> *
> *
> *5. Can you store a cookie in a session and viceversa?*
>

I suppose you could read the value of a cookie and then store it in the 
session (no

Re: [web2py] Cookies and Sessions

2012-04-27 Thread Anthony

>
> > *2. When are they deleted?* 
>
> When you do session.forget() 
>

session.forget() does not delete the session file -- it just tells web2py 
not to save any changes to the session during the current request.

Anthony 


Re: [web2py] Cookies and Sessions

2012-04-27 Thread Yago
That makes it all really clear, thank you so much Anthony. The browser 
deletes the session cookie when you close it, but there's still the server 
session. What happens to that? I mean when you open the browser again do 
you get assigned another session or do you 'reconnect' to the old one 
maintaining the id? if yes i could use that id as my login value to 
identify the user and if the answer is no, then why isn't it deleted from 
the folder?

Sry to be a pain with this just want to make sure I really get it!! ;b


[web2py] Re: SQLFORM.factory Field2 depends on Field1

2012-04-27 Thread cory n
This works, after I submit once, then my selection for FIELD1 appears in 
FIELD2.  I need it to operate before a submit though, so that once a 
"Segment" is selected, I can use that selection in the other dropdown boxes 
before a submit.

Thanks

Cory

On Friday, April 27, 2012 8:13:58 AM UTC-5, Massimo Di Pierro wrote:
>
> IS_IN_SET(getFamilies(form.vars.Segment
>
> should be
>
> IS_IN_SET(getFamilies(request.vars.Segment
>
> but I would not set this validator in models, I would set it in controller 
> function, where needed.
>
> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>>
>> Okay, I want to make the second field of a SQLFORM.factory depend on what 
>> is chosen in the first field...  something like this...
>>
>> form = SQLFORM.factory(
>> Field('PN', requires=IS_NOT_EMPTY()),
>> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
>> Field('Family', 
>> requires=IS_IN_SET(getFamilies(form.vars.Segment
>> ...
>>
>> Of course I can't use form.vars.Segment until the form is submitted, so 
>> how can I accomplish this?
>>
>> So that the field 'Family' takes the value of the field 'Segment', does a 
>> calculation and returns the appropriate list of families.
>>
>> I'm super new to web programming, so I apologize in advance if this is a 
>> dumb question.
>>
>>
>>
>>
>>
> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>>
>> Okay, I want to make the second field of a SQLFORM.factory depend on what 
>> is chosen in the first field...  something like this...
>>
>> form = SQLFORM.factory(
>> Field('PN', requires=IS_NOT_EMPTY()),
>> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
>> Field('Family', 
>> requires=IS_IN_SET(getFamilies(form.vars.Segment
>> ...
>>
>> Of course I can't use form.vars.Segment until the form is submitted, so 
>> how can I accomplish this?
>>
>> So that the field 'Family' takes the value of the field 'Segment', does a 
>> calculation and returns the appropriate list of families.
>>
>> I'm super new to web programming, so I apologize in advance if this is a 
>> dumb question.
>>
>>
>>
>>
>>

Re: [web2py] Re: ATTENTION before upgrading to trunk....

2012-04-27 Thread villas
On Friday, 27 April 2012 15:10:15 UTC+1, Bruce Wade wrote:
>
> Guess you haven't worked on really popular sites ;)
>
> LOL  hmm,  guess you're right.  When I go flying through that 2 billion 
recs barrier,  I'll be blessing those BIGINTs.  :-)



[web2py] Re: SQLFORM.factory Field2 depends on Field1

2012-04-27 Thread villas
You can do that on the client side using javascript.  The jQuery library is 
useful.  
Read the jQuery section of the book: 
http://www.web2py.com/books/default/chapter/29/11
And google for example on:  jquery cascading selects


On Friday, 27 April 2012 16:00:44 UTC+1, cory n wrote:
>
> This works, after I submit once, then my selection for FIELD1 appears in 
> FIELD2.  I need it to operate before a submit though, so that once a 
> "Segment" is selected, I can use that selection in the other dropdown boxes 
> before a submit.
>
> Thanks
>
> Cory
>
> On Friday, April 27, 2012 8:13:58 AM UTC-5, Massimo Di Pierro wrote:
>>
>> IS_IN_SET(getFamilies(form.vars.Segment
>>
>> should be
>>
>> IS_IN_SET(getFamilies(request.vars.Segment
>>
>> but I would not set this validator in models, I would set it in 
>> controller function, where needed.
>>
>> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>>>
>>> Okay, I want to make the second field of a SQLFORM.factory depend on 
>>> what is chosen in the first field...  something like this...
>>>
>>> form = SQLFORM.factory(
>>> Field('PN', requires=IS_NOT_EMPTY()),
>>> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
>>> Field('Family', 
>>> requires=IS_IN_SET(getFamilies(form.vars.Segment
>>> ...
>>>
>>> Of course I can't use form.vars.Segment until the form is submitted, so 
>>> how can I accomplish this?
>>>
>>> So that the field 'Family' takes the value of the field 'Segment', does 
>>> a calculation and returns the appropriate list of families.
>>>
>>> I'm super new to web programming, so I apologize in advance if this is a 
>>> dumb question.
>>>
>>>
>>>
>>>
>>>
>> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>>>
>>> Okay, I want to make the second field of a SQLFORM.factory depend on 
>>> what is chosen in the first field...  something like this...
>>>
>>> form = SQLFORM.factory(
>>> Field('PN', requires=IS_NOT_EMPTY()),
>>> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
>>> Field('Family', 
>>> requires=IS_IN_SET(getFamilies(form.vars.Segment
>>> ...
>>>
>>> Of course I can't use form.vars.Segment until the form is submitted, so 
>>> how can I accomplish this?
>>>
>>> So that the field 'Family' takes the value of the field 'Segment', does 
>>> a calculation and returns the appropriate list of families.
>>>
>>> I'm super new to web programming, so I apologize in advance if this is a 
>>> dumb question.
>>>
>>>
>>>
>>>
>>>

[web2py] Re: mailing with pgp

2012-04-27 Thread weheh
os.environ listing:
 

> LANG
>> TERM
>> SHELL
>> LESSCLOSE
>> XDG_SESSION_COOKIE
>> SHLVL
>> SSH_TTY
>> OLDPWD
>> GPGKEY
>> PWD
>> LESSOPEN
>> SSH_CLIENT
>> LOGNAME
>> USER
>> PATH
>> MAIL
>> LS_COLORS
>> HOME
>> _
>> SSH_CONNECTION
>>
>>

[web2py] Re: web2py how to change underscore to hypens in URL

2012-04-27 Thread villas
I guess you'll need to restart the server or re-load the routes in the 
Admin area.


On Thursday, 26 April 2012 20:36:33 UTC+1, nav010 wrote:
>
> Hey All,
>
> tried this by changing map_hyphen=true in routes.py, but the change is not 
> reflected.
>
> Anybody please let me know how can I see this change or is there any other 
> way to change underscores to hyphen in url.
>
> Thanks,
>


[web2py] Re: crud.create causes an id problem

2012-04-27 Thread Ross Peoples
I have created Issue 
777: http://code.google.com/p/web2py/issues/detail?id=777

On Friday, April 27, 2012 9:15:07 AM UTC-4, Massimo Di Pierro wrote:
>
> Please open a ticket about this.
>
> On Thursday, 26 April 2012 13:21:34 UTC-5, villas wrote:
>>
>> Just a thought...  if you are trying to create a new table which has a 
>> 'bigint' id,  this may be incompatible if it references an existing table 
>> which has an 'integer' id. 
>>
>> Regards,
>> David
>>
>

Re: [web2py] Re: Ubuntu and Python3

2012-04-27 Thread Ross Peoples
I would imagine that you would still have the same problem unless shared 
hosts figure out a way to make uWSGI easier to use.

I have given up on shared hosting. The price of a low-end VPS is just as 
low (and sometimes lower) as most shared hosting plans with MUCH better 
performance. I have played with shared hosting from multiple providers, and 
success really varies. I found myself spending hours getting it all set up, 
when I can set up a VPS the right way in about 15 minutes.

You can find really good deals on VPS providers on webhostingtalk.com, but 
I keep up with deals posted to lowendbox.com because they make sure the 
providers are reputable before posting their promotions. I personally have 
VPS instances from both ChicagoVPS and RethinkVPS and have been pretty 
happy. Basically, you can get root access to a web server for $7/month or 
less. They seem to handle traffic pretty well too for the price, but if you 
have a high traffic site, you would want something more expensive (and you 
wouldn't be using shared hosting to begin with).

On Thursday, April 26, 2012 12:22:09 PM UTC-4, sebastian wrote:
>
> just wondering if having web3py in python 3 will give us some problem with 
> some share hosting
>
> On Thu, Apr 26, 2012 at 2:52 PM, Johann Spies wrote:
>
>> That article says that Python 2.7 will still be part of Ubuntu so there 
>> should not be a problem.
>>
>> Regards
>> Johann
>>
>>
>> -- 
>> Because experiencing your loyal love is better than life itself, 
>> my lips will praise you.  (Psalm 63:3)
>>
>>  
>
>
> -- 
> Sebastian E. Ovide
>
>
>
>  

[web2py] is selective field keepvalues possible?

2012-04-27 Thread Richard Vézina
Hello,

I would like to keep last inserted values in form but not for every
fields... I try to set db.table.field.default=None, but it is not
working...

How may I do that?

Thanks

Richard


[web2py] book typo : Single paragraph should be split I think

2012-04-27 Thread Richard Vézina
Hello,

I think there is multiple paragraph in this paragraph :

keepvalues
keepvalues

The optional argument keepvalues tells web2py what to do when a form is
accepted and there is no redirection, so the same form is displayed again.
By default the form is cleared. If keepvalues is set to True, the form is
pre-populated with the previously inserted values. This is useful when you
have a form that is supposed to be used repeatedly to insert multiple
similar records. If the dbio argument is set to False, web2py will not
perform any DB insert/update after accepting form. If hideerror is set to
True and the form contains errors, these will not be displayed when the
form is rendered (it will be up to you to display them fromform.errors somehow.
The onvalidation argument is explained below.

I think it should be something like that :
keepvalues
keepvalues

The optional argument keepvalues tells web2py what to do when a form is
accepted and there is no redirection, so the same form is displayed again.
By default the form is cleared. If keepvalues is set to True, the form is
pre-populated with the previously inserted values. This is useful when you
have a form that is supposed to be used repeatedly to insert multiple
similar records.
dbio
If the dbio argument is set to False, web2py will not perform any DB
insert/update after accepting form.
hideerror
If hideerror is set to True and the form contains errors, these will not be
displayed when the form is rendered (it will be up to you to display them
fromform.errors somehow. The onvalidation argument is explained below.


Re: [web2py] is selective field keepvalues possible?

2012-04-27 Thread Massimo Di Pierro
db.table.fieldname.default=request.vars.fieldname

On Friday, 27 April 2012 12:38:04 UTC-5, Richard wrote:
>
> Hello,
>
> I would like to keep last inserted values in form but not for every 
> fields... I try to set db.table.field.default=None, but it is not 
> working... 
>
> How may I do that?
>
> Thanks
>
> Richard
>


[web2py] How to manage redundant files for application version control

2012-04-27 Thread mrtn

Hi,

I'm using Git (Github) to manage my app development in Web2py. I noticed 
that each time when I make a commit lots of runtime generated files such as 
error tickets, logs, db files, etc are picked up by Git, which probably 
shouldn't be checked in as part of the codebase. These files exist at both 
/web2py and /web2py/applications/myapp level, and make extra work of of 
picking them out when committing.

I wonder how other Web2py developers manage their code (especially using 
Git), and how you guys deal with such unnecessary files. Thanks. 


Re: [web2py] How to manage redundant files for application version control

2012-04-27 Thread Jonathan Lundell
On Apr 27, 2012, at 11:08 AM, mrtn wrote:
> I'm using Git (Github) to manage my app development in Web2py. I noticed that 
> each time when I make a commit lots of runtime generated files such as error 
> tickets, logs, db files, etc are picked up by Git, which probably shouldn't 
> be checked in as part of the codebase. These files exist at both /web2py and 
> /web2py/applications/myapp level, and make extra work of of picking them out 
> when committing.
> 
> I wonder how other Web2py developers manage their code (especially using 
> Git), and how you guys deal with such unnecessary files. Thanks. 

.gitignore is your friend.

Re: [web2py] is selective field keepvalues possible?

2012-04-27 Thread Richard Vézina
I mean, I set keepvalues=True, then set default like this :
db.table.fieldname.default=None

What you suggest "db.table.fieldname.default=request.vars.fieldname" is to
not using the keepvalues (keepvalues=False)...

Works fine!

Thanks

On Fri, Apr 27, 2012 at 1:57 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> db.table.fieldname.default=request.vars.fieldname
>
>
> On Friday, 27 April 2012 12:38:04 UTC-5, Richard wrote:
>>
>> Hello,
>>
>> I would like to keep last inserted values in form but not for every
>> fields... I try to set db.table.field.default=None, but it is not
>> working...
>>
>> How may I do that?
>>
>> Thanks
>>
>> Richard
>>
>


[web2py] PyCon Argentina 2012: Scientific Meetings - Call for Sponsors and Researchers

2012-04-27 Thread Mariano Reingart
PyCon Argentina 2012 is applying for Scientific Meetings official
government support, with extended deadline 05-15-2012:

http://www.agencia.gob.ar/spip.php?page=convocatorias_articulo&mostrar=1583

If you are sponsor or researcher, please contact us, we need to
line-up speakers and estimate sponsorship in advance.

For a brochure, including organizer profile and contacted
international speakers, please see:

http://ar.pycon.org/2012/static/docs/pyconar2012_brief.pdf

More information about sponsorship plans:

http://ar.pycon.org/2012/sponsors/prospectus?lang=en

Call for proposals and Student Paper Contest will be sent shortly.
Submission is open:

http://ar.pycon.org/2012/conference/proposals?lang=en

PyCon Argentina is the largest annual worldwide community gathering of
Spanish-speaking users and developers of the Python programming
language.

PyConAr 2012 is expecting 500 attendees (similar to 2009 also in
Buenos Aires), and was sponsored by several International Corporations
like Google, Canonical, GitHub and local python companies like MSA
Group, Core Security, Machinalis, Lambda Sistemas, Avatura, Teracore,
log_n, and many others.

This year preconfirmed international speakers includes Massimo Di
Pierro (web2py & fermilqcd) and Andrea Gavana (wx.lib.agw and 2d/3d
visualization).

PyConAr previous international speakers include Jacob Kaplan Moss
(Django), Wesley Chung and Collin Winter (Google), Steve Holden
(Python Software Fundation), Maciej Fijalkowski (PyPy Project) Jim
Fulton (Zope Corporation) and Alan Runyan (Plone Fundation).

Also there have been several regional guest attending to previous
conferences, including people from Brazil, Peru, Chile and Uruguay.

PyCon Argentina  is a community conference organized by volunteers of
Python Argentina community.
Conference language is Spanish and English.
Admittance is free of charge.

Best regards,

Mariano Reingart
PyCon Argentina 2012 Chair
http://ar.pycon.org


[web2py] Re: SQLFORM.factory Field2 depends on Field1

2012-04-27 Thread Anthony
See 
http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
.

On Friday, April 27, 2012 11:00:44 AM UTC-4, cory n wrote:
>
> This works, after I submit once, then my selection for FIELD1 appears in 
> FIELD2.  I need it to operate before a submit though, so that once a 
> "Segment" is selected, I can use that selection in the other dropdown boxes 
> before a submit.
>
> Thanks
>
> Cory
>
> On Friday, April 27, 2012 8:13:58 AM UTC-5, Massimo Di Pierro wrote:
>>
>> IS_IN_SET(getFamilies(form.vars.Segment
>>
>> should be
>>
>> IS_IN_SET(getFamilies(request.vars.Segment
>>
>> but I would not set this validator in models, I would set it in 
>> controller function, where needed.
>>
>> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>>>
>>> Okay, I want to make the second field of a SQLFORM.factory depend on 
>>> what is chosen in the first field...  something like this...
>>>
>>> form = SQLFORM.factory(
>>> Field('PN', requires=IS_NOT_EMPTY()),
>>> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
>>> Field('Family', 
>>> requires=IS_IN_SET(getFamilies(form.vars.Segment
>>> ...
>>>
>>> Of course I can't use form.vars.Segment until the form is submitted, so 
>>> how can I accomplish this?
>>>
>>> So that the field 'Family' takes the value of the field 'Segment', does 
>>> a calculation and returns the appropriate list of families.
>>>
>>> I'm super new to web programming, so I apologize in advance if this is a 
>>> dumb question.
>>>
>>>
>>>
>>>
>>>
>> On Thursday, 26 April 2012 12:54:26 UTC-5, cory n wrote:
>>>
>>> Okay, I want to make the second field of a SQLFORM.factory depend on 
>>> what is chosen in the first field...  something like this...
>>>
>>> form = SQLFORM.factory(
>>> Field('PN', requires=IS_NOT_EMPTY()),
>>> Field('Segment', requires=IS_IN_SET(['Segment1', 'Segment2'])),
>>> Field('Family', 
>>> requires=IS_IN_SET(getFamilies(form.vars.Segment
>>> ...
>>>
>>> Of course I can't use form.vars.Segment until the form is submitted, so 
>>> how can I accomplish this?
>>>
>>> So that the field 'Family' takes the value of the field 'Segment', does 
>>> a calculation and returns the appropriate list of families.
>>>
>>> I'm super new to web programming, so I apologize in advance if this is a 
>>> dumb question.
>>>
>>>
>>>
>>>
>>>

Re: [web2py] Cookies and Sessions

2012-04-27 Thread Derek
Session cookies would be deleted after browser close, so you'd be assigned 
a new session. The files are not deleted because the server has no way of 
knowing if the person has restarted their browser or not.

On Friday, April 27, 2012 7:40:55 AM UTC-7, Yago wrote:
>
> That makes it all really clear, thank you so much Anthony. The browser 
> deletes the session cookie when you close it, but there's still the server 
> session. What happens to that? I mean when you open the browser again do 
> you get assigned another session or do you 'reconnect' to the old one 
> maintaining the id? if yes i could use that id as my login value to 
> identify the user and if the answer is no, then why isn't it deleted from 
> the folder?
>
> Sry to be a pain with this just want to make sure I really get it!! ;b
>


Re: [web2py] Re: Creating a table or a an entry in a DB from index()

2012-04-27 Thread Anthony
That's a good point. Note, you can use conditional models, so models that 
are only needed by a particular controller or function are only defined on 
requests to that controller/function. You can also define models in a class 
or function in a module and only import and define the models specifically 
when they are needed. For smaller apps with few models, running on every 
request shouldn't add too much overhead.

Note, in some cases, some parts of the model may be request specific (e.g., 
a default set to request.now, or a validator using an item in request.vars 
as an argument), so it can be helpful to generate the definition at the 
time of the request.

Anthony

On Friday, April 27, 2012 4:27:21 AM UTC-4, Khalil KHAMLICHI wrote:
>
> IMHO, models should be read only once (start), and then upon admin wish by 
> using some sort of reload, I believe this kind of realtime configuration of 
> web2py comes at a huge cost of performance and no percieved benefets, here 
> is a  real world example, I have applications running for years now, the 
> code never changed, but still those applications at each and every request 
> read model file and process it for each one of the thousand of requests per 
> day. 
> I might be wrong.
>
>>  

[web2py] date type field issue with db.tablename.fieldname.default = request.vars.fieldname

2012-04-27 Thread Richard Vézina
Hello,

I get :  'str' object has no attribute 'year'

Try to solve it like this without success :

db[request.args(0)].test_date.default =
datetime.date(*tuple(request.vars.test_date.split('-')))

Then it ask for integer...

Richard


Re: [web2py] How to manage redundant files for application version control

2012-04-27 Thread Richard Vézina
It a mercurial example, but you have the list of folder to ignore :

http://www.web2pyslices.com/slice/show/1348/version-control-development-vs-production

Richard

On Fri, Apr 27, 2012 at 2:21 PM, Jonathan Lundell wrote:

> On Apr 27, 2012, at 11:08 AM, mrtn wrote:
>
> I'm using Git (Github) to manage my app development in Web2py. I noticed
> that each time when I make a commit lots of runtime generated files such as
> error tickets, logs, db files, etc are picked up by Git, which probably
> shouldn't be checked in as part of the codebase. These files exist at both
> /web2py and /web2py/applications/myapp level, and make extra work of of
> picking them out when committing.
>
> I wonder how other Web2py developers manage their code (especially using
> Git), and how you guys deal with such unnecessary files. Thanks.
>
>
> .gitignore is your friend.
>


Re: [web2py] date type field issue with db.tablename.fieldname.default = request.vars.fieldname

2012-04-27 Thread Richard Vézina
Solved : datetime.datetime.strptime(request.vars.test_date,
'%Y-%m-%d').date()

On Fri, Apr 27, 2012 at 3:09 PM, Richard Vézina  wrote:

> Hello,
>
> I get :  'str' object has no attribute 'year'
>
> Try to solve it like this without success :
>
> db[request.args(0)].test_date.default =
> datetime.date(*tuple(request.vars.test_date.split('-')))
>
> Then it ask for integer...
>
> Richard
>


[web2py] Re: Postgres error

2012-04-27 Thread Cliff
Field('block_names_id', db.block_names, requires=IS_EMPTY_OR(
  IS_IN_DB(db, 'block_names.id', '%(block_name)s'))
)

On Friday, April 27, 2012 8:00:34 AM UTC-4, Loreia wrote:
>
> Hi,
>
> I define two tables in my application as:
>
> db.define_table( "block_names"
>, Field("block_name" ,default=None)
> )
>
> db.define_table( "block_data"
>, Field("block_names_id" ,default=None)
>, Field("product_number" ,default=None)
>, Field("product_revision"   ,default=None)
>, Field("product_path"   ,default=None)
>, Field("branch" ,default=None)
>, Field("bat_file_path"  ,default=None)
>, Field("toolbox",default=None)
> )
>
> I am trying to run following query:
> rows = db((db.block_names.id > 0)
>  &(db.block_names.id == 
> db.block_data.block_names_id)).select(db.block_names.block_name, 
> db.block_data.ALL)
>
> And I get this error:
>   File ".../sqr_enumerate_pairs.py", line 77, in EnumeratePairs
> &(db.block_names.id == 
> db.block_data.block_names_id)).select(db.block_names.block_name, 
> db.block_data.ALL)
>   File "/.../web2py/gluon/dal.py", line 7578, in select
> return adapter.select(self.query,fields,attributes)
>   File "/.../web2py/gluon/dal.py", line 1315, in select
> rows = response(sql)
>   File "/.../web2py/gluon/dal.py", line 1305, in response
> self.execute(sql)
>   File "/.../web2py/gluon/dal.py", line 1392, in execute
> return self.log_execute(*a, **b)
>   File "/.../web2py/gluon/dal.py", line 1386, in log_execute
> ret = self.cursor.execute(*a, **b)
> ProgrammingError: operator does not exist: integer = character varying at 
> character 309
> HINT:  No operator matches the given name and argument type(s). You might 
> need to add explicit type casts.
>
> I am using latest 1.99.7 Web2py, latest 9.1.2 Postgres, and latest 2.4.4 
> psycopg2 driver.
>
> Any help is welcomed :-)
>
> BR
> Loreia
>


[web2py] Re: Add conditional sub-menu

2012-04-27 Thread Cliff
Sorry I didn't see this sooner.

I think all your menu items will want that empty list, and I see some do 
not.

Also I am confused about how a menu script could cause a dal to raise an 
exception.  Maybe somebody with a better knowledge of the internals will 
chime in here.

On Wednesday, April 25, 2012 9:17:46 AM UTC-4, Omi Chiba wrote:
>
> Thanks again ! I came back from vacation and tried the code but I got 
> different error...
>
>  File "C:\web2py\gluon\dal.py", line 1386, in log_execute
> ret = self.cursor.execute(*a, **b)
> ProgrammingError: The cursor's connection has been closed.
>
>
>
> sub_menu = [('Admin',  False,  URL('admin'), []), ] # Added empty list
>
> response.menu = [('Home', False, URL('home','default','index'), []),
> (SPAN('Price List',_style='color:yellow'), True, 
> URL('pricelist','default','index'), 
> [('Guideline',  False,  URL('pricelist','default','guideline')),
>  ('Multiplier Tables',  False, 
>  URL('pricelist','default','multitable')),
>  ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
>  (sub_menu),
> ])]
>
>
>
> On Sunday, April 15, 2012 9:52:01 PM UTC-5, Cliff wrote:
>>
>> Omi,
>>
>> Sorry, my bad.  Been away.
>>
>> Should be:
>> sub_menu = [('Admin',  False,  URL('admin'), []), ] # Added empty list
>>
>> On Thursday, April 12, 2012 9:43:39 AM UTC-4, Omi Chiba wrote:
>>>
>>> Cliff, 
>>>
>>> Thank you for sharing code but now I got a different error. Maybe it 
>>> cannot understand sub_menu contains three parameters..
>>>
>>> Traceback (most recent call last):
>>>   File "C:\web2py\gluon\restricted.py", line 205, in restricted
>>> exec ccode in environment
>>>   File "C:\web2py\applications\home\views\default/index.html", line 64, 
>>> in 
>>>   File "C:\web2py\gluon\globals.py", line 182, in write
>>> self.body.write(xmlescape(data))
>>>   File "C:\web2py\gluon\html.py", line 114, in xmlescape
>>> return data.xml()
>>>   File "C:\web2py\gluon\html.py", line 2146, in xml
>>> return self.serialize(self.data, 0).xml()
>>>   File "C:\web2py\gluon\html.py", line 2121, in serialize
>>> li.append(self.serialize(item[3], level+1))
>>>   File "C:\web2py\gluon\html.py", line 2109, in serialize
>>> (name, active, link) = item[:3]
>>> ValueError: need more than 0 values to unpack
>>>
>>> On Wednesday, April 11, 2012 11:00:30 PM UTC-5, Cliff wrote:

 I have something like this working:

 sub_menu = []
 if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
 sub_menu = [('Admin',  False,  URL('admin')), ]
 response.menu = [('Home', False, URL('home','default','index'), []),
 (SPAN('Price List',_style='color:yellow'), True, 
 URL('pricelist','default','index'), 
 [('Guideline',  False,  URL('pricelist','default','guideline')),
  ('Multiplier Tables',  False, 
  URL('pricelist','default','multitable')),
  ('Cut Charge Tables',  False, 
  URL('pricelist','default','cuttable')),
  (sub_menu),
 ])]

 On Wednesday, April 11, 2012 12:24:29 PM UTC-4, Omi Chiba wrote:
>
> The following menu works. It's add "Admin" menu next to "Price List" 
> if the user has role "admin". Now, I want to add the "Admin" menu as 
> sub-menu of "Price List" where it's right after the "Cut Charge Tables". 
> How can I do this ?
>
> response.menu = [('Home', False, URL('home','default','index'), []),
> (SPAN('Price List',_style='color:yellow'), True, 
> URL('pricelist','default','index'), 
> [('Guideline',  False,  URL('pricelist','default','guideline')),
>  ('Multiplier Tables',  False, 
>  URL('pricelist','default','multitable')),
>  ('Cut Charge Tables',  False, 
>  URL('pricelist','default','cuttable')),
> ])]
>
> if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
> response.menu += [('Admin',  False,  URL('admin')), ]
>


[web2py] Re: Cookies and Sessions

2012-04-27 Thread Anthony

>
> Technically, the server-side session does not get erased when you close 
> the browser (though you can explicitly clean up old session files using a 
> script like this one: 
> http://code.google.com/p/web2py/source/browse/scripts/sessions2trash.py). 
> However, the session cookie on the browser does get deleted by the browser 
> when you close the browser.
>

I should note there is one exception to the session cookie being deleted 
upon closing the browser. If you are using Auth and set 
auth.settings.remember_me_form = True, upon login with the "Remember me" 
option checked, it will set a 30 day expiration on the session cookie (so, 
from the browser's perspective, it is technically no longer a "session" 
cookie). In that case, the session will survive across multiple browser 
sessions.

Anthony


[web2py] Re: mailing with pgp

2012-04-27 Thread szimszon
What distrib is this?
What is the content of GPGKEY?

The list is from python shell or from web2py?

2012. április 27., péntek 17:34:06 UTC+2 időpontban weheh a következőt írta:
>
> os.environ listing:
>  
>
>> LANG
>>> TERM
>>> SHELL
>>> LESSCLOSE
>>> XDG_SESSION_COOKIE
>>> SHLVL
>>> SSH_TTY
>>> OLDPWD
>>> GPGKEY
>>> PWD
>>> LESSOPEN
>>> SSH_CLIENT
>>> LOGNAME
>>> USER
>>> PATH
>>> MAIL
>>> LS_COLORS
>>> HOME
>>> _
>>> SSH_CONNECTION
>>>
>>>

[web2py] How to make an AJAX crawlable app

2012-04-27 Thread Alexander Cabezas
Hi,

How can I make a AJAX crawlable app with web2py?
https://developers.google.com/webmasters/ajax-crawling/?hl=es-ES

Re: [web2py] Cookies and Sessions

2012-04-27 Thread Derek
Oh, one more thing - if you want to delete the sessions, errors, and 
caches, click the 'clean' button in admin.

On Friday, April 27, 2012 7:40:55 AM UTC-7, Yago wrote:
>
> That makes it all really clear, thank you so much Anthony. The browser 
> deletes the session cookie when you close it, but there's still the server 
> session. What happens to that? I mean when you open the browser again do 
> you get assigned another session or do you 'reconnect' to the old one 
> maintaining the id? if yes i could use that id as my login value to 
> identify the user and if the answer is no, then why isn't it deleted from 
> the folder?
>
> Sry to be a pain with this just want to make sure I really get it!! ;b
>


[web2py] Re: How to make an AJAX crawlable app

2012-04-27 Thread Derek
Read the instructions provided by google?


On Friday, April 27, 2012 2:11:32 PM UTC-7, Alexander Cabezas wrote:
>
> Hi,
>
> How can I make a AJAX crawlable app with web2py?
> https://developers.google.com/webmasters/ajax-crawling/?hl=es-ES



Re: [web2py] Re: How to make an AJAX crawlable app

2012-04-27 Thread Khalil KHAMLICHI
Its all explained in there,


Re: [web2py] Cookies and Sessions

2012-04-27 Thread Anthony

>
> Oh, one more thing - if you want to delete the sessions, errors, and 
> caches, click the 'clean' button in admin.
>

That's useful if you want to pack the application, but you may not want to 
do that on production, as you might delete active sessions, errors that you 
haven't viewed yet, etc. To remove expired sessions, it might be better to 
run a background task like 
http://code.google.com/p/web2py/source/browse/scripts/sessions2trash.py.

Anthony