Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread Ivo
黄祥 you were right!
I fixed the issue just by copy pasting your first solution.
Very stange as I tries a almost identical solution that failed.
I tried something like:
edit_in_form = 'edit' in request.args
db.product.price.readable = db.product.price.writable = not edit_in_form

your second solution fails though I think it's because the request.args[-3] 
== 'edit' is always false and edit is not contained in de normal url it's 
only [-3] after you click the edit button. edit doesn't exist until then.

the thing I don't understand is why it errors out on me. it should just 
pass it when the condition is False.

At least I got it to work thank you so much! 

On Wednesday, December 4, 2013 1:11:25 AM UTC+1, 黄祥 wrote:
>
> App/default/product/edit/(record id)?(hmac)
>>
>
> if my logic is correct the edit is args so :
> edit_in_form = 'edit' in request.args
> or
> edit_in_form = request.args[-3] == 'edit'
> should work
>
> are you sure? i've tested right now, both is work in mine. tested in 
> web2py 2.8.2 windows binary on windows 7.
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Spawning a thread or a process for a long-running task [urgent!]

2013-12-03 Thread Yassen D.

On Monday, December 2, 2013 6:20:54 PM UTC+2, Massimo Di Pierro wrote:
>
> The scheduler should do what you need. You can start many workers to 
> manage the load
>
>>
>>
Thanks, Massimo! I upgraded to 2.8.2 with minor issues (MySQL date fields 
seem to have been mapped to strings and now to datetime objects).

I now experiment with the scheduler but the lowest interval I get between 
task re-runs is about 15 seconds which is not ideal for this use case. Is 
it possible to lower it even further, to about 5 seconds?

Thanks again!
YD

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Error in using the web2py.app.dataspreadsheets.w2p

2013-12-03 Thread P T
I am using Web2py 2.8.2 source and installed installed the app 
 web2py.app.dataspreadsheets.w2p from 
https://code.google.com/p/web2py/issues/detail?id=860#c1 and getting the 
following errors:

1) Cannot import module 'simplejson'

Ticket ID
 127.0.0.1.2013-12-03.23-17-52.b5368c20-df03-4a22-b20e-35dab70c9eb0
  Cannot import module 'simplejson'
 Version
 web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
 Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)


This is resolved by changing the line 4 in default.py from "import 
simplejson" to "from gluon.contrib import simplejson"

With this I am able to access all pages except for database driven pages, 
which generate the following error.

2) global name '_class' is not defined

Ticket ID
127.0.0.1.2013-12-03.23-21-14.e61d83f2-af1b-4d39-88cf-59909da11f56

 global name '_class' is not defined

Version
web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
Traceback (most recent call last):
  File "C:\web2py-src\gluon\restricted.py", line 217, in restricted
exec ccode in environment
  File 
"C:\web2py-src\applications\SpreadSheet\views\default/database_first.html", 
line 119, in 
  File "C:\web2py-src\gluon\globals.py", line 381, in write
self.body.write(xmlescape(data))
  File "C:\web2py-src\gluon\html.py", line 120, in xmlescape
return data.xml()
  File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 873, in xml
return self.sheet().xml()
  File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 862, in sheet
attributes["_class"]}))
NameError: global name '_class' is not defined

Can somebody help me to fix this?

Thanks,
PT

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-03 Thread Jayadevan M
Great. Thank you Massimo.

On Wednesday, December 4, 2013 12:38:54 AM UTC+5:30, Gael Princivalle wrote:
>
> Thanks a lot Massimo, I'm gone watch all 13 hours !
>
> Il giorno martedì 3 dicembre 2013 07:34:18 UTC+1, Massimo Di Pierro ha 
> scritto:
>>
>> Hello everybody,
>>
>> As you know I teach a certification program about web development with 
>> Python and I use web2py. 
>> I posted my most recent classes online:
>>
>> https://vimeo.com/75499986
>> https://vimeo.com/76047107
>> https://vimeo.com/76608898
>> https://vimeo.com/77179700
>> https://vimeo.com/77654974
>>
>> It is about of 13 hours of web2py lessons and coding.
>> Please join me in thanking the students who enrolled in the program and 
>> supported these classes.
>>
>> Massimo
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] After upgrade to 2.8.2: foreign key constraint failed

2013-12-03 Thread Scott Hunter
I have a site which, after upgrading to 2.8.2 (and clearing out the 
sessions), when I try update a record via a smartgrid or via admin, I get 
the error in the title.  I tried the same action on the copy of the site I 
had made just before upgrading, without any problems.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread Dave S

On Tuesday, December 3, 2013 3:52:12 PM UTC-8, Ivo wrote:
>
> I tried the sugested methods prior to posting because I came across a post 
> which had that solution in it. It doesn't throw the error, but ignores it 
> totally.
> I think the issue is because the url of the form is 
> App/default/product/
> And the edit function creates a url like
> App/default/product/edit/(record id)?(hmac)
>
> I'm not quite sure how to get the diagnostic print/logs.
> I'm kind of new to w2p and py in general
>

I have to study the logging stuff myself, but using prints depends on 
whether you've got a console or not.
I'm running on Rocket (the default packaging for Web2Py) from an ordinary 
terminal instance (hey, I'm just doing an internal tool), and a print 
statement in my controller function will go  to the web2py console, which 
is the terminal instance.

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread 黄祥

>
> App/default/product/edit/(record id)?(hmac)
>

if my logic is correct the edit is args so :
edit_in_form = 'edit' in request.args
or
edit_in_form = request.args[-3] == 'edit'
should work

are you sure? i've tested right now, both is work in mine. tested in web2py 
2.8.2 windows binary on windows 7.

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: one to many tables in views

2013-12-03 Thread Jesse Ferguson
I had tried that exact if statement however I did not add a second {{pass}} 
!!! thank you for having me take a look at that again, I knew it was 
something small I was overlooking.

On Tuesday, December 3, 2013 9:59:03 AM UTC-8, EW wrote:
>
> The logic you have currently loops through and creates rows for all 
> tcinputs for each timecard and that is why they are all the same.
>  
> I can think of 2 solutions:  
> 1) Keep your queries the same but add an if statement to determine which 
> of the tcinputs apply:
>  
>  {{for timecard_entry in tcinputs:}} 
> 
> 
>  
> {{if timecard_entry.timecard==timecard.id:}} 
> 
> 
> 
> 
> {{=timecard_entry.company.name}}etc 
> 
> 
> 
> 
> {{pass}} 
> 
> 
> 
> {{pass}}
>  
> 2) Make one query in the controller with something like tcrows = 
> db(db.timecard_entry.timecard==db.timecard.id
> ).select(orderby=~db.timecard.tc_date)
>  
> But then the code in the view is a little more complicated--you would need 
> to check for when you reach a "new" timecard so that you know when to 
> end/create your tables.  Also note that if you used this query, it contains 
> fields from both tables so to access the variables you need to specify the 
> tablename e.g. 
>  {{for t in tcrows:}} 
> {{=A(t.timecard.employee.fname, etc, etc
> {{=t.timecard_entry.company.name}}, etc, etc
> {{pass}}
>
>
> On Monday, December 2, 2013 9:20:38 PM UTC-8, Jesse Ferguson wrote:
>
>>  I have two tables set up and i want to show the TimeCard with all the 
>> entries for said time card however im unsure of how to create such a view...
>>
>> CONTOLLER:
>>
>> def timecard_index():
>> tcrows =db(db.timecard).select(orderby=~db.timecard.tc_date)
>> tcinputs 
>> =db(db.timecard_entry).select(orderby=db.timecard_entry.timecard)
>> return locals()
>>
>> MODEL:
>>
>> db.define_table('timecard',
>> Field('tc_date','date'),
>> Field('employee', 'reference 
>> employee',requires=IS_IN_DB(db,'employee.id','%(fname)s %(lname)s')),
>> Field('myid', unique=True, compute=lambda r: str(r.tc_date) 
>> + str(r.employee))
>> )
>>
>> db.define_table('timecard_entry',
>> Field('timecard', 'reference timecard', readable=False, 
>> writable=False,),
>> Field('company', 'reference company', label='Company'),
>> Field('tc_start', 'time', 
>> requires=[IS_TIME(),IS_NOT_EMPTY()], label='Start'),
>> Field('tc_stop', 'time', 
>> requires=[IS_TIME(),IS_NOT_EMPTY()], label='Stop'),
>> Field('st' , 'double', label='ST', default=0.0),
>> Field('ot' , 'double', label='OT', default=0.0),
>> Field('dt' , 'double', label='DT', default=0.0),
>> Field('tc_classification' ,'string', label='Classification'),
>> auth.signature)
>>
>> VIEW:
>>
>> {{for timecard in tcrows:}}
>> 
>> 
>> {{=A(timecard.employee.fname +' 
>> '+timecard.employee.lname,_href=URL('view_timecard',args=timecard.id))}} 
>> {{=timecard.tc_date.strftime("%m.%d.%Y")}}
>> {{for timecard_entry in tcinputs:}}
>> 
>> {{=timecard_entry.company.name}}{{=timecard_entry.tc_start}}{{=timecard_entry.tc_stop}}{{=timecard_entry.st}}{{=timecard_entry.ot}}{{=timecard_entry.dt}}{{=timecard_entry.tc_classification}}
>> {{pass}}
>>  
>> 
>> {{pass}}
>>
>> This results in the same entries being put into each timecard (not the 
>> correct ones), I know I'm missing something in the logic but I'm too green 
>> of a programmer to see it... Im also not sure if im making the correct 
>> query for tcinputs...
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py

[web2py] SQLFORM.grid: CSV Export leads to empty file when using joined fields in query

2013-12-03 Thread Friedrich Weber
Hi there,

First: I already tried to post this last week, but it doesn't seem like it 
worked. Apologies if this is a duplicate!

I stumbled upon a bit obscure behaviour using SQLFORM.grid, left joins and 
CSV exports using 2.8.1-stable+timestamp.2013.11.27.20.07.10. It seems to 
be closely related to #1584 here: 
http://code.google.com/p/web2py/issues/detail?id=1584

I made a simple test application which illustrates the problem here:

https://bitbucket.org/fredreichbier/web2py-testexport

(installable via the web2py admin interface using the git url 
g...@bitbucket.org:fredreichbier/web2py-testexport.git)

Similarly to the web2py manual, I have two tables, ``person`` (with a 
``person_name`` field) and ``thing`` (with a ``thing_name`` field and 
``owner_id``, a foreign key reference to a ``person`` entry). For testing, 
I added a person "Batman" with a thing "Batmobile" and a person "Spiderman" 
with a thing "Nothing".

I'm now constructing a SQLFORM.grid with a left join to make it possible to 
search for things by the owner's name:

grid = SQLFORM.grid(db.thing,
fields=[db.thing.thing_name],
left=db.person.on(
db.person.id==db.thing.owner_id
))

You can see the grid at http://127.0.0.1:8000/testexport/

If I'm now entering a query ``person.person_name contains "Batman"``, that 
is, filter the things by the owner's name, I get a list with one item, 
"Batman", which seems correct to me. However, if I now click "Export CSV", 
I get an empty file. If I'm filtering the things using the thing's name 
(``thing.thing_name contains "Bat"``), the grid displays one line, which 
can be correctly exported to CSV.

So, it seems to me that it's not possible to export a set of records when 
using a filter expression on fields of joined tables.

I looked into this a bit and I think it's related to the handling of 
keywords when using exports in SQLFORM.grid:


https://github.com/web2py/web2py/blob/a55c6777d39d238307445d937bc67dfd6a84d1b4/gluon/sqlhtml.py#L2173

``fields`` only contains the fields of ``thing``, thus, the query is 
rejected because ``person.person_name`` is unknown. However, for ordinary 
searching (not using exports), a ``sfields`` list of all searchable fields 
is constructed and used which also contains fields of joined tables (L2217):

sfields = reduce(lambda a, b: a + b,
 [[f for f in t if f.readable] for t in tables])

So my question is: Am I using the web2py API incorrectly here, or should 
SQLFORM.grid use a list similar to ``sfields`` also when handling exports?

Best Regards,

Friedrich


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Web2Py DAL, left join and operator precedence

2013-12-03 Thread Vincent Audebert


Hi guys,

In my DB, I've basically 3 tables:

   1. usergroup(id, name, deleted)
   2. usergroup_presentation(id, groupid, presentationid)
   3. presentation(id, name)

I'm trying to run this DAL query:

left_join = 
db.usergroup_presentation.on((db.usergroup_presentation.group_id==db.usergroup.id)&(db.usergroup_presentation.presentation_id==db.presentation.id))
result = db(db.usergroup.deleted==False).select(
   db.usergroup.id, 
   db.usergroup.name, 
   db.usergroup_presentation.id, 
   left=left_join, 
   orderby=db.usergroup.name)

And SQL returns this errors: Unknown column 'presentation.id' in 'on clause'

The generated SQL looks something like that:

SELECT  usergroup.id, usergroup.name, usergroup_presentation.id 
FROM presentation, usergroup
LEFT JOIN usergroup_presentation ON ((usergroup_presentation.group_id = 
usergroup.id) AND (usergroup_presentation.presentation_id = presentation.id)) 
WHERE (usergroup.deleted = 'F')
ORDER BY usergroup.name;

I did some researches on Google and I got this: 
http://mysqljoin.com/joins/joins-in-mysql-5-1054-unknown-column-in-on-clause/

Then I tried to run this query directly in my DB:

SELECT  usergroup.id, usergroup.name, usergroup_presentation.id 
FROM (presentation, usergroup)
LEFT JOIN usergroup_presentation ON ((usergroup_presentation.group_id = 
usergroup.id) AND (usergroup_presentation.presentation_id = presentation.id)) 
WHERE (usergroup.deleted = 'F')
ORDER BY usergroup.name;

And indeed it works when adding the brackets around the FROM tables.

My question is how can I generate a SQL query like this (with brackets) 
with DAL without executing a basic executesql ?

Even better, I would like to get a cleaner SQL query using INNER JOIN and LEFT 
JOIN. I don't know if it's possible with my query though.


Thanks,

Vincent.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread ivo . nijenhuis
I tried the sugested methods prior to posting because I came across a post 
which had that solution in it. It doesn't throw the error, but ignores it 
totally.
I think the issue is because the url of the form is 
App/default/product/
And the edit function creates a url like
App/default/product/edit/(record id)?(hmac)

I'm not quite sure how to get the diagnostic print/logs.
I'm kind of new to w2p and py in general

Thanks for the replies so far

Sent from my phone

On 4 dec. 2013, at 00:38, Dave S  wrote:

> 
> 
> On Tuesday, December 3, 2013 3:25:06 PM UTC-8, 黄祥 wrote:
>> 
>> please try not tested :
>> edit_in_form = 'edit' in request.args
>> db.product.price.writable = not edit_in_form 
>> 
>> or
>> 
>> edit_in_form = request.args[-3] == 'edit'
>> db.product.price.writable = not edit_in_form 
> 
> I'd expect the 2nd suggestion to be problematic in the same way as the OP's 
> formulation, if request.args doesn't have the expected len.
> maybe a diagnostic print/log to examine the size?
> 
> /dps
>  
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/0yA3-T9MesY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥

>
> where do you put he query  db.auth_user.branch_adress?
>
 
db.auth_user.branch.address not db.auth_user.branch_adress

db.table.reference_table_field_from_table.field_of_reference_table

it depend where i want to receive the query db.auth_user.branch.address 
result, e.g. if i want the result in models, i put it on models, if in 
controllers in put it on controllers, if in views i put it on views.
 

>
> I want the user to add company, not to choose from avaliable companies, 
> but the data is inserted into organization table
>

sorry, i'm just gave you an example, not to force you to follow mine, in 
example above is just to describe :
1. the order when i define the database table : e.g. the auth user table 
have refer to table branch, so that i must create / define branch table 
before i define auth user table
2. i'm show normalization in database to minimalize redundant data : e.g. 
i'm just define 1 field that refer to 1 table, even i want some information 
from that table, let say, i want to know where the auth_user is active, so 
like example above, i can query it using db.auth_user.branch.address.

perhaps you can follow anthony reference to the book. you can imagine it 
that client table is auth_user table and address table is organization 
table. 1 more thing, if the client table field is added, for example add 
the new field gender, i think the address table only refer to client table 
once. 

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread Dave S


On Tuesday, December 3, 2013 3:25:06 PM UTC-8, 黄祥 wrote:
>
> please try not tested :
> edit_in_form = 'edit' in request.args
> db.product.price.writable = not edit_in_form 
>
> or
>
> edit_in_form = request.args[-3] == 'edit'
> db.product.price.writable = not edit_in_form 
>

I'd expect the 2nd suggestion to be problematic in the same way as the OP's 
formulation, if request.args doesn't have the expected len.
maybe a diagnostic print/log to examine the size?

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-03 Thread 黄祥
any other solution how to resize the size on web2py? even tried to do it on 
client side using html nothing change. e.g.
{{=IMG(_src=URL('default', 'download', args=row.image), _alt=row.model, 
_width='220', _height='220') }}

in that html i define the width and height, i tested it on normal html it's 
force the image size, while the same image on web2py is not resize in html.

p.s.
i installed the pillow for windows from 
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: SQLFORM.grid edit form restrictions

2013-12-03 Thread 黄祥
please try not tested :
edit_in_form = 'edit' in request.args
db.product.price.writable = not edit_in_form 

or

edit_in_form = request.args[-3] == 'edit'
db.product.price.writable = not edit_in_form 

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] RFC Proposal checkbox widget

2013-12-03 Thread Massimo Di Pierro
yes please.

On Tuesday, 3 December 2013 12:00:54 UTC-6, Richard wrote:
>
> Would you I make a patch on Github?
>
> Richard
>
>
> On Tue, Dec 3, 2013 at 12:58 PM, Massimo Di Pierro 
> 
> > wrote:
>
>> I opened a ticket and will process asap. 
>>
>>
>> On Monday, 2 December 2013 14:46:41 UTC-6, Richard wrote:
>>>
>>> Hello,
>>>
>>> I set a label True/False flag for checkbox widget like so :
>>>
>>> class CheckboxesWidget(OptionsWidget):
>>>
>>> @classmethod
>>> def widget(cls, field, value, **attributes):
>>> """
>>> generates a TABLE tag, including INPUT checkboxes (multiple 
>>> allowed)
>>>
>>> see also: :meth:`FormWidget.widget`
>>> """
>>> # was values = re.compile('[\w\-:]+').findall(str(value))
>>> if isinstance(value, (list, tuple)):
>>> values = [str(v) for v in value]
>>> else:
>>> values = [str(value)]
>>>
>>> attr = cls._attributes(field, {}, **attributes)
>>> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>>>
>>> label = attr.get('label')
>>> if not isinstance(label, bool):
>>> label = True
>>> elif label is True:
>>> label = True
>>> elif label is False:
>>> label = False
>>>
>>> requires = field.requires
>>> if not isinstance(requires, (list, tuple)):
>>> requires = [requires]
>>> if requires and hasattr(requires[0], 'options'):
>>> options = requires[0].options()
>>> else:
>>> raise SyntaxError('widget cannot determine options of %s'
>>>   % field)
>>>
>>> options = [(k, v) for k, v in options if k != '']
>>> opts = []
>>> cols = attributes.get('cols', 1)
>>> totals = len(options)
>>> mods = totals % cols
>>> rows = totals / cols
>>> if mods:
>>> rows += 1
>>>
>>> #widget style
>>> wrappers = dict(
>>> table=(TABLE, TR, TD),
>>> ul=(DIV, UL, LI),
>>> divs=(CAT, DIV, DIV)
>>> )
>>> parent, child, inner = wrappers[attributes.get('style', 
>>> 'table')]
>>>
>>> for r_index in range(rows):
>>> tds = []
>>> for k, v in options[r_index * cols:(r_index + 1) * cols]:
>>> if k in values:
>>> r_value = k
>>> else:
>>> r_value = []
>>> tds.append(inner(INPUT(_type='checkbox',
>>>_id='%s%s' % (field.name, k),
>>>_name=field.name,
>>>requires=attr.get('requires', 
>>> None),
>>>hideerror=True, _value=k,
>>>value=r_value),
>>>  LABEL(v, _for='%s%s' % (field.name, 
>>> k)) if label is True else ''))
>>> opts.append(child(tds))
>>>
>>> if opts:
>>> opts.append(
>>> INPUT(requires=attr.get('requires', None),
>>>   _style="display:none;",
>>>   _disabled="disabled",
>>>   _name=field.name,
>>>   hideerror=False))
>>> return parent(*opts, **attr)
>>>
>>> The purpose of this change is in context where a user need single 
>>> checkbox for each row of a grid where he don't need to display a label 
>>> beside the checkbox, since he only want to know which record is checked and 
>>> need to be updated...
>>>
>>> I need that in order to create a special form that allow bunch/batch 
>>> records update, see attach image (sorry I had to hide data of some 
>>> columns)... You can see, that each row has a checkbox that is generated 
>>> like this :
>>>
>>> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>>>  requires=IS_EMPTY_OR(IS_IN_
>>> SET([r['table'].id])),
>>>  widget=lambda field, value: 
>>> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', 
>>> label=False)) for r in rows]
>>>
>>> The form is then create with .factory() after adding the last fields of 
>>> the models that appears in the last line of the html table on the attach 
>>> image...
>>>
>>> I can, make the change on Git and send a PR, if this change is kind of 
>>> approved!!
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google

[web2py] SQLFORM.grid edit form restrictions

2013-12-03 Thread Ivo
Hi,
I have want to set some restrictions on editable fields in a edit form grid.

This is the form
def product():
grid = SQLFORM.grid(db.product, 
columns=[
 db.product.name,
 db.product.description,
 db.product.price,
 ],)

when I try to add:
if request.args[-3] == 'edit':
db.product.price.writable=False
I get an error 
 list index out of range
That traces to the if statement.
however is I load the grid form, and then apply the change and save, the 
statement works as expected.

I also tried adding:
else:
pass
but it doesn't help.

what am I doing wrong or not doing?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-03 Thread Richard Vézina
My guess would be that this contrib is not working with Pilow packaging of
PIL library...

Richard


On Tue, Dec 3, 2013 at 9:38 AM, 黄祥  wrote:

> even tried what was written on imageutils.py, to put it on modules and
> import it on models, but still not resize (no errors messages).
> e.g.
> *models/db_wizard_3_product.py*
> from images import RESIZE
> db.product.image.requires = RESIZE(200, 200)
>
> any idea how to achieve it?
>
> thanks and best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: admin interface wrong on 2.8.2

2013-12-03 Thread shapovalovdenis
the thing is that tickets are generated only in google chrome, in FF admin 
iface works just fine. 
 'dict' object has no attribute 
'is_mobile'



On Tuesday, December 3, 2013 10:05:36 PM UTC+2, shapova...@gmail.com wrote:
>
> hmmm,
>
> Had the same problem with admin (looked like no js and css), I've replaced 
> ^/([^/]+)/static/?(.*)
>
>  
> with 
>
>  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) \
>
> in two places in my vhosts configuration section, now all I get is 
> tickets, that I cannot see. Any ideas?
>
> On Tuesday, December 3, 2013 5:39:58 AM UTC+2, Massimo Di Pierro wrote:
>>
>> In your apache config files you need to replace
>>
>> ^/([^/]+)/static/?(.*)
>>
>> with
>>
>> ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*)
>>
>> in two places.
>>
>> On Monday, 2 December 2013 21:10:10 UTC-6, lucas wrote:
>>>
>>> hey everyone,
>>>
>>> got web2py 2.8.2 working on apache and centos.  fixed under
>>>
>>> https://groups.google.com/forum/#!topic/web2py/DexgEESPk38
>>>
>>> however, i mentioned that admin interface is all messed up.  my admin 
>>> interface is not right though.  the cool interface for admin is missing 
>>> like the pull-downs and stuff.  i just get straight html text without the 
>>> java scripting side of it.  am i missing another js file that i should 
>>> copy?  it does work with the "python web2py.py" interface, but not with 
>>> apache.  so what would be the difference in that?
>>>
>>> thanx again, lucas
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: admin interface wrong on 2.8.2

2013-12-03 Thread shapovalovdenis
hmmm,

Had the same problem with admin (looked like no js and css), I've replaced 
^/([^/]+)/static/?(.*)

 
with 

 AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) \

in two places in my vhosts configuration section, now all I get is tickets, 
that I cannot see. Any ideas?

On Tuesday, December 3, 2013 5:39:58 AM UTC+2, Massimo Di Pierro wrote:
>
> In your apache config files you need to replace
>
> ^/([^/]+)/static/?(.*)
>
> with
>
> ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*)
>
> in two places.
>
> On Monday, 2 December 2013 21:10:10 UTC-6, lucas wrote:
>>
>> hey everyone,
>>
>> got web2py 2.8.2 working on apache and centos.  fixed under
>>
>> https://groups.google.com/forum/#!topic/web2py/DexgEESPk38
>>
>> however, i mentioned that admin interface is all messed up.  my admin 
>> interface is not right though.  the cool interface for admin is missing 
>> like the pull-downs and stuff.  i just get straight html text without the 
>> java scripting side of it.  am i missing another js file that i should 
>> copy?  it does work with the "python web2py.py" interface, but not with 
>> apache.  so what would be the difference in that?
>>
>> thanx again, lucas
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: login crash under 2.8.2

2013-12-03 Thread Jonathan Lundell
On 3 Dec 2013, at 9:59 AM, Massimo Di Pierro  wrote:

> Is this with 2.8.2?

This confuses me. In Storage, we say:

__getstate__ = lambda self: None

...but the pickling logic ends up calling what __getstate__ returns (without 
checking for None), which would explain the crash below. The confusing part is 
that it's been this way for a while, right? 

FastStorage, OTOH, has:

def __getstate__(self):
return dict(self)



> 
> On Tuesday, 3 December 2013 05:59:11 UTC-6, lucas wrote:
> hey everyone,
> 
> thanx for the help on my prior posts, things are moving along.  i now get a 
> crash when i try to login under the application,  the traceback is:
> 
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/main.py", line 479, in wsgibase
> session._try_store_in_cookie_or_file(request, response)
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1089, in 
> _try_store_in_cookie_or_file
> return self._try_store_in_file(request, response)
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1096, in 
> _try_store_in_file
> or self._unchanged(response)):
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1041, in _unchanged
> session_pickled = cPickle.dumps(self)
>   File "/usr/lib/python2.6/copy_reg.py", line 84, in _reduce_ex
> dict = getstate()
> TypeError: 'NoneType' object is not callable
> none of this points to my code, so i believe it is in web2py.  or, do i have 
> to adjust something in my code to compensate for the update.  i have cleared 
> all sessions and copied the web2py.js appadmin.html and appadmin.py into my 
> applications and made the appropriate changes in apache config files as per 
> my prior two tickets.
> ok, lucas
> 
> 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py 2.8.1 is OUT

2013-12-03 Thread Dave S
On Monday, December 2, 2013 10:24:57 PM UTC-8, Massimo Di Pierro wrote:
>
> Please open a ticket about this. We can do it.
>
>
Done.


 

> On Monday, 2 December 2013 22:02:10 UTC-6, Dave S wrote:
>>
>> On Wednesday, November 27, 2013 12:31:05 PM UTC-8, Massimo Di Pierro 
>> wrote:
>>>
>>> Changelog
>>>
>>>
>>> - no more winservice (use nssm instead)
>>> - better imap support in DAL
>>> - db().select().as_tree()
>>> - bootstrap 2.3.2
>>> - codemirror 3.19
>>> - virtual fields in grid
>>> - improved  mongoDB support, thanks Alan
>>> - support for wiki custom render function
>>> - Wiki(...groups=['x','y']) allows bypassing default permissions
>>> - fixed websocket_messaging.py to support newer Tornado
>>> - NDB support for GAE, thanks Quint
>>> - fixed major concurrecy issue with MEMDB
>>> - blocked generic.jsonp for security reasons
>>> - many bug fixes, thanks Niphlod, Michele, Anthony, Tim, and many others.
>>>
>>
>>
>> Upgrade from 2.7.2 via button went pretty well, but I had read the posts 
>> about clearing sessions.
>>
>> Suggestions for the upgrade button:  
>>   +   In addition to the flash message to restart the server, the 
>> update/upgrade button could maybe turn into a "restart  server" button
>>   +  Change the background color of the flash to RED, at least if default 
>> css is used (almost didn't see the flash msg)
>>   +  Display a checklist (tied to the release notes) of things to do 
>> between server shutdown and server restart;
>>   such as clearing sessions 
>>   (and since it will take a while for all the pre-2.6.1 servers to be 
>> upgraded, detect the older server and  show the 2.6.1 checklist)
>>
>> So far so good with my simple setup, though
>> (creaky old Fedora 16 in a VMware Player, W2P+Rocket in a Terminal window 
>> with Bash, clients all on local net, SOAP and simple grids)
>> (no clients were harmed in this upgrade)
>>
>> /dps
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-03 Thread lucas
yes it was/is with 2.8.2, but running only under apache, it is fine with 
"python web2py"  AND i did erase all session files, as in "rm -rf 
sessions/*"  which is a hard remove in linux.  lucas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-03 Thread Gael Princivalle
Thanks a lot Massimo, I'm gone watch all 13 hours !

Il giorno martedì 3 dicembre 2013 07:34:18 UTC+1, Massimo Di Pierro ha 
scritto:
>
> Hello everybody,
>
> As you know I teach a certification program about web development with 
> Python and I use web2py. 
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and 
> supported these classes.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Add extra fields to db.auth_user

2013-12-03 Thread James Burke
For problem no1, you could try using required=True instead of 
requires=IS_NOT_EMPTY()

For your second problem you can define the auth_user table yourself (from 
web2py book):

Another way to do this, although not really recommended, consists of 
defining your auth tables yourself. If a table is declared before 
auth.define_tables() it is used instead of the default one. Here is how to 
do it:

## after auth = Auth(db)
db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True), # required
Field('password', 'password', length=512,# required
  readable=False, label='Password'),
Field('address'),
Field('city'),
Field('zip'),
Field('phone'),
Field('registration_key', length=512,# required
  writable=False, readable=False, default=''),
Field('reset_password_key', length=512,  # required
  writable=False, readable=False, default=''),
Field('registration_id', length=512, # required
  writable=False, readable=False, default=''))

## do not forget validators
custom_auth_table = db[auth.settings.table_user_name] # get the 
custom_auth_table
custom_auth_table.first_name.requires =   
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.last_name.requires =   
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.password.requires = [IS_STRONG(), CRYPT()]
custom_auth_table.email.requires = [
  IS_EMAIL(error_message=auth.messages.invalid_email),
  IS_NOT_IN_DB(db, custom_auth_table.email)]

auth.settings.table_user = custom_auth_table # tell auth to use 
custom_auth_table

## before auth.define_tables()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] uploading files on GAE - 404 NOT FOUND

2013-12-03 Thread James Burke
Hi,

Uploading files into my table on GAE, when I hit submit I'm presented with 
a "404 NOT FOUND" error message.

Works fine using Rocket, but not in GAE SDK or when uploaded to GAE.

_tables.py - in models
db.define_table('file',
Field('name', unique=True, compute=lambda r: db.file.file.retrieve(r.
file)[0]),
Field('file', 'upload'),
Field('created_on', 'datetime', default=request.now),
Field('created_by', 'reference auth_user', default=auth.user_id),
format='%(name)s')


admin.py - in controllers
@auth.requires_membership("admin")
def file():
 links = [dict(header='URL', body=lambda row: '/init/default/download/%s' %(
db.file.file.retrieve(row.file)[0]))]
 form = SQLFORM.grid(db.file, links=links, searchable=False, 
csv=False,user_signature
=False)


 return dict(form=form)



Cheers

-James

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-03 Thread Leonel Câmara
I had the same problem, I solved it by manually deleting all sessions, as 
in deleting everything in the "sessions" folder of the application.

Terça-feira, 3 de Dezembro de 2013 11:59:11 UTC, lucas escreveu:
>
> hey everyone,
>
> thanx for the help on my prior posts, things are moving along.  i now get 
> a crash when i try to login under the application,  the traceback is:
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/main.py", line 479, in wsgibase
> session._try_store_in_cookie_or_file(request, response)
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1089, in 
> _try_store_in_cookie_or_file
> return self._try_store_in_file(request, response)
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1096, in 
> _try_store_in_file
> or self._unchanged(response)):
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1041, in _unchanged
> session_pickled = cPickle.dumps(self)
>   File "/usr/lib/python2.6/copy_reg.py", line 84, in _reduce_ex
> dict = getstate()
> TypeError: 'NoneType' object is not callable
>
> none of this points to my code, so i believe it is in web2py.  or, do i have 
> to adjust something in my code to compensate for the update.  i have cleared 
> all sessions and copied the web2py.js appadmin.html and appadmin.py into my 
> applications and made the appropriate changes in apache config files as per 
> my prior two tickets.
>
> ok, lucas
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] RFC Proposal checkbox widget

2013-12-03 Thread Richard Vézina
Would you I make a patch on Github?

Richard


On Tue, Dec 3, 2013 at 12:58 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I opened a ticket and will process asap.
>
>
> On Monday, 2 December 2013 14:46:41 UTC-6, Richard wrote:
>>
>> Hello,
>>
>> I set a label True/False flag for checkbox widget like so :
>>
>> class CheckboxesWidget(OptionsWidget):
>>
>> @classmethod
>> def widget(cls, field, value, **attributes):
>> """
>> generates a TABLE tag, including INPUT checkboxes (multiple
>> allowed)
>>
>> see also: :meth:`FormWidget.widget`
>> """
>> # was values = re.compile('[\w\-:]+').findall(str(value))
>> if isinstance(value, (list, tuple)):
>> values = [str(v) for v in value]
>> else:
>> values = [str(value)]
>>
>> attr = cls._attributes(field, {}, **attributes)
>> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>>
>> label = attr.get('label')
>> if not isinstance(label, bool):
>> label = True
>> elif label is True:
>> label = True
>> elif label is False:
>> label = False
>>
>> requires = field.requires
>> if not isinstance(requires, (list, tuple)):
>> requires = [requires]
>> if requires and hasattr(requires[0], 'options'):
>> options = requires[0].options()
>> else:
>> raise SyntaxError('widget cannot determine options of %s'
>>   % field)
>>
>> options = [(k, v) for k, v in options if k != '']
>> opts = []
>> cols = attributes.get('cols', 1)
>> totals = len(options)
>> mods = totals % cols
>> rows = totals / cols
>> if mods:
>> rows += 1
>>
>> #widget style
>> wrappers = dict(
>> table=(TABLE, TR, TD),
>> ul=(DIV, UL, LI),
>> divs=(CAT, DIV, DIV)
>> )
>> parent, child, inner = wrappers[attributes.get('style', 'table')]
>>
>> for r_index in range(rows):
>> tds = []
>> for k, v in options[r_index * cols:(r_index + 1) * cols]:
>> if k in values:
>> r_value = k
>> else:
>> r_value = []
>> tds.append(inner(INPUT(_type='checkbox',
>>_id='%s%s' % (field.name, k),
>>_name=field.name,
>>requires=attr.get('requires',
>> None),
>>hideerror=True, _value=k,
>>value=r_value),
>>  LABEL(v, _for='%s%s' % (field.name, k))
>> if label is True else ''))
>> opts.append(child(tds))
>>
>> if opts:
>> opts.append(
>> INPUT(requires=attr.get('requires', None),
>>   _style="display:none;",
>>   _disabled="disabled",
>>   _name=field.name,
>>   hideerror=False))
>> return parent(*opts, **attr)
>>
>> The purpose of this change is in context where a user need single
>> checkbox for each row of a grid where he don't need to display a label
>> beside the checkbox, since he only want to know which record is checked and
>> need to be updated...
>>
>> I need that in order to create a special form that allow bunch/batch
>> records update, see attach image (sorry I had to hide data of some
>> columns)... You can see, that each row has a checkbox that is generated
>> like this :
>>
>> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>>  requires=IS_EMPTY_OR(IS_IN_
>> SET([r['table'].id])),
>>  widget=lambda field, value:
>> SQLFORM.widgets.checkboxes.widget(field, value, style='divs',
>> label=False)) for r in rows]
>>
>> The form is then create with .factory() after adding the last fields of
>> the models that appears in the last line of the html table on the attach
>> image...
>>
>> I can, make the change on Git and send a PR, if this change is kind of
>> approved!!
>>
>> Thanks
>>
>> Richard
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)

[web2py] Re: login crash under 2.8.2

2013-12-03 Thread Massimo Di Pierro
Is this with 2.8.2?

On Tuesday, 3 December 2013 05:59:11 UTC-6, lucas wrote:
>
> hey everyone,
>
> thanx for the help on my prior posts, things are moving along.  i now get 
> a crash when i try to login under the application,  the traceback is:
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/main.py", line 479, in wsgibase
> session._try_store_in_cookie_or_file(request, response)
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1089, in 
> _try_store_in_cookie_or_file
> return self._try_store_in_file(request, response)
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1096, in 
> _try_store_in_file
> or self._unchanged(response)):
>   File "/opt/web-apps/web2py/gluon/globals.py", line 1041, in _unchanged
> session_pickled = cPickle.dumps(self)
>   File "/usr/lib/python2.6/copy_reg.py", line 84, in _reduce_ex
> dict = getstate()
> TypeError: 'NoneType' object is not callable
>
> none of this points to my code, so i believe it is in web2py.  or, do i have 
> to adjust something in my code to compensate for the update.  i have cleared 
> all sessions and copied the web2py.js appadmin.html and appadmin.py into my 
> applications and made the appropriate changes in apache config files as per 
> my prior two tickets.
>
> ok, lucas
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: one to many tables in views

2013-12-03 Thread EW
The logic you have currently loops through and creates rows for all 
tcinputs for each timecard and that is why they are all the same.
 
I can think of 2 solutions:  
1) Keep your queries the same but add an if statement to determine which of 
the tcinputs apply:
 
 {{for timecard_entry in tcinputs:}}   


   
{{if timecard_entry.timecard==timecard.id:}}   



  
{{=timecard_entry.company.name}}etc   



  
{{pass}}   


  
{{pass}}
 
2) Make one query in the controller with something like tcrows = 
db(db.timecard_entry.timecard==db.timecard.id).select(orderby=~db.timecard.tc_date)
 
But then the code in the view is a little more complicated--you would need 
to check for when you reach a "new" timecard so that you know when to 
end/create your tables.  Also note that if you used this query, it contains 
fields from both tables so to access the variables you need to specify the 
tablename e.g. 
 {{for t in tcrows:}} 
{{=A(t.timecard.employee.fname, etc, etc
{{=t.timecard_entry.company.name}}, etc, etc
{{pass}}


On Monday, December 2, 2013 9:20:38 PM UTC-8, Jesse Ferguson wrote:

>  I have two tables set up and i want to show the TimeCard with all the 
> entries for said time card however im unsure of how to create such a view...
>
> CONTOLLER:
>
> def timecard_index():
> tcrows =db(db.timecard).select(orderby=~db.timecard.tc_date)
> tcinputs =db(db.timecard_entry).select(orderby=db.timecard_entry.timecard)
> return locals()
>
> MODEL:
>
> db.define_table('timecard',
> Field('tc_date','date'),
> Field('employee', 'reference 
> employee',requires=IS_IN_DB(db,'employee.id','%(fname)s %(lname)s')),
> Field('myid', unique=True, compute=lambda r: str(r.tc_date) + 
> str(r.employee))
> )
>
> db.define_table('timecard_entry',
> Field('timecard', 'reference timecard', readable=False, 
> writable=False,),
> Field('company', 'reference company', label='Company'),
> Field('tc_start', 'time', 
> requires=[IS_TIME(),IS_NOT_EMPTY()], label='Start'),
> Field('tc_stop', 'time', requires=[IS_TIME(),IS_NOT_EMPTY()], 
> label='Stop'),
> Field('st' , 'double', label='ST', default=0.0),
> Field('ot' , 'double', label='OT', default=0.0),
> Field('dt' , 'double', label='DT', default=0.0),
> Field('tc_classification' ,'string', label='Classification'),
> auth.signature)
>
> VIEW:
>
> {{for timecard in tcrows:}}
> 
> 
> {{=A(timecard.employee.fname +' 
> '+timecard.employee.lname,_href=URL('view_timecard',args=timecard.id))}} 
> {{=timecard.tc_date.strftime("%m.%d.%Y")}}
> {{for timecard_entry in tcinputs:}}
> 
> {{=timecard_entry.company.name}}{{=timecard_entry.tc_start}}{{=timecard_entry.tc_stop}}{{=timecard_entry.st}}{{=timecard_entry.ot}}{{=timecard_entry.dt}}{{=timecard_entry.tc_classification}}
> {{pass}}
>  
> 
> {{pass}}
>
> This results in the same entries being put into each timecard (not the 
> correct ones), I know I'm missing something in the logic but I'm too green 
> of a programmer to see it... Im also not sure if im making the correct 
> query for tcinputs...
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] RFC Proposal checkbox widget

2013-12-03 Thread Massimo Di Pierro
I opened a ticket and will process asap. 

On Monday, 2 December 2013 14:46:41 UTC-6, Richard wrote:
>
> Hello,
>
> I set a label True/False flag for checkbox widget like so :
>
> class CheckboxesWidget(OptionsWidget):
>
> @classmethod
> def widget(cls, field, value, **attributes):
> """
> generates a TABLE tag, including INPUT checkboxes (multiple 
> allowed)
>
> see also: :meth:`FormWidget.widget`
> """
> # was values = re.compile('[\w\-:]+').findall(str(value))
> if isinstance(value, (list, tuple)):
> values = [str(v) for v in value]
> else:
> values = [str(value)]
>
> attr = cls._attributes(field, {}, **attributes)
> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>
> label = attr.get('label')
> if not isinstance(label, bool):
> label = True
> elif label is True:
> label = True
> elif label is False:
> label = False
>
> requires = field.requires
> if not isinstance(requires, (list, tuple)):
> requires = [requires]
> if requires and hasattr(requires[0], 'options'):
> options = requires[0].options()
> else:
> raise SyntaxError('widget cannot determine options of %s'
>   % field)
>
> options = [(k, v) for k, v in options if k != '']
> opts = []
> cols = attributes.get('cols', 1)
> totals = len(options)
> mods = totals % cols
> rows = totals / cols
> if mods:
> rows += 1
>
> #widget style
> wrappers = dict(
> table=(TABLE, TR, TD),
> ul=(DIV, UL, LI),
> divs=(CAT, DIV, DIV)
> )
> parent, child, inner = wrappers[attributes.get('style', 'table')]
>
> for r_index in range(rows):
> tds = []
> for k, v in options[r_index * cols:(r_index + 1) * cols]:
> if k in values:
> r_value = k
> else:
> r_value = []
> tds.append(inner(INPUT(_type='checkbox',
>_id='%s%s' % (field.name, k),
>_name=field.name,
>requires=attr.get('requires', None),
>hideerror=True, _value=k,
>value=r_value),
>  LABEL(v, _for='%s%s' % (field.name, k)) 
> if label is True else ''))
> opts.append(child(tds))
>
> if opts:
> opts.append(
> INPUT(requires=attr.get('requires', None),
>   _style="display:none;",
>   _disabled="disabled",
>   _name=field.name,
>   hideerror=False))
> return parent(*opts, **attr)
>
> The purpose of this change is in context where a user need single checkbox 
> for each row of a grid where he don't need to display a label beside the 
> checkbox, since he only want to know which record is checked and need to be 
> updated...
>
> I need that in order to create a special form that allow bunch/batch 
> records update, see attach image (sorry I had to hide data of some 
> columns)... You can see, that each row has a checkbox that is generated 
> like this :
>
> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>  requires=IS_EMPTY_OR(IS_IN_SET([r['table'].id])),
>  widget=lambda field, value: 
> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=False)) 
> for r in rows]
>
> The form is then create with .factory() after adding the last fields of 
> the models that appears in the last line of the html table on the attach 
> image...
>
> I can, make the change on Git and send a PR, if this change is kind of 
> approved!!
>
> Thanks
>
> Richard
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-03 Thread Ykä Marjanen
Thanks Massimo! Even though I already have the basic knowledge of web2py 
this is a great way to recap.

Ykä

On Tuesday, December 3, 2013 8:34:18 AM UTC+2, Massimo Di Pierro wrote:
>
> Hello everybody,
>
> As you know I teach a certification program about web development with 
> Python and I use web2py. 
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and 
> supported these classes.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-03 Thread lucas
oh, btw, the above does not happen under "python web2py.py" but only under 
the apache umbrella.  lucas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] RFC Proposal checkbox widget

2013-12-03 Thread Richard Vézina
Ping!


On Mon, Dec 2, 2013 at 3:46 PM, Richard  wrote:

> Hello,
>
> I set a label True/False flag for checkbox widget like so :
>
> class CheckboxesWidget(OptionsWidget):
>
> @classmethod
> def widget(cls, field, value, **attributes):
> """
> generates a TABLE tag, including INPUT checkboxes (multiple
> allowed)
>
> see also: :meth:`FormWidget.widget`
> """
> # was values = re.compile('[\w\-:]+').findall(str(value))
> if isinstance(value, (list, tuple)):
> values = [str(v) for v in value]
> else:
> values = [str(value)]
>
> attr = cls._attributes(field, {}, **attributes)
> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>
> label = attr.get('label')
> if not isinstance(label, bool):
> label = True
> elif label is True:
> label = True
> elif label is False:
> label = False
>
> requires = field.requires
> if not isinstance(requires, (list, tuple)):
> requires = [requires]
> if requires and hasattr(requires[0], 'options'):
> options = requires[0].options()
> else:
> raise SyntaxError('widget cannot determine options of %s'
>   % field)
>
> options = [(k, v) for k, v in options if k != '']
> opts = []
> cols = attributes.get('cols', 1)
> totals = len(options)
> mods = totals % cols
> rows = totals / cols
> if mods:
> rows += 1
>
> #widget style
> wrappers = dict(
> table=(TABLE, TR, TD),
> ul=(DIV, UL, LI),
> divs=(CAT, DIV, DIV)
> )
> parent, child, inner = wrappers[attributes.get('style', 'table')]
>
> for r_index in range(rows):
> tds = []
> for k, v in options[r_index * cols:(r_index + 1) * cols]:
> if k in values:
> r_value = k
> else:
> r_value = []
> tds.append(inner(INPUT(_type='checkbox',
>_id='%s%s' % (field.name, k),
>_name=field.name,
>requires=attr.get('requires', None),
>hideerror=True, _value=k,
>value=r_value),
>  LABEL(v, _for='%s%s' % (field.name, k))
> if label is True else ''))
> opts.append(child(tds))
>
> if opts:
> opts.append(
> INPUT(requires=attr.get('requires', None),
>   _style="display:none;",
>   _disabled="disabled",
>   _name=field.name,
>   hideerror=False))
> return parent(*opts, **attr)
>
> The purpose of this change is in context where a user need single checkbox
> for each row of a grid where he don't need to display a label beside the
> checkbox, since he only want to know which record is checked and need to be
> updated...
>
> I need that in order to create a special form that allow bunch/batch
> records update, see attach image (sorry I had to hide data of some
> columns)... You can see, that each row has a checkbox that is generated
> like this :
>
> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>  requires=IS_EMPTY_OR(IS_IN_SET([r['table'].id])),
>  widget=lambda field, value:
> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=False))
> for r in rows]
>
> The form is then create with .factory() after adding the last fields of
> the models that appears in the last line of the html table on the attach
> image...
>
> I can, make the change on Git and send a PR, if this change is kind of
> approved!!
>
> Thanks
>
> Richard
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Add extra fields to db.auth_user

2013-12-03 Thread Gael Princivalle
Hi.

I've had extra fields to db.auth_user like that in db.py:

auth = Auth(db)
auth.settings.extra_fields['auth_user']= [Field('Company', 
requires=IS_NOT_EMPTY()),Field('Phone')]

Problem n°1, requires=IS_NOT_EMPTY() don't have any effect. A user can 
register without filling this field.

Problem n° 2, Company and Phone fields are in the form after passwords 
field, I would like to change the fild order.

How can I do it ?

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-03 Thread 黄祥
even tried what was written on imageutils.py, to put it on modules and 
import it on models, but still not resize (no errors messages).
e.g.
*models/db_wizard_3_product.py*
from images import RESIZE
db.product.image.requires = RESIZE(200, 200)

any idea how to achieve it?

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Best way to have two auto incremental columns (one is conditional of the other)

2013-12-03 Thread Francisco
Thanks Niphlod. I didn't knew you could do that. I will try and see how 
this works.

El viernes, 29 de noviembre de 2013 15:31:16 UTC-6, Niphlod escribió:
>
> that's the "idiotest" (does it even exist ? ) scheme ever, but alas, if 
> you need to because you're forced to, there is absolutely nothing you can 
> come up with that is backed up by most database backends.
>
> if you're going to use only backends that support *select ... for update*you 
> can use DAL's db(q).select(for_update=True) to mark a specific 
> "counter" as non-updateable by others. in that case, a simple table like
>
> id,branch_name,counter
>
> will come in handy
>
> let's create a table in a console (named A)
> db.define_table('branches', Field('branch_name'), Field('counter', 
> 'integer'))
> db.branches.insert(branch_name='A', counter=0)
> db.commit()
> db(db.branches.branch_name == 'A').select(for_update=True)
> db(db.branches.branch_name == 'A').update(counter=db.branches.counter + 1)
> 
>
> then, on a different console (named B)
> db.define_table('branches', Field('branch_name'), Field('counter', 
> 'integer'))
> db(db.branches.branch_name == 'A').select(for_update=True)
> 
>
> you'll notice that B "is on hold" until A issues a db.commit(). 
> That's because when you do a *select  for update* you're holding a 
> lock on that record until you commit the transaction (in your case, you'd 
> commit AFTER assigning a new invoice number). 
> Nobody can fetch/update/delete that row until you commit()
>
> If you're willing to pay a small price in concurrency, that's the way I'd 
> go to meet your business requirements. 
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Anthony
Have a look at 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#One-form-for-multiple-tables
.

Anthony

On Tuesday, December 3, 2013 7:37:34 AM UTC-5, Yebach wrote:
>
> So how do i resolve that
>
> I have aut_user table that has a field organization (id)
>
> In table organization I have more fields (org name, adress, etc)
> Now I want to show this fields (almost all) of table organization to user 
> in user profile view. 
>
> ??
>
>
> On Tuesday, December 3, 2013 1:34:06 PM UTC+1, 黄祥 wrote:
>>
>> 1 more thing, if you have reference field to another table it will refer 
>> to the table id of your target, so i think it's useless if you define a lot 
>> of auth user extra field to just 1 table, because it will return 1 value 
>> which is the table id, in this case will be organization id.
>>
>> best regards,
>> stifan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
where do you put he query  db.auth_user.branch_adress?

I want the user to add company, not to choose from avaliable companies, but 
the data is inserted into organization table



On Tuesday, December 3, 2013 1:54:57 PM UTC+1, 黄祥 wrote:
>
> i think it will make the database table denormalization (make data 
> redundancy) if you put almost all of your organization table value to your 
> auth_user table. 
> i think just refer the organization from auth_user table is more than 
> enough, and if you want to know this user belong to which organization 
> address, city, state, etc, then you can just query it.
> please examine the example code i gave first, you will see that my 
> auth_user table is refer to table branch, which is have almost the same 
> field like your (address, city, state), but in my case i just refer only 
> one, if i want to know where is this user works in, i can query it in my 
> example : db.auth_user.branch.address.
> e.g. 
> db.define_table('company', 
> Field('name'), 
> Field('website'), 
> Field('logo', 'upload'), 
> format = '%(name)s')
>
> db.define_table('bank', 
> Field('bank'), 
> Field('ebanking'), 
> format = '%(bank)s')
>
> db.define_table('branch', 
> Field('address', 'text'), 
> Field('zip_code'), 
> Field('city'), 
> Field('country'), 
> Field('phone', 'list:string'), 
> Field('fax', 'list:string'), 
> Field('email', 'list:string'), 
> Field('bank', 'list:reference bank'), 
> Field('company', 'reference company'), 
> format = '%(address)s')
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
where do you put he query  db.auth_user.branch_adress?



On Tuesday, December 3, 2013 1:54:57 PM UTC+1, 黄祥 wrote:
>
> i think it will make the database table denormalization (make data 
> redundancy) if you put almost all of your organization table value to your 
> auth_user table. 
> i think just refer the organization from auth_user table is more than 
> enough, and if you want to know this user belong to which organization 
> address, city, state, etc, then you can just query it.
> please examine the example code i gave first, you will see that my 
> auth_user table is refer to table branch, which is have almost the same 
> field like your (address, city, state), but in my case i just refer only 
> one, if i want to know where is this user works in, i can query it in my 
> example : db.auth_user.branch.address.
> e.g. 
> db.define_table('company', 
> Field('name'), 
> Field('website'), 
> Field('logo', 'upload'), 
> format = '%(name)s')
>
> db.define_table('bank', 
> Field('bank'), 
> Field('ebanking'), 
> format = '%(bank)s')
>
> db.define_table('branch', 
> Field('address', 'text'), 
> Field('zip_code'), 
> Field('city'), 
> Field('country'), 
> Field('phone', 'list:string'), 
> Field('fax', 'list:string'), 
> Field('email', 'list:string'), 
> Field('bank', 'list:reference bank'), 
> Field('company', 'reference company'), 
> format = '%(address)s')
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
i think it will make the database table denormalization (make data 
redundancy) if you put almost all of your organization table value to your 
auth_user table. 
i think just refer the organization from auth_user table is more than 
enough, and if you want to know this user belong to which organization 
address, city, state, etc, then you can just query it.
please examine the example code i gave first, you will see that my 
auth_user table is refer to table branch, which is have almost the same 
field like your (address, city, state), but in my case i just refer only 
one, if i want to know where is this user works in, i can query it in my 
example : db.auth_user.branch.address.
e.g. 
db.define_table('company', 
Field('name'), 
Field('website'), 
Field('logo', 'upload'), 
format = '%(name)s')

db.define_table('bank', 
Field('bank'), 
Field('ebanking'), 
format = '%(bank)s')

db.define_table('branch', 
Field('address', 'text'), 
Field('zip_code'), 
Field('city'), 
Field('country'), 
Field('phone', 'list:string'), 
Field('fax', 'list:string'), 
Field('email', 'list:string'), 
Field('bank', 'list:reference bank'), 
Field('company', 'reference company'), 
format = '%(address)s')

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
So how do i resolve that

I have aut_user table that has a field organization (id)

In table organization I have more fields (org name, adress, etc)
Now I want to show this fields (almost all) of table organization to user 
in user profile view. 

??


On Tuesday, December 3, 2013 1:34:06 PM UTC+1, 黄祥 wrote:
>
> 1 more thing, if you have reference field to another table it will refer 
> to the table id of your target, so i think it's useless if you define a lot 
> of auth user extra field to just 1 table, because it will return 1 value 
> which is the table id, in this case will be organization id.
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: intermittent problem with importing dropbox

2013-12-03 Thread Peter
Yes I did install that, so it works perfectly normally 2 times out of 3. 
This is what is strange, the import works intermittently. I would have 
thought that the import would either work or would fail, not switch between 
the two randomly.
Peter

On Monday, December 2, 2013 4:22:02 PM UTC, Massimo Di Pierro wrote:
>
> Did you install this?
> https://www.dropbox.com/developers/core/sdks/python
>
> On Monday, 2 December 2013 09:56:30 UTC-6, Peter wrote:
>>
>> I have some code that writes a file to dropbox.
>>
>> It includes
>>
>> from dropbox import client, rest, session
>> i
>>
>> when I run the save_file command from the browser the majority of the 
>> time it works fine and does what it is supposed to do. But about 1 in 3 
>> times it comes up with a ticket
>>
>> File "/opt/web-apps/web2py/applications/new_spin2/controllers/default.py" 
>> ,
>>  line 591, in save_sqlite
>> from dropbox import client, rest, session
>>   File "/opt/web-apps/web2py/gluon/custom_import.py", line 86, in 
>> custom_importer
>> return base_importer(pname, globals, locals, fromlist, level)
>> ImportError: No module named dropbox
>>
>>
>> I can just sit there and get the same page to reload and arbitrarily it will 
>> work or fail.
>>
>> If I log on to the system with ssh, and run the same version of python and 
>> import dropbox it always imports fine, so it is only occasionally failing to 
>> import dropbox under web2py.
>>
>> Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>> (Running on Unknown, Python 2.6.8)
>>
>> running on centos 5
>>
>> any ideas?
>>
>> Thanks
>>
>> Peter
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
1 more thing, if you have reference field to another table it will refer to 
the table id of your target, so i think it's useless if you define a lot of 
auth user extra field to just 1 table, because it will return 1 value which 
is the table id, in this case will be organization id.

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
i'm so sorry, didn't realize it, i think is it all about sequential, please 
define the organization table first and 
then auth.settings.extra_fields, auth.define_tables, custom_auth_table (for 
field constructor : label, required, requires, etc).

e.g. 
# 1st
db.define_table('organization', )

# 2nd
auth.settings.extra_fields['auth_user'] = [ ... ]

# 3rd
auth.define_tables(username = True, signature = True)

# 4th
custom_auth_table = db[auth.settings.table_user_name]
...
auth.settings.table_user = custom_auth_table

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-03 Thread Avi A
Thank you very much!


On Tuesday, December 3, 2013 8:34:18 AM UTC+2, Massimo Di Pierro wrote:
>
> Hello everybody,
>
> As you know I teach a certification program about web development with 
> Python and I use web2py. 
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and 
> supported these classes.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
I meanaged to add fileds, but insted of being the fileds of referenced 
table they were added to auth_user table all of them of type integer

I want them to be read from table organization

code in db.py

auth.settings.extra_fields['auth_user']= [
Field('o_name','reference organization',label = T('Org 
name'),),
Field('o_telnumber','reference organization'),
Field('o_street','reference organization'),
Field('o_city','reference organization'),
Field('o_state','reference organization'),
Field('o_country','reference organization'),
Field('o_TaxNumber','reference organization'),
Field('o_note','reference organization'),
]

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Online classes

2013-12-03 Thread Adnan Smajlovic
This is great! Thanks.
On Dec 3, 2013 1:34 AM, "Massimo Di Pierro" 
wrote:

> Hello everybody,
>
> As you know I teach a certification program about web development with
> Python and I use web2py.
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and
> supported these classes.
>
> Massimo
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] login crash under 2.8.2

2013-12-03 Thread lucas
hey everyone,

thanx for the help on my prior posts, things are moving along.  i now get a 
crash when i try to login under the application,  the traceback is:

Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/main.py", line 479, in wsgibase
session._try_store_in_cookie_or_file(request, response)
  File "/opt/web-apps/web2py/gluon/globals.py", line 1089, in 
_try_store_in_cookie_or_file
return self._try_store_in_file(request, response)
  File "/opt/web-apps/web2py/gluon/globals.py", line 1096, in _try_store_in_file
or self._unchanged(response)):
  File "/opt/web-apps/web2py/gluon/globals.py", line 1041, in _unchanged
session_pickled = cPickle.dumps(self)
  File "/usr/lib/python2.6/copy_reg.py", line 84, in _reduce_ex
dict = getstate()
TypeError: 'NoneType' object is not callable

none of this points to my code, so i believe it is in web2py.  or, do i have to 
adjust something in my code to compensate for the update.  i have cleared all 
sessions and copied the web2py.js appadmin.html and appadmin.py into my 
applications and made the appropriate changes in apache config files as per my 
prior two tickets.

ok, lucas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Online classes

2013-12-03 Thread Vinicius Assef
Excellent, Massimo, :-)

On Tue, Dec 3, 2013 at 4:34 AM, Massimo Di Pierro
 wrote:
> Hello everybody,
>
> As you know I teach a certification program about web development with
> Python and I use web2py.
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and
> supported these classes.
>
> Massimo
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread Yebach
I left the default auth.create_table(migrate = setting.migrate)
then added extra fields
then deffined my table organization

in user profile only first name, last name and email are shown

where am I going wrong?



On Tuesday, December 3, 2013 11:14:45 AM UTC+1, 黄祥 wrote:
>
> i think you shouldn't define the auth_user table, just keep it default, 
> and if you want to add the new field of auth_user table, please use 
> extra_fields. e.g.
> # append fields : auth.signature
> db._common_fields.append(auth.signature)
>
> # custom auth user table add fields gender, address, zip_code, city, 
> country, phone, branch, bank, account_no
> auth.settings.extra_fields['auth_user'] = [ 
> Field('gender', 
>   label = T('Gender'), 
>   notnull = True, 
>   required = True, 
>   requires = IS_IN_SET({T('Male'), T('Female') } ) ), 
> Field('address', 'text', 
>   label = T('Address'), 
>   notnull = True, 
>   represent = lambda address, field: A(address, _title=T("View Maps"), 
> _target="_blank", _href="
> http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=%s,+%s,+%s";
>  
> % (field.address, field.city, field.country) ), 
>   required = True, 
>   requires = IS_NOT_EMPTY() ), 
> Field('zip_code', 
>   label = T('Zip Code'), 
>   notnull = True, 
>   required = True, 
>   requires = IS_MATCH('^\d{5,5}$', error_message = 'not a Zip Code') ), 
> Field('city', 
>   label = T('City'), 
>   notnull = True, 
>   required = True, 
>   requires = IS_NOT_EMPTY() ), 
> Field('country', 
>   label = T('Country'), 
>   notnull = True, 
>   required = True, 
>   requires = IS_NOT_EMPTY() ), 
> Field('phone', 'list:string', 
>   label = T('Phone'), 
>   notnull = True, 
>   required = True), 
> Field('branch', 'reference branch', 
>   label = T('Branch'), 
>   notnull = True, 
>   required = True, 
>   requires = IS_IN_DB(db, db.branch.id, '%(address)s') ), 
> Field('bank', 'reference bank', 
>   label = T('Bank'), 
>   notnull = True, 
>   represent = lambda bank, field: A(bank.bank, _title=T("eBanking"), 
> _target="_blank", _href="%s" % bank.ebanking), 
>   required = True, 
>   requires = IS_IN_DB(db, db.bank.id, '%(bank)s') ), 
> Field('account_no', 
>   label = T('Account No'), 
>   notnull = True, 
>   required = True, 
>   requires = IS_NOT_EMPTY() ), 
> ]
>
> # create all tables needed by auth if not custom tables, add username field
> auth.define_tables(username = True, signature = True)
>
> """ custom_auth_table """
> custom_auth_table = db[auth.settings.table_user_name]
> # label
> custom_auth_table.first_name.label = T('First Name')
> custom_auth_table.last_name.label = T('Last Name')
> custom_auth_table.email.label = T('Email')
> # represent
> custom_auth_table.email.represent = lambda email, field: \
> A(email, _title=T("Send to %s") % email, _target="_blank", 
> _href="mailto:%s"; % email)
> # requires
> custom_auth_table.phone.requires = IS_NOT_IN_DB(db, 
> custom_auth_table.phone)
>
> auth.settings.table_user = custom_auth_table
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: user profile fields for referenced table

2013-12-03 Thread 黄祥
i think you shouldn't define the auth_user table, just keep it default, and 
if you want to add the new field of auth_user table, please use 
extra_fields. e.g.
# append fields : auth.signature
db._common_fields.append(auth.signature)

# custom auth user table add fields gender, address, zip_code, city, 
country, phone, branch, bank, account_no
auth.settings.extra_fields['auth_user'] = [ 
Field('gender', 
  label = T('Gender'), 
  notnull = True, 
  required = True, 
  requires = IS_IN_SET({T('Male'), T('Female') } ) ), 
Field('address', 'text', 
  label = T('Address'), 
  notnull = True, 
  represent = lambda address, field: A(address, _title=T("View Maps"), 
_target="_blank", 
_href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=%s,+%s,+%s";
 
% (field.address, field.city, field.country) ), 
  required = True, 
  requires = IS_NOT_EMPTY() ), 
Field('zip_code', 
  label = T('Zip Code'), 
  notnull = True, 
  required = True, 
  requires = IS_MATCH('^\d{5,5}$', error_message = 'not a Zip Code') ), 
Field('city', 
  label = T('City'), 
  notnull = True, 
  required = True, 
  requires = IS_NOT_EMPTY() ), 
Field('country', 
  label = T('Country'), 
  notnull = True, 
  required = True, 
  requires = IS_NOT_EMPTY() ), 
Field('phone', 'list:string', 
  label = T('Phone'), 
  notnull = True, 
  required = True), 
Field('branch', 'reference branch', 
  label = T('Branch'), 
  notnull = True, 
  required = True, 
  requires = IS_IN_DB(db, db.branch.id, '%(address)s') ), 
Field('bank', 'reference bank', 
  label = T('Bank'), 
  notnull = True, 
  represent = lambda bank, field: A(bank.bank, _title=T("eBanking"), 
_target="_blank", _href="%s" % bank.ebanking), 
  required = True, 
  requires = IS_IN_DB(db, db.bank.id, '%(bank)s') ), 
Field('account_no', 
  label = T('Account No'), 
  notnull = True, 
  required = True, 
  requires = IS_NOT_EMPTY() ), 
]

# create all tables needed by auth if not custom tables, add username field
auth.define_tables(username = True, signature = True)

""" custom_auth_table """
custom_auth_table = db[auth.settings.table_user_name]
# label
custom_auth_table.first_name.label = T('First Name')
custom_auth_table.last_name.label = T('Last Name')
custom_auth_table.email.label = T('Email')
# represent
custom_auth_table.email.represent = lambda email, field: \
A(email, _title=T("Send to %s") % email, _target="_blank", 
_href="mailto:%s"; % email)
# requires
custom_auth_table.phone.requires = IS_NOT_IN_DB(db, custom_auth_table.phone)

auth.settings.table_user = custom_auth_table

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] web2py logging

2013-12-03 Thread Jayadevan M
Hi,
I am trying to get logging working. Quite a few doubts. This is the entry 
in logging.conf
[logger_myapp]
level=INFO
qualname=web2py.app.myapp
handlers=rotatingFileHandler
propagate=0

Where will the log end up? We are using uwsgi and I do see the entries in 
/var/log/uwsgi/uwsgi.log, along with other entries created by uesgi. Is 
that the 'right' place?
The variable qualname, what is the significance?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] user profile fields for referenced table

2013-12-03 Thread Yebach
Hello

I have the following question

In user register I show only some fields for user, but in user profile I 
would like to add more fields. 

This fields come from tables referenced on auth_user table

my db.py code so far is

db.define_table('auth_user',
Field('username', type='string',
  label=T('Username')),
Field('first_name', type='string',
  label=T('First Name')),
Field('last_name', type='string',
  label=T('Last Name')),
Field('email', type='string',
  label=T('Email')),
Field('password', type='password',
  readable=False,
  label=T('Password')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
Field('registration_key',default='',
  writable=False,readable=False),
Field('reset_password_key',default='',
  writable=False,readable=False),
Field('registration_id',default='',
  writable=False,readable=False),
Field('organization', 'reference organization'),   reference to 
table organization
format='%(username)s',
migrate=settings.migrate)


##fileds from table organization
auth.settings.extra_fields['auth_user']= [
Field('o_name','reference organization'),
Field('o_telnumber','reference organization'),
Field('o_street','reference organization'),
Field('o_city','reference organization'),
Field('o_state','reference organization'),
Field('o_country','reference organization'),
Field('o_TaxNumber','reference organization'),
Field('o_note','reference organization'),
]


## table organization


db.define_table('organization',
 Field('o_id_o',type='integer' ),
 Field('o_usern',type='integer' ),
 Field('o_daten',type='date'),
 Field('o_useru',type='integer' ),
 Field('o_dateu',type='date' ),
 Field('o_status',type='integer' ),
 Field('o_code',type='string', length = 64 ),
 Field('o_name',type='string', length = 256 ),
 Field('o_telnumber',type='string', length = 64 ),
 Field('o_faxnumber',type='string', length = 64 ),
 Field('o_street',type='string', length = 64 ),
 Field('o_post',type='string', length = 64 ),
 Field('o_city',type='string', length = 64 ),
 Field('o_state',type='string', length = 64 ),
 Field('o_country',type='string', length = 64 ),
 Field('o_TaxNumber',type='string', length = 64 ),
 Field('o_rootid',type='integer' ),
 Field('o_parentid',type='integer' ),
 Field('o_levelid',type='integer'), 
 Field('o_positionx',type='string', length = 64 ),
 Field('o_positiony',type='string', length = 64 ),
 Field('o_note',type = 'text'),
 migrate=settings.migrate)


auth.define_tables(migrate = settings.migrate)

On user profile only field organization is shown, but no additional fields

any suggestions what am I doing wrong??
thank you

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] most web2py appliances with appengine wont work out of the box.

2013-12-03 Thread Philip Kilner
Hi,

On 03/12/13 03:16, ID wrote:
> I'm trying to setup web2py on Appengine, admin and example app works
> but, most of the apps under appliances wont work out of the box and
> issues a ticket..  in particular i'm interested to setup a little forum
> with pyforum2, that too does not work and issues a ticket. :(
> 

Can you tell us what error the ticket gives you? There isn't much to go
on, so far.

There is a section in the book on GAE deployment, which may be useful [1].

The biggest difference between AppEngine and other options is the GAE
datastore, which does not support all of the features available to
web2py with an RDBMS. It may be that the appliance you are using is
configured to use an RDBMS, and that you would need to modify it to use
the GAE datastore.

Alternatively, if your issues is related to this, you may find that
using Google's CloudSQL [2] (e.g. MySQL) is a better option for you.

[1]
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Deploying-on-Google-App-Engine

[2] https://developers.google.com/cloud-sql/

HTH


-- 

Regards,

PhilK


'a bell is a cup...until it is struck'

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.