[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-12 Thread Greg White
At our facility we order a lot of unique items but also have an inventory 
of some items. I am trying to add some logic that when ordering an item, 
there is a check to see if the ordered item name is in the inventory 
(inventory.name). Then person ordering is made aware that a similar item is 
in inventory and maybe we need to pull that item out of inventory versus 
ordering that part if it is indeed the correct part, size, color etc... 

On Thursday, February 11, 2016 at 5:52:23 PM UTC-7, Anthony wrote:
>
> What are you trying to do? Do you want to store this information in the 
> POrequest table, or do you want to prevent inserts if the item is not in 
> the db.inventory table? If the latter, IS_IN_DB will certainly work, but 
> note that validators only get run if you are using SQLFORM or if you call 
> .validate_and_insert().
>
> Anthony
>
> On Thursday, February 11, 2016 at 6:02:16 PM UTC-5, Greg White wrote:
>>
>> I should have mentioned that I tried IS_IN_DB first off and it didn't work
>>
>> On Wednesday, February 10, 2016 at 4:25:48 PM UTC-7, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, February 10, 2016 at 2:01:52 PM UTC-8, Greg White wrote:
>>>>
>>>> Want a computed field to show whether or not a field value exists in 
>>>> another table
>>>>
>>>
>>>
>>> I'm not sure that is the right approach.  I think that the standard 
>>> validator IS_IN_DB() is what you want, instead.
>>>
>>> >> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators
>>> >
>>> (IS_IN_DB is the second validator in that section)
>>>
>>> The example shown appears to be similar to what I think you're trying to 
>>> do.
>>>
>>> /dps
>>>
>>>
>>>> started with this...
>>>>
>>>> db.define_table(
>>>> 'inventory',
>>>> Field('name'),
>>>> Field('qty', label='Quantity'),
>>>> Field('MatSize',label='Material Size'),
>>>> format = '%(name)s') 
>>>>
>>>> db.define_table(
>>>> 'POrequest',
>>>> Field('name', 'reference requestor', label='Requestor'),
>>>> Field('JobNum', 'reference jobs', label='Job #'),
>>>> Field('description', 'text', notnull=True),
>>>> Field('InInventory', compute=lambda r: r['description'] IN r[
>>>> db.inventory.name]),  <<< this row right here is what I need help with
>>>> format = '%(name)s')
>>>>
>>>> trying to verify row by row in a computed field if 
>>>> db.POrequest.description is in any row of db.inventory.name
>>>>
>>>> help please.
>>>>
>>>

-- 
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/d/optout.


[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-11 Thread Greg White
I should have mentioned that I tried IS_IN_DB first off and it didn't work

On Wednesday, February 10, 2016 at 4:25:48 PM UTC-7, Dave S wrote:
>
>
>
> On Wednesday, February 10, 2016 at 2:01:52 PM UTC-8, Greg White wrote:
>>
>> Want a computed field to show whether or not a field value exists in 
>> another table
>>
>
>
> I'm not sure that is the right approach.  I think that the standard 
> validator IS_IN_DB() is what you want, instead.
>
>  http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators
> >
> (IS_IN_DB is the second validator in that section)
>
> The example shown appears to be similar to what I think you're trying to 
> do.
>
> /dps
>
>
>> started with this...
>>
>> db.define_table(
>> 'inventory',
>> Field('name'),
>> Field('qty', label='Quantity'),
>> Field('MatSize',label='Material Size'),
>> format = '%(name)s') 
>>
>> db.define_table(
>> 'POrequest',
>> Field('name', 'reference requestor', label='Requestor'),
>> Field('JobNum', 'reference jobs', label='Job #'),
>> Field('description', 'text', notnull=True),
>> Field('InInventory', compute=lambda r: r['description'] IN r[
>> db.inventory.name]),  <<< this row right here is what I need help with
>> format = '%(name)s')
>>
>> trying to verify row by row in a computed field if 
>> db.POrequest.description is in any row of db.inventory.name
>>
>> help please.
>>
>

-- 
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/d/optout.


[web2py] Check to see if a field is in another table in a computed field

2016-02-10 Thread Greg White
Want a computed field to show whether or not a field value exists in 
another table

started with this...

db.define_table(
'inventory',
Field('name'),
Field('qty', label='Quantity'),
Field('MatSize',label='Material Size'),
format = '%(name)s') 

db.define_table(
'POrequest',
Field('name', 'reference requestor', label='Requestor'),
Field('JobNum', 'reference jobs', label='Job #'),
Field('description', 'text', notnull=True),
Field('InInventory', compute=lambda r: r['description'] IN 
r[db.inventory.name]),  <<< this row right here is what I need help with
format = '%(name)s')

trying to verify row by row in a computed field if db.POrequest.description 
is in any row of db.inventory.name

help please.

-- 
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/d/optout.


[web2py] Re: importing .csv to create DAL object

2015-02-24 Thread Greg Born
This is one approach.

http://stackoverflow.com/questions/17799041/how-to-import-existing-mysql-database-into-web2py

On Monday, February 23, 2015 at 1:44:27 PM UTC-7, Abhijit Chatterjee wrote:

 If I have an old site n mysql database. N want to convert to web2py, 
 rather than typing up the entire Database from scratch, is there a way that 
 I export the existing mysql database to a csv n then import that .csv file 
 to DAL to create the database automatically?  

-- 
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/d/optout.


[web2py] Re: Not getting expected results from a query

2015-01-10 Thread Greg White
Thanks for the help, got it working. I need to learn some debugging 
techniques for web2py, but you have pointed me in the right direction for 
this kind of problem, if anyone has any suggested links it would be 
appreciated, thanks! 

On Friday, January 9, 2015 at 1:15:13 AM UTC-7, Niphlod wrote:

 then do a 

 def cost3():
 jnum = request.args(0,cast=int)
 a = 0
 thequery = db(db.PO.job_id==jnum)._select()
 results = db(db.PO.job_id==jnum).select()
 for row in results:
 a = a + row.mycost
 return dict(a=a, howmany=len(results), thequery=thequery)

 too see if the underlying t-sql is correct.


-- 
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/d/optout.


[web2py] Re: Not getting expected results from a query

2015-01-08 Thread Greg White
I swapped that code in and like I suspected it isn't iterating through any 
row selections the results were 0 and 0.  Could it have anything to do with 
the fact that the field referenced references another table and field? 

db.define_table('PO',
Field('job_id', db.jobinfo ),

still stumped but thanks for the response

On Monday, January 5, 2015 at 1:15:38 PM UTC-7, Niphlod wrote:

 start with:

 def cost3():
 jnum = request.args(0,cast=int)
 a = 0
 results = db(db.PO.job_id==jnum).select()
 for row in results:

 a = a + row.mycost
 return dict(a=a, howmany=len(results))



 so you can check how many rows are you actually selecting :P


 On Sunday, January 4, 2015 4:17:03 AM UTC+1, Greg White wrote:

 I am brand new to web2py and know a little python, so I am a definite 
 novice. I am trying to build a purchasing agent app and am getting result 
 0 from function cost3. I am expecting to get a sum of the values for a 
 specified job number (in cost2) in table PO Field mycost when I specify a 
 job number in function cost2.. but I am not getting a sum of those numbers 
 but am getting 0 instead. Any help would be appreciated, thanks.

 db

 db.define_table('jobinfo',
 Field('jobnumber', 'integer', requires=IS_NOT_EMPTY()),
 Field('jobname', 'string', requires=IS_NOT_EMPTY()),
 Field('jobbudget', 'double'),
 format = '%(jobnumber)s')

 db.define_table('vendortype',
 Field('vtype', 'string', requires=IS_NOT_EMPTY()),
 format = '%(vtype)s')

 db.define_table('vendorr',
 Field('company_name',requires=IS_NOT_EMPTY()),
 Field('address1',requires=IS_NOT_EMPTY()),
 Field('address2'),
 Field('city',requires=IS_NOT_EMPTY()),
 Field('co_state',requires=IS_NOT_EMPTY()),
 Field('zip',requires=IS_NOT_EMPTY()),
 Field('vendor_type', db.vendortype),
 Field('terms'),
 format = '%(company_name)s')

 db.define_table('POreq',
 Field('job_id', db.jobinfo, requires=IS_NOT_EMPTY()),
 Field('Vendor_id', db.vendorr, requires=IS_NOT_EMPTY()),
 Field('Qty_1'),
 Field('Description_1'),
 Field('Notes_1'),
 Field('RequiredBy_1','date'),
 format = '%(Vendor_id)s')

 db.define_table('PO',
 Field('job_id', db.jobinfo ),
 Field('vname',db.vendorr),
 Field('Qty_1', 'double'),
 Field('Description_1'),
 Field('Notes_1'),
 Field('RequiredBy_1','date'),
 Field('mycost', 'double'),
 format = '%(job_id)s')

 controller

 def cost2():
 form=FORM('Job Number: ',
 INPUT(_name='jobnumber', requires=IS_INT_IN_RANGE(0,9000)),
 INPUT(_type='submit')).process()
 if form.accepted:
 redirect(URL('cost3',args=form.vars.jobnumber))
 return dict(form=form)

 def cost3():
 jnum = request.args(0,cast=int)
 a = 0
 for row in db(db.PO.job_id==jnum).select():
 a = a + row.mycost
 return a



-- 
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/d/optout.


[web2py] Not getting expected results from a query

2015-01-05 Thread Greg White
I am brand new to web2py and know a little python, so I am a definite 
novice. I am trying to build a purchasing agent app and am getting result 
0 from function cost3. I am expecting to get a sum of the values for a 
specified job number (in cost2) in table PO Field mycost when I specify a 
job number in function cost2.. but I am not getting a sum of those numbers 
but am getting 0 instead. Any help would be appreciated, thanks.

db

db.define_table('jobinfo',
Field('jobnumber', 'integer', requires=IS_NOT_EMPTY()),
Field('jobname', 'string', requires=IS_NOT_EMPTY()),
Field('jobbudget', 'double'),
format = '%(jobnumber)s')

db.define_table('vendortype',
Field('vtype', 'string', requires=IS_NOT_EMPTY()),
format = '%(vtype)s')

db.define_table('vendorr',
Field('company_name',requires=IS_NOT_EMPTY()),
Field('address1',requires=IS_NOT_EMPTY()),
Field('address2'),
Field('city',requires=IS_NOT_EMPTY()),
Field('co_state',requires=IS_NOT_EMPTY()),
Field('zip',requires=IS_NOT_EMPTY()),
Field('vendor_type', db.vendortype),
Field('terms'),
format = '%(company_name)s')

db.define_table('POreq',
Field('job_id', db.jobinfo, requires=IS_NOT_EMPTY()),
Field('Vendor_id', db.vendorr, requires=IS_NOT_EMPTY()),
Field('Qty_1'),
Field('Description_1'),
Field('Notes_1'),
Field('RequiredBy_1','date'),
format = '%(Vendor_id)s')

db.define_table('PO',
Field('job_id', db.jobinfo ),
Field('vname',db.vendorr),
Field('Qty_1', 'double'),
Field('Description_1'),
Field('Notes_1'),
Field('RequiredBy_1','date'),
Field('mycost', 'double'),
format = '%(job_id)s')

controller

def cost2():
form=FORM('Job Number: ',
INPUT(_name='jobnumber', requires=IS_INT_IN_RANGE(0,9000)),
INPUT(_type='submit')).process()
if form.accepted:
redirect(URL('cost3',args=form.vars.jobnumber))
return dict(form=form)

def cost3():
jnum = request.args(0,cast=int)
a = 0
for row in db(db.PO.job_id==jnum).select():
a = a + row.mycost
return a

-- 
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/d/optout.


[web2py] list:string type issues

2014-10-05 Thread Greg Vaughan
Hi Guys,

I am using a list:string to store a list of lists. Each seperate list has 4 
values, qty (int), name (string), description (text) and price(double). 
Stores nicely and looks fine in the db table eg.

[1, 'OS 7030', 'OS 7030', 755.0], [3, 'SMT 24 Btn', 'SMT IP Phone', 360.0], 
[1, 'SMT IP', 'SMT IP Phone Licence', 70.0], [1, '2830 SIP Router', '2830', 
499.0], [1, 'ADSL Central Filter ', 'ADSL Central Filter ', 61.5]

However if I try to iterate and get some totals it is getting confused. For 
example the same list above becomes...

[[1, 'OS 7030', 'OS 7030', 755.0], [3, 'SMT 24 Btn', 'SMT IP Phone', 
360.0], [1, 'SMT IP', 'SMT IP Phone Licence', 70.0], [1, '2830 SIP 
Router', '2830', 499.0], [1, 'ADSL Central Filter ', 'ADSL Central Filter 
', 61.5]]

Iterating list[0] returns [ [ [ [ [  list[1] returns 1 3 1 1 1 list[2] , , 
, , , list[3] returns a list of the spaces, list[4] the apostrophes ' ' ' ' 
' list[5] O S S 2 A etc etc...

What do I have to change so that it is being interpreted correctly?




-- 
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/d/optout.


[web2py] Re: list:string type issues

2014-10-05 Thread Greg Vaughan
Ahh Anthony what would we do without you... tyvm... (again)

a few quick changes to code and works a charm...

Cheers
Greg

On Monday, 6 October 2014 00:48:09 UTC+10, Anthony wrote:

 Can you show your code? If you want to store a Python structure, you're 
 probably better off using a json field type, which will automatically 
 serialize back and forth between Python and JSON (the list:string type is 
 meant for storing a list of strings, not a list of Python lists).

 Anthony

 On Sunday, October 5, 2014 5:45:44 AM UTC-4, Greg Vaughan wrote:

 Hi Guys,

 I am using a list:string to store a list of lists. Each seperate list has 
 4 values, qty (int), name (string), description (text) and price(double). 
 Stores nicely and looks fine in the db table eg.

 [1, 'OS 7030', 'OS 7030', 755.0], [3, 'SMT 24 Btn', 'SMT IP Phone', 
 360.0], [1, 'SMT IP', 'SMT IP Phone Licence', 70.0], [1, '2830 SIP Router', 
 '2830', 499.0], [1, 'ADSL Central Filter ', 'ADSL Central Filter ', 61.5]

 However if I try to iterate and get some totals it is getting confused. 
 For example the same list above becomes...

 [[1, 'OS 7030', 'OS 7030', 755.0], [3, 'SMT 24 Btn', 'SMT IP Phone', 
 360.0], [1, 'SMT IP', 'SMT IP Phone Licence', 70.0], [1, '2830 SIP 
 Router', '2830', 499.0], [1, 'ADSL Central Filter ', 'ADSL Central Filter 
 ', 61.5]]

 Iterating list[0] returns [ [ [ [ [  list[1] returns 1 3 1 1 1 list[2] , 
 , , , , list[3] returns a list of the spaces, list[4] the apostrophes ' ' ' 
 ' ' list[5] O S S 2 A etc etc...

 What do I have to change so that it is being interpreted correctly?






-- 
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/d/optout.


[web2py] insert and update SQLFORM.factory

2014-09-09 Thread Greg Vaughan
I am trying to do a combined update and insert using SQLFORM.factory with 
some redirects for good measure.

Everything works fine except the update which fails to alter the record in 
question.

@auth.requires_login()
def remote_check():
j_id=request.args[0]
for row in db(db.job_requests.id==j_id).select(db.job_requests.
business_name, db.job_requests.cta, db.job_requests.spoke_to, db.
job_requests.job_result, db.job_requests.job_note):
bus = row.business_name
contact = row.spoke_to
cta = row.cta
jn = row.job_note
jr = row.job_result
for row in db(db.clients.id==row.business_name).select(db.clients.id
, db.clients.phone):
c_id=str(row.id)
phone=row.phone
address = get_client_address(c_id)
db.job_requests.id.readable=False
db.job_requests.business_name.default=c_id
db.job_requests.business_name.writable=False
db.job_requests.sr_number.writable=False
db.job_requests.sr_number.readable=False
db.job_requests.cta.default=cta
db.job_requests.cta.writable=False
db.job_requests.send_via.writable=False
db.job_requests.send_via.readable=False
db.job_requests.email_to.writable=False
db.job_requests.email_to.readable=False
db.job_requests.fax_to.writable=False
db.job_requests.fax_to.readable=False
db.job_requests.snd_other.writable=False
db.job_requests.snd_other.readable=False
db.job_requests.spoke_to.default=contact
db.job_requests.spoke_to.writable=False
db.job_requests.job_result.default=jr
db.job_requests.job_note.default=jn
db.job_requests.job_note.writable=False
db.tech_notes.business_name.default=c_id
db.tech_notes.business_name.writable=False
form=SQLFORM.factory(db.job_requests,db.tech_notes,table_name=
'remote_check')
if form.process().accepted:
session.flash = 'Job Updated'
db.tech_notes.insert(**db.tech_notes._filter_fields(form.vars))
redirect(URL('ops', 'tech_main_page'))
if form.vars.job_result=='Completed':
db.job_requests.update(**db.job_requests._filter_fields(form.
vars))
redirect(URL('ops', 'tech_main_page'))
else:
redirect(URL('ops', 'maintenance_customer_service_request'))
elif form.errors:
response.flash = 'Form has errors'
return dict(form=form,phone=phone,address=address,left_sidebar_enabled=
True,right_sidebar_enabled=True)

Any hints please?

-- 
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/d/optout.


[web2py] Re: insert and update SQLFORM.factory

2014-09-09 Thread Greg Vaughan
Thanks Anthony,

Altered the code to fix those two issues and that took me back to the 
original problem that I had which is syntax not supported

relevant section is now...

...
form=SQLFORM.factory(db.job_requests,db.tech_notes,table_name='remote_check'
)
if form.process().accepted:
session.flash = 'Job Updated'
db.tech_notes.insert(**db.tech_notes._filter_fields(form.vars))
db.job_requests.update(**db.job_requests._filter_fields(form.vars))
if form.vars.job_result=='Completed':
redirect(URL('ops', 'tech_main_page'))
else:
redirect(URL('ops', 'maintenance_customer_service_request'))...

and the error...

  File c:/Users/gsv/Desktop/web2py/applications/eco/controllers/ops.py 
http://127.0.0.1:8000/admin/default/edit/eco/controllers/ops.py, line 129, 
in remote_check

db.job_requests.update(**db.job_requests._filter_fields(form.vars))
  File c:\Users\gsv\Desktop\web2py\gluon\dal.py, line 8790, in update
raise RuntimeError(Syntax Not Supported)
RuntimeError: Syntax Not Supported


Which is not a surprise... I tried to adapt posts from here and the 
examples in the book but I don't get SQLFORM well enough to see where I am 
screwing it up...

Can you point me in the right direction please?

Cheers
Greg


On Tuesday, 9 September 2014 23:30:46 UTC+10, Anthony wrote:

 You've got a redirect right before the update code, so it will never get 
 to execute that code.

 Also, your two tables include a field with the same name 
 (business_name), so putting them both in SQLFORM.factory won't work 
 properly.

 Anthony

 On Tuesday, September 9, 2014 9:10:50 AM UTC-4, Greg Vaughan wrote:

 I am trying to do a combined update and insert using SQLFORM.factory with 
 some redirects for good measure.

 Everything works fine except the update which fails to alter the record 
 in question.

 @auth.requires_login()
 def remote_check():
 j_id=request.args[0]
 for row in db(db.job_requests.id==j_id).select(db.job_requests.
 business_name, db.job_requests.cta, db.job_requests.spoke_to, db.
 job_requests.job_result, db.job_requests.job_note):
 bus = row.business_name
 contact = row.spoke_to
 cta = row.cta
 jn = row.job_note
 jr = row.job_result
 for row in db(db.clients.id==row.business_name).select(db.clients
 .id, db.clients.phone):
 c_id=str(row.id)
 phone=row.phone
 address = get_client_address(c_id)
 db.job_requests.id.readable=False
 db.job_requests.business_name.default=c_id
 db.job_requests.business_name.writable=False
 db.job_requests.sr_number.writable=False
 db.job_requests.sr_number.readable=False
 db.job_requests.cta.default=cta
 db.job_requests.cta.writable=False
 db.job_requests.send_via.writable=False
 db.job_requests.send_via.readable=False
 db.job_requests.email_to.writable=False
 db.job_requests.email_to.readable=False
 db.job_requests.fax_to.writable=False
 db.job_requests.fax_to.readable=False
 db.job_requests.snd_other.writable=False
 db.job_requests.snd_other.readable=False
 db.job_requests.spoke_to.default=contact
 db.job_requests.spoke_to.writable=False
 db.job_requests.job_result.default=jr
 db.job_requests.job_note.default=jn
 db.job_requests.job_note.writable=False
 db.tech_notes.business_name.default=c_id
 db.tech_notes.business_name.writable=False
 form=SQLFORM.factory(db.job_requests,db.tech_notes,table_name=
 'remote_check')
 if form.process().accepted:
 session.flash = 'Job Updated'
 db.tech_notes.insert(**db.tech_notes._filter_fields(form.vars))
 redirect(URL('ops', 'tech_main_page'))
 if form.vars.job_result=='Completed':
 db.job_requests.update(**db.job_requests._filter_fields(form.
 vars))
 redirect(URL('ops', 'tech_main_page'))
 else:
 redirect(URL('ops', 'maintenance_customer_service_request'))
 elif form.errors:
 response.flash = 'Form has errors'
 return dict(form=form,phone=phone,address=address,
 left_sidebar_enabled=True,right_sidebar_enabled=True)

 Any hints please?



-- 
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/d/optout.


[web2py] Re: insert and update SQLFORM.factory

2014-09-09 Thread Greg Vaughan
Sigh I just realised that I am not specifying a record to update in that 
code... of course that won't work...

On Tuesday, 9 September 2014 23:30:46 UTC+10, Anthony wrote:

 You've got a redirect right before the update code, so it will never get 
 to execute that code.

 Also, your two tables include a field with the same name 
 (business_name), so putting them both in SQLFORM.factory won't work 
 properly.

 Anthony

 On Tuesday, September 9, 2014 9:10:50 AM UTC-4, Greg Vaughan wrote:

 I am trying to do a combined update and insert using SQLFORM.factory with 
 some redirects for good measure.

 Everything works fine except the update which fails to alter the record 
 in question.

 @auth.requires_login()
 def remote_check():
 j_id=request.args[0]
 for row in db(db.job_requests.id==j_id).select(db.job_requests.
 business_name, db.job_requests.cta, db.job_requests.spoke_to, db.
 job_requests.job_result, db.job_requests.job_note):
 bus = row.business_name
 contact = row.spoke_to
 cta = row.cta
 jn = row.job_note
 jr = row.job_result
 for row in db(db.clients.id==row.business_name).select(db.clients
 .id, db.clients.phone):
 c_id=str(row.id)
 phone=row.phone
 address = get_client_address(c_id)
 db.job_requests.id.readable=False
 db.job_requests.business_name.default=c_id
 db.job_requests.business_name.writable=False
 db.job_requests.sr_number.writable=False
 db.job_requests.sr_number.readable=False
 db.job_requests.cta.default=cta
 db.job_requests.cta.writable=False
 db.job_requests.send_via.writable=False
 db.job_requests.send_via.readable=False
 db.job_requests.email_to.writable=False
 db.job_requests.email_to.readable=False
 db.job_requests.fax_to.writable=False
 db.job_requests.fax_to.readable=False
 db.job_requests.snd_other.writable=False
 db.job_requests.snd_other.readable=False
 db.job_requests.spoke_to.default=contact
 db.job_requests.spoke_to.writable=False
 db.job_requests.job_result.default=jr
 db.job_requests.job_note.default=jn
 db.job_requests.job_note.writable=False
 db.tech_notes.business_name.default=c_id
 db.tech_notes.business_name.writable=False
 form=SQLFORM.factory(db.job_requests,db.tech_notes,table_name=
 'remote_check')
 if form.process().accepted:
 session.flash = 'Job Updated'
 db.tech_notes.insert(**db.tech_notes._filter_fields(form.vars))
 redirect(URL('ops', 'tech_main_page'))
 if form.vars.job_result=='Completed':
 db.job_requests.update(**db.job_requests._filter_fields(form.
 vars))
 redirect(URL('ops', 'tech_main_page'))
 else:
 redirect(URL('ops', 'maintenance_customer_service_request'))
 elif form.errors:
 response.flash = 'Form has errors'
 return dict(form=form,phone=phone,address=address,
 left_sidebar_enabled=True,right_sidebar_enabled=True)

 Any hints please?



-- 
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/d/optout.


[web2py] type 'exceptions.RuntimeError' File.../databases/c8b....sales.table appears corrupted

2014-09-05 Thread Greg Vaughan
Somehow the sales table in my site has been corrupted... it is now a 0kb 
file (was about 600KB). Every other table is fine however. How can I 
reconstruct the data in this table? I have a backed up csv which is a 
little out of date but would do.

Thanks
Greg

-- 
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/d/optout.


[web2py] Re: type 'exceptions.RuntimeError' File.../databases/c8b....sales.table appears corrupted

2014-09-05 Thread Greg Vaughan
Yeah... everything was fine one moment then it all just stopped... when I 
looked at the file it was 0kb. I have no idea what happened... cannot 
access database admin... site still runs except for the functions that 
access that table... 

On Saturday, 6 September 2014 02:22:31 UTC+10, Greg Vaughan wrote:

 Somehow the sales table in my site has been corrupted... it is now a 0kb 
 file (was about 600KB). Every other table is fine however. How can I 
 reconstruct the data in this table? I have a backed up csv which is a 
 little out of date but would do.

 Thanks
 Greg


-- 
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/d/optout.


[web2py] Re: type 'exceptions.RuntimeError' File.../databases/c8b....sales.table appears corrupted

2014-09-05 Thread Greg Vaughan
I wasn't working on the site at the time... I was notified by some of the 
employees... yes it looks like the table has been dropped... I cannot for 
the life of me work out how that could have happened though.

On Saturday, 6 September 2014 02:41:30 UTC+10, Leonel Câmara wrote:

 Err wait a minute the table has actually been dropped?


-- 
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/d/optout.


Re: [web2py] Re: type 'exceptions.RuntimeError' File.../databases/c8b....sales.table appears corrupted

2014-09-05 Thread Greg Vaughan
Tried fake_migrate... production site on pythonanywhere so disk space 
wasn't the issue... scratching my head with this...

On Saturday, 6 September 2014 02:55:23 UTC+10, Marin Pranjić wrote:

 It can happen if you run out of disk space. You should check it.

 Btw, maybe just .table got corrupted... Make sure to backup everything, 
 and then do a fake migrate.

 Marin


 On Fri, Sep 5, 2014 at 6:51 PM, Greg Vaughan greg.s@gmail.com 
 javascript: wrote:

 I wasn't working on the site at the time... I was notified by some of the 
 employees... yes it looks like the table has been dropped... I cannot for 
 the life of me work out how that could have happened though.


 On Saturday, 6 September 2014 02:41:30 UTC+10, Leonel Câmara wrote:

 Err wait a minute the table has actually been dropped?

  -- 
 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 javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


Re: [web2py] Re: type 'exceptions.RuntimeError' File.../databases/c8b....sales.table appears corrupted

2014-09-05 Thread Greg Vaughan
Version
Enter code here...


  web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07  Python Python 
2.7.5+: /usr/local/bin/uwsgi (prefix: /usr)  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

Traceback (most recent call last):
  File /home/gsv/enertek/web2py/gluon/restricted.py, line 217, in restricted
exec ccode in environment
  File /home/gsv/enertek/web2py/applications/welcome/models/marketing.py 
https://www.enerteksecure.com/admin/default/edit/welcome/models/marketing.py, 
line 198, in module
auth.signature
  File /home/gsv/enertek/web2py/gluon/dal.py, line 8139, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File /home/gsv/enertek/web2py/gluon/dal.py, line 8176, in lazy_define_table
polymodel=polymodel)
  File /home/gsv/enertek/web2py/gluon/dal.py, line 1079, in create_table
raise RuntimeError('File %s appears corrupted' % table._dbt)
RuntimeError: File 
/home/gsv/enertek/web2py/applications/welcome/databases/c8b669d15150d7109e5f7ab36744a5b7_sales_leads.table
 appears corrupted



On Saturday, 6 September 2014 03:05:27 UTC+10, Greg Vaughan wrote:

 Tried fake_migrate... production site on pythonanywhere so disk space 
 wasn't the issue... scratching my head with this...

 On Saturday, 6 September 2014 02:55:23 UTC+10, Marin Pranjić wrote:

 It can happen if you run out of disk space. You should check it.

 Btw, maybe just .table got corrupted... Make sure to backup everything, 
 and then do a fake migrate.

 Marin


 On Fri, Sep 5, 2014 at 6:51 PM, Greg Vaughan greg.s@gmail.com 
 wrote:

 I wasn't working on the site at the time... I was notified by some of 
 the employees... yes it looks like the table has been dropped... I cannot 
 for the life of me work out how that could have happened though.


 On Saturday, 6 September 2014 02:41:30 UTC+10, Leonel Câmara wrote:

 Err wait a minute the table has actually been dropped?

  -- 
 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.com/d/optout.




-- 
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/d/optout.


Re: [web2py] Re: type 'exceptions.RuntimeError' File.../databases/c8b....sales.table appears corrupted

2014-09-05 Thread Greg Vaughan
Fixed Thankfully... 
1) Renamed the table in the model
2) Uploaded the backup csv file to the renamed table... was about a week 
out of date
3) Manually deleted the corrupt file from the database
4) Created a new table with the old table name without fields and set 
migrate and fake_migrate to true
5) Deleted this model and renamed the model holding the backup files back 
to its original name...

and (quite miraculously) everything appeared as it was immediately before 
the crash...

Thanks for the help everyone...

On Saturday, 6 September 2014 03:15:27 UTC+10, Greg Vaughan wrote:

 Version
 Enter code here...


   web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07  Python Python 
 2.7.5+: /usr/local/bin/uwsgi (prefix: /usr)  Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.

 Traceback (most recent call last):
   File /home/gsv/enertek/web2py/gluon/restricted.py, line 217, in restricted
 exec ccode in environment
   File /home/gsv/enertek/web2py/applications/welcome/models/marketing.py 
 https://www.enerteksecure.com/admin/default/edit/welcome/models/marketing.py,
  line 198, in module
 auth.signature
   File /home/gsv/enertek/web2py/gluon/dal.py, line 8139, in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
   File /home/gsv/enertek/web2py/gluon/dal.py, line 8176, in 
 lazy_define_table
 polymodel=polymodel)
   File /home/gsv/enertek/web2py/gluon/dal.py, line 1079, in create_table
 raise RuntimeError('File %s appears corrupted' % table._dbt)
 RuntimeError: File 
 /home/gsv/enertek/web2py/applications/welcome/databases/c8b669d15150d7109e5f7ab36744a5b7_sales_leads.table
  appears corrupted



 On Saturday, 6 September 2014 03:05:27 UTC+10, Greg Vaughan wrote:

 Tried fake_migrate... production site on pythonanywhere so disk space 
 wasn't the issue... scratching my head with this...

 On Saturday, 6 September 2014 02:55:23 UTC+10, Marin Pranjić wrote:

 It can happen if you run out of disk space. You should check it.

 Btw, maybe just .table got corrupted... Make sure to backup everything, 
 and then do a fake migrate.

 Marin


 On Fri, Sep 5, 2014 at 6:51 PM, Greg Vaughan greg.s@gmail.com 
 wrote:

 I wasn't working on the site at the time... I was notified by some of 
 the employees... yes it looks like the table has been dropped... I cannot 
 for the life of me work out how that could have happened though.


 On Saturday, 6 September 2014 02:41:30 UTC+10, Leonel Câmara wrote:

 Err wait a minute the table has actually been dropped?

  -- 
 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.com/d/optout.




-- 
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/d/optout.


[web2py] Web2py Mobile Interface

2014-08-21 Thread Greg Vaughan
Hi Everyone,

I decided that it would be advantageous if i were able to code on the go to 
fix any issues that I see occurring in my hosted webapps. So I installed 
web2py on my android tablet. The process was relatively painless and the 
standard welcome app works perfectly... however when I attempted to install 
my packed app there was no way that I could see to do this.

I did see a git pull option however when atempting to use that it promply 
told me that I needed the gitpython module... (which I think is currently 
considered experimental?) before I go down that track is there any way to 
install a packed app, that I have missed?

Thanks
Greg

-- 
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/d/optout.


[web2py] Re: Web2py Mobile Interface

2014-08-21 Thread Greg Vaughan
Hi Massimo

I get the requires gitpython module so I cannot complete a pull request. 
I was hoping to be able to install the app as I would on the PC but that 
option is not available... should it be?

Thanks
Greg

On Friday, 22 August 2014 00:07:36 UTC+10, Massimo Di Pierro wrote:

 What error do you get when you try install an app?




-- 
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/d/optout.


Re: [web2py] Re: Error while inserting in table with custom id

2014-06-26 Thread Greg Sier
Seems to be a postgresql specific issue. Fails in the DAL at when executing
'select lastval()'. SQlite and MySQL are fine. The command also fails at
the pg command line level. This was changed back in December but uncertain
if the issue existed prior to this
https://groups.google.com/forum/?fromgroups#!searchin/web2py/select$20lastval().
Only came across it 3 hours before you when attempting bulk_insert from a
select.as_list() dict to move between databases. Cant see a quick or easy
work around, and the issue probably needs a PR.


On Thu, Jun 26, 2014 at 11:42 PM, at matifa...@gmail.com wrote:


 So it's incorrect or impermissible to add records with custom ids?

 Thanks



 On Thursday, 26 June 2014 16:33:02 UTC+5, at wrote:


 Yes you are right. Without id=1 it's working.
 But if I insert data using postgres/psql with id=1, it doesn't give any
 error as well.

 Regards,
 AT

 On Thursday, 26 June 2014 15:39:20 UTC+5, Simon Ashley wrote:

 Believe it will be failing with the id=1 etc. Interfering with the
 primary key/ auto increment. Try it without.

  --
 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/z-docU0cUN4/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/d/optout.




-- 
Greg Sier
Sier Associates AU
+61 7 55736422

-- 
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/d/optout.


[web2py] appadmin is disabled because insecure channel using default ipv6 local ::1 on windows with w2p 2.95

2014-06-16 Thread Greg Vaughan
Heading says it all... no problems using localhost IPv4...

Is this expected behaviour? Seems rather strange if so...

-- 
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/d/optout.


[web2py] Set which browser web2py opens in

2014-05-24 Thread Greg Vaughan
Is there any way to set the default browser for web2py to open in. It's 
normal behaviour is to use the computer default... can this be changed?

-- 
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/d/optout.


[web2py] Re: Display table as dictionary

2014-05-05 Thread Greg Vaughan
tyvm Massimo exactly what I was looking for... it works perfectly and now 
the rest of my code works :)

On Monday, 5 May 2014 14:46:19 UTC+10, Massimo Di Pierro wrote:

 fields = db(db.address.business==4L).select().first().as_dict()

 On Sunday, 4 May 2014 16:59:34 UTC-5, Greg Vaughan wrote:


 The following code

 fields = db(db.address.business==4L).select().as_dict()

 returns a dictionary of dictionaries

 {1L: {'street_name': 'Another', 'postcode': '4888', 'id': 1L, 'unit': 
 False, 'building_name': '', 'city': 'Deadsville', 'lot_section': None, 
 'sub_building': '', 'street_suffix': None, 'unit_type': None, 
 'cross_type': None, 'level_floor': False, 'is_corner': False, 
 'unit_number': '', 'lot': False, 'business': 4L, 'add_state': 'Qld', 
 'floor_number': '', 'street_type': 'STREET', 'cross_name': '', 'building'
 : False, 'street_number': 111L, 'cross_suffix': None, 'country': None, 
 'floor_type': None}}

 How do I return just the inner dictionary?

 {'street_name': 'Another', 'postcode': '4888', 'id': 1L, 'unit': False, 
 'building_name': '', 'city': 'Deadsville', 'lot_section': None, 
 'sub_building': '', 'street_suffix': None, 'unit_type': None, 
 'cross_type': None, 'level_floor': False, 'is_corner': False, 
 'unit_number': '', 'lot': False, 'business': 4L, 'add_state': 'Qld', 
 'floor_number': '', 'street_type': 'STREET', 'cross_name': '', 'building'
 : False, 'street_number': 111L, 'cross_suffix': None, 'country': None, 
 'floor_type': None} 



-- 
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/d/optout.


[web2py] Display table as dictionary

2014-05-04 Thread Greg Vaughan

The following code

fields = db(db.address.business==4L).select().as_dict()

returns a dictionary of dictionaries

{1L: {'street_name': 'Another', 'postcode': '4888', 'id': 1L, 'unit': False, 
'building_name': '', 'city': 'Deadsville', 'lot_section': None, 
'sub_building': '', 'street_suffix': None, 'unit_type': None, 'cross_type': 
None, 'level_floor': False, 'is_corner': False, 'unit_number': '', 'lot': 
False, 'business': 4L, 'add_state': 'Qld', 'floor_number': '', 'street_type'
: 'STREET', 'cross_name': '', 'building': False, 'street_number': 111L, 
'cross_suffix': None, 'country': None, 'floor_type': None}}

How do I return just the inner dictionary?

{'street_name': 'Another', 'postcode': '4888', 'id': 1L, 'unit': False, 
'building_name': '', 'city': 'Deadsville', 'lot_section': None, 
'sub_building': '', 'street_suffix': None, 'unit_type': None, 'cross_type': 
None, 'level_floor': False, 'is_corner': False, 'unit_number': '', 'lot': 
False, 'business': 4L, 'add_state': 'Qld', 'floor_number': '', 'street_type'
: 'STREET', 'cross_name': '', 'building': False, 'street_number': 111L, 
'cross_suffix': None, 'country': None, 'floor_type': None} 

-- 
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/d/optout.


[web2py] Re: web2py conference, next week!

2014-04-26 Thread Greg Vaughan
Make the next one in Sydney (Australia) Massimo :)

Just joking... all the best for it and looking forward to seeing the 
videos...

On Saturday, 26 April 2014 13:08:01 UTC+10, Massimo Di Pierro wrote:

 Please register only if you plan to attend in person. We will record the 
 talks and post them.

 On Friday, 25 April 2014 16:29:28 UTC-5, David Rager wrote:

 Is there an online option (if you don't tick the will attend in person)?

 On Thursday, April 24, 2014 9:20:56 AM UTC-6, Massimo Di Pierro wrote:

 There is one more to the first web2py conference

 http://www.experts4solutions.com/web2py_conference

 We got a bigger room and we can take 10-15 more people. register now!

 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/d/optout.


[web2py] pass current page id to load function in sidebar

2014-04-24 Thread Greg Vaughan
Hi everyone...

I am using a LOAD function for a notes field in the sidebar of my app. I am 
able to load the notes for a specific business by hardcoding the id of the 
business in the controller like so...

@auth.requires_login()
def note():
current==1
notes=db(db.notes.business==current).select()
return dict(notes=notes)

What I would like to do is have the value of current set to the id var of 
the current page eg... welcome/default/leads?id=17  THIS

No request.vars are available to the LOAD function however...

How do I achieve this?

-- 
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/d/optout.


[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-24 Thread Greg Vaughan
Ahhh I see... thanks once again

On Tuesday, 22 April 2014 19:17:08 UTC+10, Niphlod wrote:

 SQLFORM.factory creates a form based on what fields you pass to it. If you 
 pass tables, fields are extracted from the table definitions. However, it's 
 still managed as if it was a single table containing all the fields from 
 all the tables you pass, so there's only one table_name available. Of 
 course, all field names MUST be different (i.e. unique within the form).

 On Tuesday, April 22, 2014 5:35:18 AM UTC+2, Greg Vaughan wrote:

 Hey Niphlod,

 Thanks for that answer...  you are spot on in seeing the problem... my 
 #appointments_blah id's did get changed to #no_table_blah hence the 
 jQuery was targeting id's that no longer existed...

 To fix it I simply changed the hard coded script at this point to 
 target #no_table_unit, #no_table_unit, #no_table_unit, 
 #no_table_unit etc... which is very ugly :(

 I can use input names to hide the data fields as you suggested above 
 which is preferred but how would I hide the labels? They do not have a name 
 property...

 I could not work out how to use the form = SQLFORM.factory(Field() 
 ., table_name='appointments') suggestion in this instance... I get it 
 if I am using a normal instance of SQLFORM.factory... but in this case 
 where i am referencing and updating two tables i cannot seem to get the 
 syntax right...

 The relevant part  form = SQLFORM.factory(db.appointments, db.notes) 
  are you saying I wrap this section with the above and include all the 
 fields?

 Eg... form = SQLFORM.factory(db.appointments, db.notes),
   Field('unit'), 
   Field('unit_type'),
   Field('unit_number'),
   ...,
   table_name='appointments'
  ) 



-- 
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/d/optout.


[web2py] Re: pass current page id to load function in sidebar

2014-04-24 Thread Greg Vaughan
Hi Niphlod...

{{=response.vars}} shows nothing... nor does {{response.toolbar()}}... 
db stats shows notes.business = 1 when I hardcode it as above...

I took a screenshot here http://screencast.com/t/mmRPGOHUAjt

I assume that the filter will have to be sorted in the controller as the 
LOAD function would be serialised before the page is loaded? I could be 
completeley wrong of course.

On Friday, 25 April 2014 01:00:04 UTC+10, Niphlod wrote:

 why are you saying that vars are unavailable for LOAD ?



-- 
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/d/optout.


[web2py] Re: pass current page id to load function in sidebar

2014-04-24 Thread Greg Vaughan
Sorry I should have given you all the data...

The db table is a simple one

# HISTORY

db.define_table('notes',
Field('business', 'reference calls',
  writable=False
  ),
Field('note', 'text',
  label='Add Note'
  ),
auth.signature,
format='%(business)s'
)


The controller is as above...
 
note.load is simply

{{=response.toolbar()}}
h4Notes:/h4
{{for note in notes:}}
div class=note
On {{=note.created_on}} {{=note.created_by.first_name}}
  says blockquote class=note_body{{=note.note}}/blockquote
/div
{{pass}}

load is only called in a couple of views at the moment until I get this 
sorted out...

for example in leads.html (the one in the screenshot)

{{extend 'layout.html'}}
{{=form}}
{{pass}}
{{block right_sidebar}}
{{=LOAD('default','note.load',ajax=True)}}
{{end}}




On Friday, 25 April 2014 02:03:22 UTC+10, Niphlod wrote:

 how are you using LOAD to load the component ?

 On Thursday, April 24, 2014 5:23:21 PM UTC+2, Greg Vaughan wrote:

 Hi Niphlod...

 {{=response.vars}} shows nothing... nor does {{response.toolbar()}}... 
 db stats shows notes.business = 1 when I hardcode it as above...

 I took a screenshot here http://screencast.com/t/mmRPGOHUAjt

 I assume that the filter will have to be sorted in the controller as the 
 LOAD function would be serialised before the page is loaded? I could be 
 completeley wrong of course.

 On Friday, 25 April 2014 01:00:04 UTC+10, Niphlod wrote:

 why are you saying that vars are unavailable for LOAD ?



-- 
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/d/optout.


[web2py] Re: pass current page id to load function in sidebar

2014-04-24 Thread Greg Vaughan
Cheers Anthony

Worked a treat...

Thanks everyone for the help...

On Friday, 25 April 2014 03:12:00 UTC+10, Anthony wrote:

 {{extend 'layout.html'}}
 {{=form}}
 {{pass}}
 {{block right_sidebar}}
 {{=LOAD('default','note.load',ajax=True)}}
 {{end}}


 Just do:

 {{=LOAD('default', 'note.load', vars=dict(id=request.vars.id), ajax=True
 )}}

 And in the note() function:

 def note():
 notes = db(db.notes.business == request.vars.id).select()

 Also, avoid using current as a variable name, as there is a web2py 
 global object called current.

 Anthony


-- 
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/d/optout.


[web2py] Re: alternate date and time picker

2014-04-21 Thread Greg Vaughan
Hi Annet...

Thank you so much for the detailed reply... I have made it a point to check 
out the styling you have done...

However the issue that I have is not just with the look but also with the 
way that the default one functions... particularly on tablets... it is 
clunky.

So I have hacked together an implementation of 
Pickadate.jshttp://amsul.ca/pickadate.js/index.htm 
which is the sort of thing my clients expect in a modern browser 
application.

Cheers
Greg


On Sunday, 20 April 2014 16:36:25 UTC+10, Annet wrote:

 Hi Greg,

 I use a customized version of jQuery UI (I only needed the datepicker and 
 autocomplete)...

 ...

 Kind regards,

 Annet



-- 
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/d/optout.


[web2py] SQLFORM.widgets.radio.widget and jQuery Validation

2014-04-21 Thread Greg Vaughan
Hi everyone,

When I am using the SQLFORM.widgets.radio.widget my jquery selection code 
does not work. If I comment out the widget it works fine. Does anyone know 
if there is a workaround or is it just not possible to combine the two 
together.

In the Model...

db.define_table('leads',

Field('contact_result',
  requires=IS_IN_SET(['Appointment', 'Gatekeeper',
  'National/Head Office', 'Not Interested',
  'Send Information', 'Call Back Later']),
  default='Appointment',
  widget=SQLFORM.widgets.radio.widget
  ),

and in the View... (controller is essentially SQLFORM)

{{extend 'layout.html'}}
{{=form}}
script
jQuery(document).ready(function() {

if(jQuery('#leads_contact_result option:selected').text()=='Send 
Information') {
jQuery('#leads_info_email__row').show();
}
else
{ jQuery('#leads_info_email__row').hide();
}
jQuery('#leads_contact_result').change(function() {
if(jQuery('#leads_contact_result 
option:selected').text()=='Send Information') {
jQuery('#leads_info_email__row').show();
}
else
{ jQuery('#leads_info_email__row').hide();
}
});

if(jQuery('#leads_contact_result option:selected').text()=='Call 
Back Later') {
jQuery('#leads_recontact__row').show();
}
else
{ jQuery('#leads_recontact__row').hide();
}
jQuery('#leads_contact_result').change(function() {
if(jQuery('#leads_contact_result 
option:selected').text()=='Call Back Later') {
jQuery('#leads_recontact__row').show();
}
else
{ jQuery('#leads_recontact__row').hide();
}
});

})
/script

-- 
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/d/optout.


[web2py] SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Greg Vaughan
Hi everyone,

I am using a bunch of jQuery hide effects based on the example code in the 
book... (Chapter 11... Conditional fields in forms) which work great with 
my SQLFORM.

However when I change the controller to use SQLFORM.factory so that I can 
post to two tables (based on Chapter 7... One form for multiple tables) the 
effects stop working. Can someone suggest a workaround or a code change so 
that they will work together?

The Controller...

@auth.requires_login()
def appointments():
call_id = request.get_vars.id
db.appointments.business.default=call_id
db.notes.business.default=call_id
form = SQLFORM.factory(db.appointments, db.notes)
if form.process().accepted:
id = 
db.appointments.insert(**db.appointments._filter_fields(form.vars))
form.vars.appointments=id
id = db.notes.insert(**db.notes._filter_fields(form.vars))
session.flash = 'Success'
redirect(URL('calls'))
elif form.errors:
response.flash = 'Form has errors'
else:
response.flash = 'Enter Data'
return dict(form=form)

and the View...

{{extend 'layout.html'}}
{{=form}}
script
jQuery(document).ready(function(){
if(jQuery('#appointments_unit').prop('checked'))
jQuery('#appointments_unit_type__row').show(),
jQuery('#appointments_unit_number__row').show();
else jQuery('#appointments_unit_type__row').hide(),
jQuery('#appointments_unit_number__row').hide();
jQuery('#appointments_unit').change(function(){
if(jQuery('#appointments_unit').prop('checked'))
jQuery('#appointments_unit_type__row').show(),
jQuery('#appointments_unit_number__row').show();
else jQuery('#appointments_unit_type__row').hide(),
jQuery('#appointments_unit_number__row').hide();
});
if(jQuery('#appointments_level_floor').prop('checked'))
jQuery('#appointments_level_type__row').show(),
jQuery('#appointments_level_number__row').show();
else jQuery('#appointments_level_type__row').hide(),
jQuery('#appointments_level_number__row').hide();
jQuery('#appointments_level_floor').change(function(){
if(jQuery('#appointments_level_floor').prop('checked'))
jQuery('#appointments_level_type__row').show(),
jQuery('#appointments_level_number__row').show();
else jQuery('#appointments_level_type__row').hide(),
jQuery('#appointments_level_number__row').hide();
});
if(jQuery('#appointments_building').prop('checked'))
jQuery('#appointments_building_number__row').show(),
jQuery('#appointments_building_name__row').show();
else jQuery('#appointments_building_number__row').hide(),
jQuery('#appointments_building_name__row').hide();
jQuery('#appointments_building').change(function(){
if(jQuery('#appointments_building').prop('checked'))
jQuery('#appointments_building_number__row').show(),
jQuery('#appointments_building_name__row').show();
else jQuery('#appointments_building_number__row').hide(),
jQuery('#appointments_building_name__row').hide();
});
if(jQuery('#appointments_lot').prop('checked'))
jQuery('#appointments_lot_section__row').show();
else jQuery('#appointments_lot_section__row').hide();
jQuery('#appointments_lot').change(function(){
if(jQuery('#appointments_lot').prop('checked'))
jQuery('#appointments_lot_section__row').show();
else jQuery('#appointments_lot_section__row').hide();
});
if(jQuery('#appointments_cross_street').prop('checked'))
jQuery('#appointments_street_number__row').hide(),
jQuery('#appointments_cross_name__row').show(),
jQuery('#appointments_cross_type__row').show(),
jQuery('#appointments_cross_suffix__row').show();
else jQuery('#appointments_street_number__row').show(),
jQuery('#appointments_cross_name__row').hide(),
jQuery('#appointments_cross_type__row').hide(),
jQuery('#appointments_cross_suffix__row').hide();
jQuery('#appointments_cross_street').change(function(){
if(jQuery('#appointments_cross_street').prop('checked'))
jQuery('#appointments_street_number__row').hide(),
jQuery('#appointments_cross_name__row').show(),
jQuery('#appointments_cross_type__row').show(),
jQuery('#appointments_cross_suffix__row').show();
else jQuery('#appointments_street_number__row').show(),
jQuery('#appointments_cross_name__row').hide(),
jQuery('#appointments_cross_type__row').hide(),
jQuery('#appointments_cross_suffix__row').hide();
});

[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Greg Vaughan
Hey Niphlod,

Thanks for that answer...  you are spot on in seeing the problem... my 
#appointments_blah id's did get changed to #no_table_blah hence the 
jQuery was targeting id's that no longer existed...

To fix it I simply changed the hard coded script at this point to target 
#no_table_unit, #no_table_unit, #no_table_unit, #no_table_unit 
etc... which is very ugly :(

I can use input names to hide the data fields as you suggested above which 
is preferred but how would I hide the labels? They do not have a name 
property...

I could not work out how to use the form = SQLFORM.factory(Field() ., 
table_name='appointments') suggestion in this instance... I get it if I am 
using a normal instance of SQLFORM.factory... but in this case where i am 
referencing and updating two tables i cannot seem to get the syntax right...

The relevent part  form = SQLFORM.factory(db.appointments, db.notes) 
 are you sating I wrap this section with the above?

Eg... form = SQLFORM.factory(
Field('field name'), ('field name'), ., table_name='appointments')

-- 
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/d/optout.


[web2py] alternate date and time picker

2014-04-19 Thread Greg Vaughan
Is there any way that I can use a different date and time picker. The 
default one is horrible but it seems to be baked in to web2py?

-- 
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/d/optout.


Re: [web2py] Re: Paypal Recurring Payments? Any experience? Any alternatives?

2014-04-03 Thread Greg Vaughan
Not Austria at the moment no... They are however in Beta in...

   - Belgium 
   -  Finland 
   -  France 
   -  Germany 
   -  Luxembourg 
   -  Netherlands 
   -  Spain 

which is easy to get an invite to... as far as the rest of Europe goes 
though the fractionated banking economy makes it a far more difficult 
proposition to get to the smaller economies.

On Wednesday, 2 April 2014 15:28:35 UTC+10, mweissen wrote:

 Stripe looks good, but could not be used in Austria/Europe. Sorry!  :-(
 Martin


 2014-04-02 5:38 GMT+02:00 Greg Vaughan greg.s@gmail.com javascript:
 :

 Stripe charges me (in Australia) 2.7% + 30cents for each transaction 
 processed, Visa, Mastercard or American Express. No other fees that are 
 typically charged by other alternatives (Authorize.net) monthly fee, annual 
 fee, chargeback fee etc... it is very much the simplest and most direct... 
 payments are batch transferred to you account on a 7 day rolling cycle. 
 Again this is as good as any other alternative. If you have a fixed amount 
 to charge it can be implemented within 5 minutes using their js code for 
 checkout. 

 For a manual form you can use their custom implementation or Massimo's 
 code above with his library...

 If you want a custom payment system you will have to write the code to 
 pass that to the stripe server when you are charging for the service...

 Oh also... verifying your business takes about 2 minutes... and you 
 definitely wont beat that.

 Stripe has nothing to do with PayPal you host it on your site... (must be 
 https... get a certificate from start.com for free) so there is NO 
 PayPal tax...


 On Wednesday, 2 April 2014 09:41:32 UTC+10, Matheus Cardoso wrote:

 So, if someone uses Stripe, he will pay only the fee from Stripe and 
 this will cover the PayPal's tax? 

 On Monday, March 31, 2014 6:57:14 AM UTC-3, Mika Sjöman wrote:

 Hi

 I wonder if anyone here has implemented recurring payments with Paypal 
 here with Web2py? Any experience with this and how to implement it?

 We currently charge people for lessons with our teachers, but we would 
 like to go over to a payment model where we automatically charge the 
 customers every month. 

 Is there a better way of doing this than Paypal? Market is mostly US 
 and China based. 

 Cheers

  -- 
 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 javascript:.
 For more options, visit https://groups.google.com/d/optout.




 

-- 
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/d/optout.


[web2py] Re: web2py logo - need immediate help

2014-04-02 Thread Greg Vaughan
You're welcome... if you need any design stuff feel free to ask anytime... 
Front end  design is the easy bit :)

On Wednesday, 2 April 2014 23:52:55 UTC+10, Massimo Di Pierro wrote:

 Thank you Greg. This is really nice! I will pass it along to the 
 organizing committee.

 On Wednesday, 2 April 2014 06:46:16 UTC-5, Greg Vaughan wrote:

 Hi Massimo

 Only just saw this... so bit quick and dirty... but just in case no one 
 else gets something in for you can use as a fallback... I don't know what 
 the base font is so roughed one up... png and svg attached

 Cheers 

 On Wednesday, 2 April 2014 00:31:50 UTC+10, Massimo Di Pierro wrote:

 Any good designer on the list?
 I need a web2py logo similar to this one 

http://web2py.com/init/static/images/web2py_logo.png

 but done in vectorial format, white on black. No shadows. It should also 
 say below Conference, 2014. It will be printed on mugs.
 Some creativity allowed but not too much. I need it in 24hrs or I will 
 have to make it my self and I know it will look ugly.

 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/d/optout.


[web2py] Re: Paypal Recurring Payments? Any experience? Any alternatives?

2014-04-01 Thread Greg Vaughan
Stripe charges me (in Australia) 2.7% + 30cents for each transaction 
processed, Visa, Mastercard or American Express. No other fees that are 
typically charged by other alternatives (Authorize.net) monthly fee, annual 
fee, chargeback fee etc... it is very much the simplest and most direct... 
payments are batch transferred to you account on a 7 day rolling cycle. 
Again this is as good as any other alternative. If you have a fixed amount 
to charge it can be implemented within 5 minutes using their js code for 
checkout. 

For a manual form you can use their custom implementation or Massimo's code 
above with his library...

If you want a custom payment system you will have to write the code to pass 
that to the stripe server when you are charging for the service...

Oh also... verifying your business takes about 2 minutes... and you 
definitely wont beat that.

Stripe has nothing to do with PayPal you host it on your site... (must be 
https... get a certificate from start.com for free) so there is NO PayPal 
tax...

On Wednesday, 2 April 2014 09:41:32 UTC+10, Matheus Cardoso wrote:

 So, if someone uses Stripe, he will pay only the fee from Stripe and this 
 will cover the PayPal's tax? 

 On Monday, March 31, 2014 6:57:14 AM UTC-3, Mika Sjöman wrote:

 Hi

 I wonder if anyone here has implemented recurring payments with Paypal 
 here with Web2py? Any experience with this and how to implement it?

 We currently charge people for lessons with our teachers, but we would 
 like to go over to a payment model where we automatically charge the 
 customers every month. 

 Is there a better way of doing this than Paypal? Market is mostly US and 
 China based. 

 Cheers



-- 
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/d/optout.


[web2py] Re: Paypal Recurring Payments? Any experience? Any alternatives?

2014-03-31 Thread Greg Vaughan
Check out Stripe... https://stripe (dot) com/

Massimo has a library created here and there is some support in the docs...


On Monday, 31 March 2014 19:57:14 UTC+10, Mika Sjöman wrote:

 Hi

 I wonder if anyone here has implemented recurring payments with Paypal 
 here with Web2py? Any experience with this and how to implement it?

 We currently charge people for lessons with our teachers, but we would 
 like to go over to a payment model where we automatically charge the 
 customers every month. 

 Is there a better way of doing this than Paypal? Market is mostly US and 
 China based. 

 Cheers


-- 
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/d/optout.


[web2py] Integrating Stripe with the gluon/contrib/stripe.py usage and template examples

2014-03-26 Thread Greg Vaughan
So i am trying to implement a stripe payment page and using the examples in 
the current gluon/contrib/stripe.py

I cut and pasted the Template into a page with the default controller to 
see how it went but it failed first up with a global name not defined error 
on pk=PUBLISHABLE_KEY_GOES_HERE.

I then passed the test keys as strings to the controller and ended up with 
the following:

def verify():
response.flash = T(Enter Your Credit Card Transaction)
from gluon.contrib.stripe import StripeForm
form = StripeForm(
pk=pk_test_K44o7S1yuutpxBBLFOYZTsxl,
sk=sk_test_MQAXb12hLq3PiJBgVmozMJbS,
amount=150, # $1.5 (amount is in cents)
description=Nothing).process()
if form.accepted:
payment_id = form.response['id']
redirect(URL('thank_you'))
elif form.errors:
redirect(URL('pay_error'))
return dict(form=form)

This handled the error above but the code then failed with a different error
 type 'exceptions.NameError'(name 'pk' is not defined) 

Tracing this down... the traceback shows that the error is occuring when 
web2py is attempting to construct the html page...

Traceback (most recent call last):
  File /home/gsv/enertek/web2py/gluon/restricted.py, line 217, in restricted
exec ccode in environment
  File 
/home/gsv/enertek/web2py/applications/welcome/views/default/verify.html, line 
84, in module  this is after the last line of code
{{if security_notice or disclosure_notice:}}
NameError: name 'pk' is not defined

and is happening here...

75.
76.
77.
78.
79.
80.
81.
82.
83.
84.

85.
86.
87.
88.
89.
90.
91.
92.
93.
94.

response.write('\ndiv class=span3 left-sidebar\n', 
escape=False)
response.write('\nh3Left Sidebar/h3\np/p\n  
  ', escape=False)
response.write('\n/div\n', escape=False)
pass
response.write('\n\ndiv class=', escape=False)
response.write(middle_columns)
response.write('\n', escape=False)
response.write('\n', escape=False)
response.write('\nscript type=text/javascript 
src=https://js.stripe.com/v2/;/script\nscript\njQuery(function(){\n// 
This identifies your website in the createToken call below\n
Stripe.setPublishableKey(\'', escape=False)
response.write(pk)

response.write('\');\n\nvar stripeResponseHandler = function(status, 
response) {\n  var jQueryform = jQuery(\'#payment-form\');\n\n  if 
(response.error) {\n// Show the errors on the form\n
jQuery(\'.payment-errors\').text(response.error.message).show();\n
jQueryform.find(\'button\').prop(\'disabled\', false);\n  } else {\n
// token contains id, last4, and card type\nvar token = response.id;\n  
  // Insert the token into the form so it gets submitted to the server\n
var tokenInput = jQuery(\'input type=hidden name=stripeToken /\');\n  
  jQueryform.append(tokenInput.val(token));\n// and re-submit\n 
   jQueryform.get(0).submit();\n  }\n};\n\njQuery(function(jQuery) 
{\n  jQuery(\'#payment-form\').submit(function(e) {\n\nvar 
jQueryform = jQuery(this);\n\n// Disable the submit button to prevent 
repeated clicks\njQueryform.find(\'button\').prop(\'disabled\', 
true);\n\nStripe.createToken(jQueryform, stripeResponseHandler);\n\n
// Prevent the form from submitting with the default action\nreturn 
false;\n  });\n});\n});\n/script\n\nh3Payment Amount: ', 
escape=False)
response.write(currency_symbol)
response.write(' ', escape=False)
response.write(%.2f % (0.01*amount))
response.write('/h3\nform action= method=POST id=payment-form 
class=form-horizontal\n\n  div class=form-row control-group\nlabel 
class=control-labelCard Number/label\ndiv class=controls\n  
input type=text size=20 data-stripe=number\n\t 
placeholder=4242424242424242/\n/div\n  /div\n\n  div 
class=form-row control-group\nlabel class=control-labelCVC/label\n 
   div class=controls\n  input type=text size=4 style=width:80px 
data-stripe=cvc\n\t placeholder=XXX/\n  a 
href=http://en.wikipedia.org/wiki/Card_Verification_Code; target=_blankWhat 
is this?/a\n/div\n  /div\n\n  div class=form-row control-group\n  
  label class=control-labelExpiration/label\t\ndiv 
class=controls\n  input type=text size=2 style=width:40px 
data-stripe=exp-month\n\t placeholder=MM/\n  /\n  input 
type=text size=4 style=width:80px data-stripe=exp-year\n\t 
placeholder=/\n/div\n  /div\n\n\n  div class=control-group\n 
   div class=controls\n  button type=submit class=btn 
btn-primarySubmit Payment/button\n  div class=payment-errors error 
hidden/div\n/div\n  /div\n  input type=hidden name=signature 
value=', escape=False)
response.write(signature)
response.write(' /\n/form\n\n', escape=False)
if security_notice or disclosure_notice:
response.write('\ndiv 

[web2py] Stripe example from book out of date

2014-03-24 Thread Greg Vaughan
Just to inform that the example here does not work with Stripe V3 (current)

The script reports that the payments are accepted (provided you supply 
valid currency and date arguments) however they are not received at the 
stripe end. (they do not show in the stripe console log file.)

Was hoping to use a version of this and will have a look at the Library and 
measure it against the current python bindings on Github but for the moment 
it should probably be removed from the book.

-- 
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/d/optout.


[web2py] Re: Question on linking fields

2014-02-18 Thread Greg Vaughan
Hi Jim

That was exactly what I needed thanks so much. Works perfectly.

-- 
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] Question on linking fields

2014-02-16 Thread Greg Vaughan
Hi everyone...

Linked tables like...

db.define_table('calls',
Field('business', 'string'),
...

and

db.define_table('leads',
Field('business', 'reference calls'),
...

with controller containing

def calls():
form = SQLFORM(db.calls)
if form.process().accepted:
redirect(URL('leads'))

and form

{{extend 'layout.html'}}
{{=form}}

create a drop down linking list for the Business field...

How can I make this default to the record that has just been created in 
'calls' instead?

-- 
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] Masking User Input

2014-02-05 Thread Greg Vaughan
Hi everyone,

Building a series of telemarketing and sales forms for a friends company to 
use. 

Looking to utilise an input mask such as the one mentioned in this post. 

https://groups.google.com/forum/#!searchin/web2py/form$20input$20mask$20jquery/web2py/zRt9whk6y68/3jqiiRII9QYJ
 


and wanted to check if there were any potential issues. Particularly in 
relation to Niphlod's comment in that post.

Is there any important reason that the jquery plugin mentioned could not be 
used?  

I am not looking for it to validate data (I use a regex to do that) but it 
is far preferable to guide the user to input correct data in the first 
place and a format mask is an aesthetically pleasing way to do this.

-- 
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: Important New Year News: Edison Award

2014-01-18 Thread Greg Vaughan
Congratulations... and a big thank you also... I have just found web2py and 
absolutely amazed at how brilliant it is

On Saturday, 4 January 2014 14:08:38 UTC+10, Massimo Di Pierro wrote:

 Web2py/me have been nominated for the Edison Award. Please wish web2py 
 (and me) good luck. :-)



-- 
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] Crud Permissions

2013-02-14 Thread Greg
I want to have two auth_groups: administrator who will have complete CRUD 
access to all tables, and editor who will have complete CRUD access to a 
limited set of tables. I can give administrator access without even 
setting up permissions by doing the following:

 @auth.requires_membership(administrator)
 def data():
return dict(form=crud())

Supposedly crud() will automatically detect permissions if you name them 
the right way. Assume I created a permission like this in appadmin:
 Group ID: editor (2)
 Name: create
 Object or table name: person
 Record ID: 0


If I'm logged in as a user in the editor group and visit
 http://127.0.0.1:8000/testapp/default/data/create/person

I get a Not authorized ACCESS DENIED message. Should I be setting up my 
auth_permission differently, or maybe use another decorator?


Thanks is advance for any help.

Greg

-- 

--- 
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: Possible bug with a referenced field?

2012-02-28 Thread Greg Sier
Confirming that we've come across the same issue lately ...

On Feb 29, 11:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Can you show us the code so I can reproduce the behavior and fix it
 (if a bug, as it looks like).

 On Feb 28, 4:47 pm, Tsvi Mostovicz ttm...@gmail.com wrote:







  Hi,

  In my models I have 2 tables, where table 1 has field a referencing
  table 2. As each user has a bunch of fields both in table 1 as well as
  in table 2, I used the request_tenant field with some uuid in both
  tables which is tied to the user (I'm not using the users ID for
  various reasons).
  I tried creating a form for table 1 with SQLFORM, but the select
  dropdown for field a returns all the items in table 2, and doesn't
  filter them according to the request_tenant field, which I would
  consider the correct behavior.

  I'll show some code tomorrow.
  Can you confirm this being a bug? Or am I missing something?

  Thanks,

  Tsvi
  Sent from my phone


[web2py] Re: Current status of adapting OrientDB for web2py

2012-02-15 Thread Greg Sier
+1 on this.
It's in our 2 year plan for a major client.


On Feb 16, 6:48 am, TheSweetlink yanosh...@gmail.com wrote:
 Hello,

 I have been using OrientDB and web2py quite successfully for some
 months now.

 While there are many great projects and efforts to combine these
 powerful programs, I do not know of the current status of the web2py
 --- OrientDB adapter.

 Bulbflow is a great project too but I could not use it due to OrientDB
 specific features that I needed for my project.

 Neo4j has had great progress as well.

 I ultimately chose OrientDB for several reasons which made it the best
 fit for my projects.  Here are some of those highlights:

 1) multi-master (as far as I know you must pay for commercial license
 to get multi-master in Neo4j)

 2) the Apache 2.0 license is very liberal.

 3) Luca and the OrientDB community are as turbo fast and helpful as
 the web2py community.  Luca can get patches out in hours to days, not
 months to years.

 4) SQL syntax + Gremlin graph traversal language = untold power to
 grow/analyze your graph dbs.

 5) Much more...for details see orienttechnologies.com and click Learn
 More.  Do read the entire wiki as there is good documentation and
 more coming frequently.

 As for getting OrientDB to work with web2py, I have had to write
 custom modules to do basic CRUD and used OrientDB's built-in console
 to create my schema/maintain the DB.

 I've experienced great success with using requests and ujson python
 libs to move data back and forth from web2py -- OrientDB

 For Auth I still use a db which will work with web2py's amazing DAL.
 I'm sure with enough time you could hack the two to work together but
 I prefer to use something proven for auth until such time OrientDB is
 included in the DAL.

 Massimo has expressed interest in including OrientDB within the DAL
 but I would assume that this will take quite some time as he has much
 higher priorities for web2py to get to first.

 I highly recommend the combination of web2py and OrientDB.  It will
 take some customization, but once running you will be able to do
 things that web2py + traditional RDBMS simply cannot do.

 Some of my apps have experienced 10-100x performance boost due to no
 longer using JOINS to get data but rather traversing my graph.

 Best of luck,
 David

 On Feb 13, 12:54 pm, Nolan Nichols nolan.nich...@gmail.com wrote:







  I'm researching the nosql and graph database landscape for a web2py
  application that will require the schema to evolve over time and
  provide network/graph analysis metrics.

  I started by looking at the Tinkerpop (http://tinkerpop.com/) stack
  and the Bulbflow (http://bulbflow.com/) python library for interacting
  with Tinkerpop graph databases like Neo4j and OrientDB.

  It looks like there was interest a few months back in adapting
  OrientDB's sql interface for web2py, and there is an open issue:

  -http://code.google.com/p/web2py/issues/detail?id=407

  A few questions:

  What is the current status of an OrientDB/web2py adapter?
  Is anyone currently using a graph database with web2py?
  Any suggestions for using web2py DAI/templates with non-rdbms sources?

  Cheers,

  Nolan


[web2py] Re: OFF Topic - Business inteligence in Python, web2py?

2012-02-15 Thread Greg Sier
or OLAP tools i.e. Mondrian forks such as Pentaho, Jasper, JPivot.
Most are written in java.


On Feb 16, 8:24 am, Ross Peoples ross.peop...@gmail.com wrote:
 I think he means reporting functions like Crystal Reports or SQL Server
 Reports.


[web2py] Re: running web2py on Android?

2011-02-21 Thread Greg
I'm trying to get this working.  I followed the suggestion in the link
you provided and added the following after the logging module is
imported:

logging.logMultiprocessing = False

And I got a little farther than the previous poster.  I can pull up
the admin interface using the android browser, but the examples and
welcome apps have a problem with the DAL.

Stay tuned...



On Nov 10 2010, 10:55 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 did this work?

 should this perhaps be default in web2py?

 On Nov 9, 9:33 pm, mdipierro mdipie...@cs.depaul.edu wrote:







 http://code.google.com/p/android-scripting/issues/detail?id=276

  On Nov 9, 6:18 pm, pallav pal...@fielddiagnostics.com wrote:

   I checked and the line was already commented out.

   I don't know how to run web2py with the switch -N because I have to
   run it from inside the interactive python shell by typing import
   web2py.web2py and hitting enter.

   What does the switch -N do? I can try to simulate the same effect by
   modifying th web2py code.

   The shell output is pasted below.

   $ export TEMP=/sdcard/ase/extras/python/tmp/
   export PYTHONHOME=/data/data/com.google.ase/python
   $ $ export AP_PORT=45310
   export PYTHONPATH=/sdcard/ase/extras/python/:/sdcard/ase/scripts/
   /data/data/com.google.ase/python/bin/python
   $ $ Python 2.6.2 (r262:71600, Sep 19 2009, 11:03:28)
   [GCC 4.2.1] on linux2
   Type help, copyright, credits or license for more 
   information.import web2py.web2py

   uname: permission denied
   web2py Enterprise Web Framework
   Created by Massimo Di Pierro, Copyright 2007-2010
   Version 1.88.2 (2010-10-29 23:04:43)
   Database drivers available: SQLite3
   Starting hardcron...
   Traceback (most recent call last):
     File stdin, line 1, in module
     File /sdcard/ase/scripts/web2py/web2py.py, line 23, in module
       gluon.widget.start(cron=True)
     File /sdcard/ase/scripts/web2py/gluon/widget.py, line 815, in
   start
       logger.warn('GUI not available because Tk library is not
   installed')
     File /home/damonkohler/ase_src/python/src/android/python/lib/
   python2.6/logging/__init__.py, line 1042, in warning

     File /home/damonkohler/ase_src/python/src/android/python/lib/
   python2.6/logging/__init__.py, line 1142, in _log

     File /home/damonkohler/ase_src/python/src/android/python/lib/
   python2.6/logging/__init__.py, line 1117, in makeRecord

     File /home/damonkohler/ase_src/python/src/android/python/lib/
   python2.6/logging/__init__.py, line 272, in __init__

   ImportError: No module named multiprocessing

   On Nov 8, 11:46 pm, mdipierro mdipie...@cs.depaul.edu wrote:

make sure this line in web2py.py

# import gluon.import_all

is commented. web2py should not need to use multiprocessing. Also run
it with -N.

On Nov 8, 10:42 pm, pallav pal...@fielddiagnostics.com wrote:

 I just tried running web2py onandroidand an error regarding the
 module multiprocessing being missing. It gets called from
 gluon.widget.start()

 I will look into the source code tomorrow to see if there is a
 workatound. I might try porting the multiprocessing module over.

 Any ideas anyone? I think mobile apps area great way for web2py to
 take a lead in the python framework world.

 On Oct 15, 5:15 am, dustin.b dustin.bens...@googlemail.com wrote:

  i tried to run w2p onandroidwith ASE (androidscripting env). It's
  been a while since I tried this but i can remember that there was a
  problem with threads or something like this. w2p seems to use python
  packages that are not avaible onandroid, didnt remember exactly 
  which
  one.


[web2py] Re: Alternative Auth Fields (not additional ones)?

2010-12-17 Thread Greg
Thank you, that does work.

On Dec 17, 11:54 am, DenesL denes1...@yahoo.ca wrote:
 Try setting

 db.auth_user.last_name.requires=[]

 in your model after auth is defined or in your action before the form.

 On Dec 17, 12:44 am, Greg greg.kr...@gmail.com wrote:







  Hello,

  When my users register I won't have any need for them to enter First
  name or Last name. I really only need username, email address and
  password. I can change the label for first_name to 'Username', but
  they are still required to enter something in the Last Name field.
  I've tried setting last_name.readable, writeable, and required to
  False, but it still requires the field.

  I realize they are largely hard-coded, but is there any way around the
  built-in auth table requirements without breaking things?

  Thanks,

  greg


[web2py] Alternative Auth Fields (not additional ones)?

2010-12-16 Thread Greg
Hello,

When my users register I won't have any need for them to enter First
name or Last name. I really only need username, email address and
password. I can change the label for first_name to 'Username', but
they are still required to enter something in the Last Name field.
I've tried setting last_name.readable, writeable, and required to
False, but it still requires the field.

I realize they are largely hard-coded, but is there any way around the
built-in auth table requirements without breaking things?

Thanks,

greg


[web2py] Autoroutes redirecting to web2py website

2010-12-07 Thread Greg
Hello all,

I'm playing around with the new autoroutes, but it's not working how
I'd expect it to. I copied autoroutes.py from the trunk and put it at
web2py/routes.py . My routes.conf looks like this: http://pastebin.com/Kqz0FvdC
. I created an app called autoroutes, and only changed lines 17, 19,
20 of autoroutes/default.py: http://pastebin.com/XsGEyKet . When I
visit http://127.0.0.1:8000/index, I see the web2py.com website
(http://imgur.com/TC5PI.png). When I visit http://127.0.0.1:8000/test
I see invalid function. Visiting http://127.0.0.1:8000/admin/default/site
works fine.

Does anyone have any idea what's going on here? Why am I not seeing my
local web2py server?

Thanks for any help.

greg



[web2py] Re: Autoroutes redirecting to web2py website

2010-12-07 Thread Greg
Ah, ok. That did it. Thanks!

On Dec 7, 5:46 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Dec 7, 2010, at 3:39 PM, Greg wrote:



  I'm playing around with the new autoroutes, but it's not working how
  I'd expect it to. I copied autoroutes.py from the trunk and put it at
  web2py/routes.py . My routes.conf looks like 
  this:http://pastebin.com/Kqz0FvdC
  . I created an app called autoroutes, and only changed lines 17, 19,
  20 of autoroutes/default.py:http://pastebin.com/XsGEyKet. When I
  visithttp://127.0.0.1:8000/index, I see the web2py.com website
  (http://imgur.com/TC5PI.png). When I visithttp://127.0.0.1:8000/test
  I see invalid function. Visitinghttp://127.0.0.1:8000/admin/default/site
  works fine.

  Does anyone have any idea what's going on here? Why am I not seeing my
  local web2py server?

  Thanks for any help.

 The latest scripts/autoroutes.py defaults to using the config string in the 
 file (see line 35) if it's not empty (in preference to routes.conf).

 That defaults to the example app:

 config = '''
 127.0.0.1   /examples/default
 domain1.com /app1/default
 domain2.com /app2/default
 domain3.com /app3/defcon3
 '''

 ...which looks like the web2py site.

 So either put your config in that string, or make that string empty, and 
 it'll use route.conf.

 (Note: the reason that the config string isn't empty is that it drives the 
 doctest.)


[web2py] Re: Displaying Foreign Key

2010-03-23 Thread Greg

Ah, very simple. Thanks, guys.

P.S. It's a good thing web2py makes it easy to rename tables. :)

On Mar 22, 6:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You can just replace

 td{{=event.room_id}}/td

 with

 td{{=event.room_id.name}}/td

 This will result in one extra select per record.

 You can also use a join

 #default.py
 def index():
     events =
 db(db.events.room_id==db.rooms.id).select(orderby=db.events.event_date)
     return dict(events=events)

 #index.html
 {{extend 'layout.html'}}
 table
     tr
         tdDate/tdtdEvent/tdtdRoom/td
    /tr
 {{for e in events:}}
    tr
        td{{=e.events.event_date}}/tdtd{{=e.events.title}}/
 tdtd{{=e.rooms.id}}/td
    /tr
 {{pass}}
 /table

 These kind of programs read better if table names are singular. ;-)

 Massimo

 On Mar 22, 5:45 pm, Greg greg.kr...@gmail.com wrote:

  Hello!

  I have a view that lists some records (events), one of the fields
  (events.room_id) is a foreign key. When i display these records I want
  to display rooms.name, not events.room_id. Can someone give me a nudge
  (or swift kick) in the right direction on how to do this? I suspect a
  join of some sort is required, but that stuff confuses the hell out of
  me. I've included some relevant code below.

  Thanks!

  #db.py
  db.define_table('rooms',
      Field('name'),
  )

  db.define_table('events',
      Field('title'),
          Field('event_date', 'date'),
      Field('room_id', db.rooms)
  )

  #default.py
  def index():
      events = db().select(db.events.ALL, orderby=db.events.event_date)
      return dict(events=events)

  #index.html
  {{extend 'layout.html'}}
  table
      tr
          tdDate/tdtdEvent/tdtdRoom/td
     /tr
  {{for event in events:}}
     tr
         td{{=event.event_date}}/tdtd{{=event.title}}/
  tdtd{{=event.room_id}}/td
     /tr
  {{pass}}
  /table

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Displaying Foreign Key

2010-03-22 Thread Greg
Hello!

I have a view that lists some records (events), one of the fields
(events.room_id) is a foreign key. When i display these records I want
to display rooms.name, not events.room_id. Can someone give me a nudge
(or swift kick) in the right direction on how to do this? I suspect a
join of some sort is required, but that stuff confuses the hell out of
me. I've included some relevant code below.

Thanks!

#db.py
db.define_table('rooms',
Field('name'),
)

db.define_table('events',
Field('title'),
Field('event_date', 'date'),
Field('room_id', db.rooms)
)

#default.py
def index():
events = db().select(db.events.ALL, orderby=db.events.event_date)
return dict(events=events)

#index.html
{{extend 'layout.html'}}
table
tr
tdDate/tdtdEvent/tdtdRoom/td
   /tr
{{for event in events:}}
   tr
   td{{=event.event_date}}/tdtd{{=event.title}}/
tdtd{{=event.room_id}}/td
   /tr
{{pass}}
/table

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py:28939] Re: python.exe processes

2009-08-19 Thread Greg

Thanks for the responses.  I don't have any crons defined that I know
of, but the processes seem to multyply when I leave web2py running for
a long time, so I would assume it has something to do with cron.

I'm going to try to run with the options suggested above and will
reply if it doesn't improve.


On Aug 13, 3:44 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 yes. I think, not not sure, that the wsgi web server is recycling the
 threads after they are started that is why they may exist even if not
 used.

 On Aug 13, 3:21 pm, Yarko Tymciurak yark...@gmail.com wrote:



  By default, numthreads is 10 - add cron, and main and that gives 12...

  If you are not worried about number of requests, just running locally you
  can run without cron and with just one thread (--no-cron --numthreads=1);

  You can see all the command line options with

  python web2py.py -h

  or
  web2py.exe -h

  On Thu, Aug 13, 2009 at 2:44 PM, Fran francisb...@googlemail.com wrote:

   On Aug 13, 5:51 pm, Greg gdwar...@gmail.com wrote:
After running a web2py app for several minutes on my local machine, I
noted that 13python.exeprocesses have been started in Windows
consuming about 90MB.  Is that to be expected?

   I don't see this.
   Do you have any cron tasks defined?

   F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:28524] python.exe processes

2009-08-13 Thread Greg

After running a web2py app for several minutes on my local machine, I
noted that 13 python.exe processes have been started in Windows
consuming about 90MB.  Is that to be expected?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:24795] Re: Architecture question: can I use Web2py template engine to generate emails?

2009-06-23 Thread Greg

I'm trying to do this from the web2py shell, and I get the following
error:

 response.render('default/index.html2',context=dict(message=hello))
Traceback (most recent call last):
  File console, line 1, in module
  File /home/gwarner/web2py/gluon/globals.py, line 128, in render
run_view_in(self._view_environment)
  File /home/gwarner/web2py/gluon/compileapp.py, line 338, in
run_view_in
restricted(ccode, environment, layer)
  File /home/gwarner/web2py/gluon/restricted.py, line 115, in
restricted
raise RestrictedError(layer, code, '', environment)
RestrictedError: gluon.restricted.RestrictedError instance at
0x7f632b8c

As you can see, I'm trying to use the template index.html2, which is
the same as the default index.html, except I've moved the {{=message}}
outside of the try statement.

Is it possible to do what I'm trying to do from the shell?


On May 28, 7:22 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Please try this:

 def example():
     context= dict(one=1, two=2)
     message= response.render('default/example.html',context=context)
     print message
     return True

 On May 28, 8:47 am, Carl carl.ro...@gmail.com wrote:

  thanks for your time Massimo.

  On May 28, 2:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I see the problem.  There is something missing in my example. I will
   fix this and resend it tomorrow.

   Massimo

   On May 28, 5:18 am, Carl carl.ro...@gmail.com wrote:

small typo: I'm calling app/default/example rather than app/example

On May 28, 11:17 am, Carl carl.ro...@gmail.com wrote:

 thanks, that's very good of you.

 I've implemented a zero-fat implementation to reproduce the behaviour
 and remove my app's details...

 In controllers\default.py I have:

 def example():
     path=os.path.join(request.folder, 'views')
     context= dict(one=1, two=2)
     message= parse_template('default/
 example.html',path=path,context=context)
     print message
     return True

 In views\example.html I have 7 lines:
 An example view for emails.

 One = {{=one}}

 Two = {{two}}

 The end.

 so I call app/example
 and in my console I see this (from the print message statement):
 response.write('An example view for emails.\r\n\r\nOne =
 ',escape=False)
 response.write(one)
 response.write('\r\n\r\nTwo = ',escape=False)
 two
 response.write('\r\n\r\nThe end.',escape=False)

 I'm running on WinXP but I don't think that's relevant here.

 Hopefully you can either see the issue in my code or at least
 reproduce the behaviour using the code supplied.

 Carl

 On May 28, 12:42 am, mdipierro mdipie...@cs.depaul.edu wrote:

  can you post an example? I am confused.

  On May 27, 5:15 pm, Carl carl.ro...@gmail.com wrote:

   it's got me puzzled too.

   the text I have in my view is used but it's prefixed 
   response.write(
   and carriage returns are converted to \r\n

   a dict in my view is displayed in emails as
   response.write(absurl)

   C

   mdipierro wrote:
?

why response.write( ... escape=False) ?

On May 27, 12:13 pm, Carl carl.ro...@gmail.com wrote:
 I've implemented the code but am one step away from a working
 solution.

 The variable message contains text response.write( ... 
 escape=False)
 for each section of text and for each dictionary item I use 
 in my
 view.

 any thoughts?

 C

 On May 27, 12:16 pm, mdipierro mdipie...@cs.depaul.edu 
 wrote:

  You can use the web2pytemplatelanguage to generate emails.

  from gluon.templateimport parse_template
  from gluon.tool import Mail

  mail=Mail
  mail.settings.server='smtp.gmail.com:
  587'
  mail.settings.sender='@somewhere.com'
  mail.settings.login=None or
  'username:password'

  path=os.path.join(request.folder,views)
  context=dict(a=1,b=2,c=3,etc=etc)
  message=parse_template('file.html',path=path,context=context)
  mail.send(to=['@whatever.com'],subject='None',message=message)

  Massimo

  On May 27, 4:28 am, Carl carl.ro...@gmail.com wrote:

   web2py's templating for HTML pages makes managing page 
   structure
   populated with dynamic content very straightforward and 
   scalable.

   What approach is recommended to use this power to manage 
   emails/email
   templates?

   My application sends out emails populated with a lot of 
   dynamic data
   and before I compose a String for the body text in Python 
   I wondered
   if the existingtemplateengine could be harnessed (and if 
   so, what's
   the recommended way to leverage it)

--~--~-~--~~~---~--~~

[web2py:17192] Re: Alternate View

2009-03-01 Thread Greg Fuller

Thanks for the suggestion, but I really don't want to do that if it's
the kind of redirection that makes a round trip through the client.

On Mar 1, 1:51 am, weheh richard_gor...@verizon.net wrote:
 I suppose you could always redirect.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17196] Re: Alternate View

2009-03-01 Thread Greg Fuller

Thanks Annet and Alexandre.   What manual is this in?

On Mar 1, 2:20 am, Alexandre Miguel de Andrade Souza
alexandrema...@gmail.com wrote:
 this is correct.

 From the manual:

 • response.view: the name of the view template that must render the
 page. This is set by default to:
 1 %s/%s.html % (request.controller, request.function)
 Change the value of this variable to modify the view file associated
 with a particular action.

 2009/3/1 annet jmverm...@planet.nl





  Greg,

  As far as I know the following code solves your problem:

  def index():
     if condition:
         response.view='default/index.html'
          return dict(message=T('Hello World'))
     else:
           response.view='default/alternate.html'
           return dict(message=T('Hello World'))

  Best regards,

  Annet

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17230] Distribution with PIL

2009-03-01 Thread Greg Fuller

Web2Py  is fantastic for packaging your application into a trial
version that can just be downloaded, unpacked and run - without
dependencies.  No other framework I'm aware of can do this.

The one snag is PIL.  The applications I write usually require an
imaging library.  I know that PIL is not pure python, and requires a
compile step because of the C code. But I have also been able to find
binary distributions for the platforms I've worked on - OS/X and
Windows.   I would think there is also a Linux binary distribution
available.  But, no problem there -- PIL has been available on the
Linux platforms I've deployed on (like webfaction).

If I'm reading the PIL license correctly on pythonware.com, it can be
distributed.  So, are there any technical difficulties or licensing
reasons why a PIL binaries should not be included in a distribution?

Thanks,

--greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17232] Re: Distribution with PIL

2009-03-01 Thread Greg Fuller

I intentionally left it open as to whether I was talking about a
web2py distribution or an application package or an application
package with web2py included :)

I would like to see it in web2py, but if not, I would probably try to
bundle it myself.

If I'm not mistaken python does bundle cpickle, but cpickle is just a
fast clone of pickle.  I think there is no python only version of
PIL.  Anyway, Web2Py has different priorities than Python.

IMHO, I would be a great benefit to web2py to have PIL included if it
could be done with good success rate - not even 100%.  Maybe it could
initially be included as an experimental capability or something.

--greg--

On Mar 1, 10:52 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I agree with you that PIL is very useful.
 The issue is we need to draw a line somewhere.
 Lots of people need additional packages and we cannot include them
 all.
 After all, why is PIL not included in Python?

 If we were to include PIL in web2py we would have to take care of
 updates and binaries and we would have to guarantee backward
 compatibility of a third party package. Things will become un-
 manageble fast.

 This is not a straight NO. This is a NO for now and a call for
 comments.

 Massimo

 On Mar 1, 10:45 am, Greg Fuller gregf...@gmail.com wrote:

  Web2Py  is fantastic for packaging your application into a trial
  version that can just be downloaded, unpacked and run - without
  dependencies.  No other framework I'm aware of can do this.

  The one snag is PIL.  The applications I write usually require an
  imaging library.  I know that PIL is not pure python, and requires a
  compile step because of the C code. But I have also been able to find
  binary distributions for the platforms I've worked on - OS/X and
  Windows.   I would think there is also a Linux binary distribution
  available.  But, no problem there -- PIL has been available on the
  Linux platforms I've deployed on (like webfaction).

  If I'm reading the PIL license correctly on pythonware.com, it can be
  distributed.  So, are there any technical difficulties or licensing
  reasons why a PIL binaries should not be included in a distribution?

  Thanks,

  --greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17246] Re: Custom Template Tags

2009-03-01 Thread Greg Fuller

Yarko,

The original version is more interesting to my western eyes, and
almost as meaningful as the machine translation :-)

On Mar 1, 12:54 pm, Yarko Tymciurak yark...@gmail.com wrote:
 you can always tryhttp://translate.reference.com/translate
 it can only handle short pieces, and the translation will only give you an
 idea, for example:

 页面中通常有很多地方都需要调用的块

 ==
 '''
 In the page has the block usually which very many places need to transfer
 '''

 But better than nothing! ;-)

 2009/3/1 mdipierro mdipie...@cs.depaul.edu



  Nice, although I wish I understood the language.

  On Mar 1, 5:58 am, 姚国荣 map...@gmail.com wrote:
  http://yao.appspot.com/init/default/showblogpost/3016

   2009/3/1 Greg Fuller gregf...@gmail.com

Nice; thanks!

On Feb 28, 10:44 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Mind that you can also define functions in templates. For example

 {{def link(url):}}a href={{=url}}{{=url}}/a{{return}}

 you can put your funcitons in the template that needs them or in a
  new
 template (say aux.html) and include it {{include 'aux.html'}}

 You would then use it with {{link('http://www.web2py.com'}}

 Massimo

 On Feb 28, 9:26 pm, Greg Fuller gregf...@gmail.com wrote:

  Oh my, I see you can put any python code in a template. I'm not
  used
  to this flexibility (except for a little time with mako).  Now I
  just
  need to figure out scoping for the external functions I want to
  call.

  On Feb 28, 6:26 pm, Greg Fuller gregf...@gmail.com wrote:

   How can custom template tags be implemented in Web2py.

   There are times when it is good to let the template designer
  pull
   information into a template without having the model anticipate
   everything in advance the template might need.  I've used this
pattern
   a lot with php-smarty, django, expression engine, wordpress etc.

   something like {{products =  getProducts(categories=(5,7,9)
   include_inactive=false) }}

   {{for product in products:}}

   and so on

   I'm probably missing something really simple here, but I've
  searched
   for variations on custom template tag and can't find anything.

   Thanks,

   --greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17247] Re: Really irritating loss of code

2009-03-01 Thread Greg Fuller

I've only been hanging around here a short time, but this is not the
first time I've seen Massimo make a patch while the thread is still
fresh.   Just skip the ticket why don't you.  Impressive.

On Mar 1, 11:39 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Hi Boris,

 Your patch is in trunk with some minor modifications.
 1) if you are on the die page there is an ajax keeplive so that
 session does not expire.
 2) When you press save there is a box that changes color and tells you
 if the code was saved
 3) If the server does not respond (no save or no keepalive) the box
 turns red.

 Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17253] Re: Distribution with PIL

2009-03-01 Thread Greg Fuller

I've noticed a good number, and probably a sizable percentage,  of
web2py applications are using PIL.  Same with Django.   I'm not sure
that's true of NumPy or any other external app.  But I do see the
point.

On Mar 1, 1:54 pm, Markus Gritsch m.grit...@gmail.com wrote:
 On Sun, Mar 1, 2009 at 6:05 PM, Greg Fuller gregf...@gmail.com wrote:

  IMHO, I would be a great benefit to web2py to have PIL included if it
  could be done with good success rate - not even 100%.  Maybe it could
  initially be included as an experimental capability or something.

 Massimo is right with his arguments agaimst inclusion.  The next would
 come and would like to have NumPy or some other big Package included.
 Let's keep the binary package reasonably small, and not create a
 monster which would be hard to maintain.

 Markus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17258] Re: Distribution with PIL

2009-03-01 Thread Greg Fuller

True enough.  Could probably do a plugin which would  test for the
environment, import as, etc.  Then the work could still be shared
without loading down the base.

But darnit, I was hoping all 842 members would raise their voices in
unison for this idea.  :)

--greg--

On Mar 1, 2:15 pm, Yarko Tymciurak yark...@gmail.com wrote:
 since YOU can package your distribution for a target environment (and are
 free to include what additional libraries your application for your client
 needs), it seems to me no reason to load down a base distribution with other
 than what is always used, and base development support.

 On Sun, Mar 1, 2009 at 1:59 PM, Greg Fuller gregf...@gmail.com wrote:

  I've noticed a good number, and probably a sizable percentage,  of
  web2py applications are using PIL.  Same with Django.   I'm not sure
  that's true of NumPy or any other external app.  But I do see the
  point.

  On Mar 1, 1:54 pm, Markus Gritsch m.grit...@gmail.com wrote:
   On Sun, Mar 1, 2009 at 6:05 PM, Greg Fuller gregf...@gmail.com wrote:

IMHO, I would be a great benefit to web2py to have PIL included if it
could be done with good success rate - not even 100%.  Maybe it could
initially be included as an experimental capability or something.

   Massimo is right with his arguments agaimst inclusion.  The next would
   come and would like to have NumPy or some other big Package included.
   Let's keep the binary package reasonably small, and not create a
   monster which would be hard to maintain.

   Markus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17262] Re: Distribution with PIL

2009-03-01 Thread Greg Fuller

You're right.  I don't see this for production.  But it would be nice
to distribute a  fully self contained trial version of an app for
non-python-literate, non-developer,  potential app users,  to take for
a spin on localhost. At any rate, it's something I'll explore on my
own.

On Mar 1, 2:43 pm, Jason Brower encomp...@gmail.com wrote:
 I just used pil today, and I don't think it's a good idea.  I think if
 we keep it as small as possible we can really make a powerful system.
 A plugin system would be nice for non python OS's for example mac and
 windows, it would be easier to use the import tools in python to get
 PIL, for example.  But in linux distros almost always have packages to
 handle this stuff.  You may get an uproar if you skipped the distros way
 of installing new python libraries.
 Regards,
 Jason

 On Sun, 2009-03-01 at 12:30 -0800, Greg Fuller wrote:
  True enough.  Could probably do a plugin which would  test for the
  environment, import as, etc.  Then the work could still be shared
  without loading down the base.

  But darnit, I was hoping all 842 members would raise their voices in
  unison for this idea.  :)

  --greg--

  On Mar 1, 2:15 pm, Yarko Tymciurak yark...@gmail.com wrote:
   since YOU can package your distribution for a target environment (and are
   free to include what additional libraries your application for your client
   needs), it seems to me no reason to load down a base distribution with 
   other
   than what is always used, and base development support.

   On Sun, Mar 1, 2009 at 1:59 PM, Greg Fuller gregf...@gmail.com wrote:

I've noticed a good number, and probably a sizable percentage,  of
web2py applications are using PIL.  Same with Django.   I'm not sure
that's true of NumPy or any other external app.  But I do see the
point.

On Mar 1, 1:54 pm, Markus Gritsch m.grit...@gmail.com wrote:
 On Sun, Mar 1, 2009 at 6:05 PM, Greg Fuller gregf...@gmail.com 
 wrote:

  IMHO, I would be a great benefit to web2py to have PIL included if 
  it
  could be done with good success rate - not even 100%.  Maybe it 
  could
  initially be included as an experimental capability or something.

 Massimo is right with his arguments agaimst inclusion.  The next would
 come and would like to have NumPy or some other big Package included.
 Let's keep the binary package reasonably small, and not create a
 monster which would be hard to maintain.

 Markus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17275] Re: Distribution with PIL

2009-03-01 Thread Greg Fuller

This might work smoothly for pure python modules, but

When I tried to easy_install PIL on my mac, -- I think I remember
correctly -- it failed to build because xcode was not available. When
I installed xcode, it still would not build. So I tried a ports
package and that did not work. I finally found a pre-compiled binary.

This whole area of builds and such is hazy to me - it was a struggle
for me to get it working.  I found lots of others who had the same
problem. But maybe that was because they were just as unfamiliar with
the territory as I was.

I admit I don't fully understand this -- but if easy_install depends
on the right compilers being available for non-pure-python packages,
then the easy_install solution might be iffy at best.

--greg--



On Mar 1, 5:22 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I think what we really need is package easy_install with web2py.

 If your app needs PIL, it will check if it is there else call
 easy_install. It would work with every python module.

 If anybody could send me a patch or an example to make this work
 programmatically I will include it.

 Massimo

 On Mar 1, 3:08 pm, Greg Fuller gregf...@gmail.com wrote:

  It may benefit from a little glue code since there are different
  binaries for different platforms.  To check for environment, import
  as, or try/except, etc.  But maybe not - I could be making it more
  complex than it needs to be.  I do that sometimes.

  On Mar 1, 2:58 pm, Pedro pedro...@gmail.com wrote:

   I am not sure what point is discussed in here. What's the advantage of
   including it in web2py if you can simply drop it in the modules
   folder?

   On Mar 1, 9:52 pm, Greg Fuller gregf...@gmail.com wrote:

You're right.  I don't see this for production.  But it would be nice
to distribute a  fully self contained trial version of an app for
non-python-literate, non-developer,  potential app users,  to take for
a spin on localhost. At any rate, it's something I'll explore on my
own.

On Mar 1, 2:43 pm, Jason Brower encomp...@gmail.com wrote:

 I just used pil today, and I don't think it's a good idea.  I think if
 we keep it as small as possible we can really make a powerful system.
 A plugin system would be nice for non python OS's for example mac and
 windows, it would be easier to use the import tools in python to get
 PIL, for example.  But in linux distros almost always have packages to
 handle this stuff.  You may get an uproar if you skipped the distros 
 way
 of installing new python libraries.
 Regards,
 Jason

 On Sun, 2009-03-01 at 12:30 -0800, Greg Fuller wrote:
  True enough.  Could probably do a plugin which would  test for the
  environment, import as, etc.  Then the work could still be shared
  without loading down the base.

  But darnit, I was hoping all 842 members would raise their voices in
  unison for this idea.  :)

  --greg--

  On Mar 1, 2:15 pm, Yarko Tymciurak yark...@gmail.com wrote:
   since YOU can package your distribution for a target environment 
   (and are
   free to include what additional libraries your application for 
   your client
   needs), it seems to me no reason to load down a base distribution 
   with other
   than what is always used, and base development support.

   On Sun, Mar 1, 2009 at 1:59 PM, Greg Fuller gregf...@gmail.com 
   wrote:

I've noticed a good number, and probably a sizable percentage,  
of
web2py applications are using PIL.  Same with Django.   I'm not 
sure
that's true of NumPy or any other external app.  But I do see 
the
point.

On Mar 1, 1:54 pm, Markus Gritsch m.grit...@gmail.com wrote:
 On Sun, Mar 1, 2009 at 6:05 PM, Greg Fuller 
 gregf...@gmail.com wrote:

  IMHO, I would be a great benefit to web2py to have PIL 
  included if it
  could be done with good success rate - not even 100%.  
  Maybe it could
  initially be included as an experimental capability or 
  something.

 Massimo is right with his arguments agaimst inclusion.  The 
 next would
 come and would like to have NumPy or some other big Package 
 included.
 Let's keep the binary package reasonably small, and not 
 create a
 monster which would be hard to maintain.

 Markus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17173] Custom Template Tags

2009-02-28 Thread Greg Fuller

How can custom template tags be implemented in Web2py.

There are times when it is good to let the template designer pull
information into a template without having the model anticipate
everything in advance the template might need.  I've used this pattern
a lot with php-smarty, django, expression engine, wordpress etc.

something like {{products =  getProducts(categories=(5,7,9)
include_inactive=false) }}

{{for product in products:}}

and so on

I'm probably missing something really simple here, but I've searched
for variations on custom template tag and can't find anything.

Thanks,

--greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17172] Custom Template Tags

2009-02-28 Thread Greg Fuller

How can custom template tags be implemented in Web2py.

There are times when it is good to let the template designer pull
information into a template without having the model anticipate
everything in advance the template might need.  I've used this pattern
a lot with php-smarty, django, expression engine, wordpress etc.

something like {{products =  getProducts(categories=(5,7,9)
include_inactive=false) }}

{{for product in products:}}

and so on

I'm probably missing something really simple here, but I've searched
for variations on custom template tag and can't find anything.

Thanks,

--greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17175] Re: Custom Template Tags

2009-02-28 Thread Greg Fuller

Oh my, I see you can put any python code in a template. I'm not used
to this flexibility (except for a little time with mako).  Now I just
need to figure out scoping for the external functions I want to call.

On Feb 28, 6:26 pm, Greg Fuller gregf...@gmail.com wrote:
 How can custom template tags be implemented in Web2py.

 There are times when it is good to let the template designer pull
 information into a template without having the model anticipate
 everything in advance the template might need.  I've used this pattern
 a lot with php-smarty, django, expression engine, wordpress etc.

 something like {{products =  getProducts(categories=(5,7,9)
 include_inactive=false) }}

 {{for product in products:}}

 and so on

 I'm probably missing something really simple here, but I've searched
 for variations on custom template tag and can't find anything.

 Thanks,

 --greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17183] Re: Custom Template Tags

2009-02-28 Thread Greg Fuller

Nice; thanks!

On Feb 28, 10:44 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Mind that you can also define functions in templates. For example

 {{def link(url):}}a href={{=url}}{{=url}}/a{{return}}

 you can put your funcitons in the template that needs them or in a new
 template (say aux.html) and include it {{include 'aux.html'}}

 You would then use it with {{link('http://www.web2py.com'}}

 Massimo

 On Feb 28, 9:26 pm, Greg Fuller gregf...@gmail.com wrote:

  Oh my, I see you can put any python code in a template. I'm not used
  to this flexibility (except for a little time with mako).  Now I just
  need to figure out scoping for the external functions I want to call.

  On Feb 28, 6:26 pm, Greg Fuller gregf...@gmail.com wrote:

   How can custom template tags be implemented in Web2py.

   There are times when it is good to let the template designer pull
   information into a template without having the model anticipate
   everything in advance the template might need.  I've used this pattern
   a lot with php-smarty, django, expression engine, wordpress etc.

   something like {{products =  getProducts(categories=(5,7,9)
   include_inactive=false) }}

   {{for product in products:}}

   and so on

   I'm probably missing something really simple here, but I've searched
   for variations on custom template tag and can't find anything.

   Thanks,

   --greg--
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17186] Alternate View

2009-02-28 Thread Greg Fuller

How can I render a different view than the view with the matching
controller name?

def index():
if condition:
   # use default/index.html
return dict(message=T('Hello World'))
else:
# use default/alternate.html
??? return dict(message=T('Hello World'))

Thanks,

--greg--


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17188] Re: Documentation - Scaffold application

2009-02-28 Thread Greg Fuller

I installed it and gave it a quick look.  Nice. This could be a really
productive way to start apps.  Thanks for sharing this.

What needs to be done still?

--greg--

On Mar 1, 1:32 am, Alexandre Miguel de Andrade Souza
alexandrema...@gmail.com wrote:
 To easy of use and help in documentation, I start a kind of scaffold
 application.

 While welcome is de facto scaffold, its lacks some of new tools of
 web2py: authenticantion, crud and others.

 The objective is create a kind of more real World website, that could be
 used to adapt to users needs.

 This is the first day of project, so don't expect so much.

 --

 --
 =
 Alexandre Andrade
 Hipercenter.com

  web2py.app.scaffold.tar
 258KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17061] Re: Critical point in web2py

2009-02-27 Thread Greg Fuller

You've made some very good points.

Would the following  make sense?

Use the wiki for the initial gathering of doc pages, then after the
first sphinx-based documentation is produced,  just clean the wiki of
those pages.  After that, just use the wiki for contributed recipes
and other pages, some of which are selectively migrated to sphinx.
Keep the changes due to new releases in sphinx only.

Just asking.

--greg--



On Feb 27, 6:53 am, chris p chrispri...@gmail.com wrote:
 I've been mostly lurking, but would like to offer a few comments...

 reST to HTML is very straightforward, the docutils pacage has an
 rst2Html script to do exactly that (and it is just a few  lines of
 code). Sphinx, as Yarko has pointed out, is a tool chain using reST
 that adds better facilities for large, multi-section documents in
 reST.

 I think reST  (and Sphinx) would be a great choice for documentation.
 Sphinx is pretty new, but I have used reST for a lot of in-house doc
 and it is a very useable and maintainable markup language.

 As for combining a wiki with reST, moinmoin and Trac have done this:
    http://moinmoin.wikiwikiweb.de/HelpOnParsers/ReStructuredText
    http://bitten.edgewall.org/wiki/WikiRestructuredText

 so it would certainly be possible to integrate with a web2py-based
 wiki.

 The only think I would say to keep in mind is this:  wikis and
 structured (not reStructured) documentation are quite different in
 intent, workflow  delivery, and although you can make the argument
 that wiki pages would just become sections of the documentation the
 reality is that this would take effort to keep the wiki itself quite
 structured (not their natural state). I'm in favor of a wiki with reST
 as its markup language. And I am in favor of using reST/Sphinx for
 documentation. I'm not convinced (based on having done several doc 
 wiki projects) that combining the two is ideal.

 I think if you treat the documentation as a built deliverable with
 reST source files, and handle contributions, revisions, etc through
 source control. This makes it dead-simple to couple doc revisions with
 the web2py source itself, something that is otherwise complicated if
 you try to build doc with a live-wiki. I've not gone through every
 one, but I think you'd find most if not all of the projects 
 inhttp://sphinx.pocoo.org/examples.htmltake this approach.

 Having a wiki is still good it's great for code recipes and quick
 doc on new features, news, areas that are rapidly changing, etc. But I
 think having a dedicated set of sources for the documentation would
 result in a better organized, more coherent set of final docs. And the
 wiki can stil have links to HTML pages generated from the doc source.
 I have yet to really see a project with wiki-based documentation that
 did not seem somewhat scattered.

 chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17026] Re: Critical point in web2py

2009-02-26 Thread Greg Fuller

Just a few notes:

Sphinx is not part of Trac.

Django uses Sphinx -- docs.djangoproject.com is a Sphinx site.

The organizational and cross-referencing capabilities of Sphinx
outshine any Wiki.  Documentation organized by  a wiki often becomes
jumbled and disorganized.

However, a wiki is a good place to start, especially to get multiple
contributors.

If you can find a wiki that accepts restructured text, if will be
much, much, much easier to convert to Sphinx later.




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17027] Documentation

2009-02-26 Thread Greg Fuller

Hi Everyone,

I was following the thread on documentation and made a post there, but
it didn't show up so I'll start a thread here.

Django uses trac, but docs.djangoproject.com is not trac - it is a
Sphinx site.

Sphinx is much better than wiki's at organizing and cross referencing
documentation. Wiki documentation usually gets badly disorganized over
time.

Wiki's are better for multiple contributors.

If you use a wiki that supports restructured text, you can collect the
docs from multiple contributors in a wiki , and then much more easily
move the docs to Sphinx.

--Greg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17029] Re: Documentation

2009-02-26 Thread Greg Fuller

Here is the django documentation, in restructured text, with some
sphinx templates, in a svn repository, and referenced by trac:

http://code.djangoproject.com/browser/django/trunk/docs



On Feb 26, 7:03 pm, Greg Fuller gregf...@gmail.com wrote:
 Hi Everyone,

 I was following the thread on documentation and made a post there, but
 it didn't show up so I'll start a thread here.

 Django uses trac, but docs.djangoproject.com is not trac - it is a
 Sphinx site.

 Sphinx is much better than wiki's at organizing and cross referencing
 documentation. Wiki documentation usually gets badly disorganized over
 time.

 Wiki's are better for multiple contributors.

 If you use a wiki that supports restructured text, you can collect the
 docs from multiple contributors in a wiki , and then much more easily
 move the docs to Sphinx.

 --Greg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:17032] Re: Critical point in web2py

2009-02-26 Thread Greg Fuller

An important distinction:

1. http://docs.djangoproject.com is a Sphinx site.

2. http://code.djangoproject.com/browser/django/trunk/docs is the
sphinx documentation in an  svn repository referenced through Trac.
It holds the restructured text and Sphinx templates.

HTH, Greg

On Feb 25, 9:00 am, Fran francisb...@googlemail.com wrote:
 On Feb 25, 2:51 pm, Paul Eden benchl...@gmail.com wrote:

  - Doesn't Django use Trac?

 Yes:http://code.djangoproject.com/

  using the framework shows a lot of confidence in it

 If the Wiki could have versioning added, that would take away the
 major constraint to it.
 Not sure how hard that is...

 F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---