[web2py] Re: vue.js

2016-09-26 Thread Marlysson Silva
I intend to delve me in the Vuejs , it's an awesome library

Facilitates futher development

Em domingo, 25 de setembro de 2016 00:25:51 UTC-3, Massimo Di Pierro 
escreveu:
>
> I am becoming a huge fan of vue.js. Any other user here?
>

-- 
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: flot charts are not getting displayed

2016-09-26 Thread Anthony
On Monday, September 26, 2016 at 1:53:38 AM UTC-4, @brooks wrote:
>
> Thanks Anthony.I corrected the two things you pointed out and then checked 
> for the errors in the console.It shows error 304(file not modified) and I 
> am not able to rectify that! :(
>

Sounds like you're looking in the network tab at the HTTP requests. 
Instead, check the Javascript console to see if any Javascript errors are 
reported.

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: Include tag doesn't preserve indentation level on included text

2016-09-26 Thread Anthony
On Sunday, September 25, 2016 at 11:56:33 PM UTC-4, Marko Seppälä wrote:
>
> Hi,
>
> Not sure if this is expected behavior but I can't figure out any reason 
> why it is done like this.
>
> Currently include tag messes up the indentation level. Only first line of 
> included file is indented same level as parent file, other lines start from 
> zero. I think indentation level should be preserved, so that indentation in 
> include tag is added to every line in included file.
>
> How to fix that problem?
>

The {{include}} statement is intended to include exactly what is in the 
included file, starting at the point of the {{include}} -- if the text in 
the included file is not indented, then neither will it be indented once 
included. If you want it indented, then you must indent the text in the 
included file.

Also, note that if you are producing HTML, indenting is not necessary 
anyway.

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: Include tag doesn't preserve indentation level on included text

2016-09-26 Thread Marko Seppälä


maanantai 26. syyskuuta 2016 14.17.24 UTC+3 Anthony kirjoitti:
>
> On Sunday, September 25, 2016 at 11:56:33 PM UTC-4, Marko Seppälä wrote:
>>
>> Hi,
>>
>> Not sure if this is expected behavior but I can't figure out any reason 
>> why it is done like this.
>>
>> Currently include tag messes up the indentation level. Only first line of 
>> included file is indented same level as parent file, other lines start from 
>> zero. I think indentation level should be preserved, so that indentation in 
>> include tag is added to every line in included file.
>>
>> How to fix that problem?
>>
>
> The {{include}} statement is intended to include exactly what is in the 
> included file, starting at the point of the {{include}} -- if the text in 
> the included file is not indented, then neither will it be indented once 
> included. If you want it indented, then you must indent the text in the 
> included file.
>
> Also, note that if you are producing HTML, indenting is not necessary 
> anyway.
>
> Anthony
>

Yes I'm producing HTML and I know it's not a big problem since it's not 
affecting to functionality. But still I prefer end result which looks clean 
and is indented in a proper manner. Indenting matters for the readability 
of HTML so I want it to be right.

I could get a right end result if I manually indent every other than first 
line in a included file so that it match to indentation level in file where 
it is included. But I think this is even worse since it mixes up my 
original source code. In my opinion, include statement should work so that 
it preserves the original indentation. So if include statement is indented 
for example three tabs, then every line in included file should be indented 
three tabs plus their indentation in original file. This way your source 
code and end result looks always right.

 Is there any quick fix how I could implement that? I haven't check web2py 
template engine yet.

- Marko

-- 
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] Creating a batch using a loop

2016-09-26 Thread Oasis Agano
Greetings
im creating a payroll app and i need a to create a batch of payslips

i want to create payslips for all contracts in the database within the 
running state
 the code

def check_batch(form):

contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
for contraa in contraaa:

if contraa.salary_structure == 'Less than 3':
totgross=contraa.wage+contraa.allowances

form.vars.employee=contraa.employee.fullname
form.vars.payslip_name=contraa.employee.fullname
form.vars.contract=contraa.contract_name

form.vars.gross=totgross
form.vars.rssb_emp = totgross*0.03
form.vars.rssb_comp = totgross*0.05
form.vars.paye = 0
totrssb=form.vars.rssb_emp+form.vars.rssb_comp
form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
if type(form.vars.loan) !=int :

form.vars.net = totgross-form.vars.rssb_emp
else:
payy=db(db.loanpayment.id == 
form.vars.loan).select(db.loanpayment.ALL)
for pay in payy:
loanpay=int(pay.amount_payed)
form.vars.net = totgross-form.vars.rssb_emp-loanpay

elif contraa.salary_structure == 'Between 3 and 10':

form.vars.employee=contraa.employee.fullname
form.vars.payslip_name=contraa.employee.fullname
form.vars.contract=contraa.contract_name

totgross=contraa.wage+contraa.allowances
form.vars.gross=totgross
form.vars.rssb_emp = totgross*0.03
form.vars.rssb_comp = totgross*0.05
varia =totgross-3
form.vars.paye = varia*0.2
totrssb=form.vars.rssb_emp+form.vars.rssb_comp
form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
if type(form.vars.loan) !=int :
form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
else:
payy=db(db.loanpayment.id == 
form.vars.loan).select(db.loanpayment.ALL)
for pay in payy:
loanpay=int(pay.amount_payed)
form.vars.net = 
totgross-form.vars.rssb_emp-form.vars.paye-loanpay


#form = SQLFORM(db.payslip)



elif contraa.salary_structure=='Great than 10':

form.vars.employee=contraa.employee
form.vars.payslip_name=contraa.employee
form.vars.contract=contraa.contract_name

totgross=contraa.wage+contraa.allowances
form.vars.gross=totgross
form.vars.rssb_emp = totgross*0.03
form.vars.rssb_comp = totgross*0.05
varia2 =totgross-10
variah = varia2*0.3
varia3 =7*0.2
form.vars.paye = variah+varia3
totrssb=form.vars.rssb_emp+form.vars.rssb_comp
form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
if type(form.vars.loan) !=int :
form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
else:
payy=db(db.loanpayment.id == 
form.vars.loan).select(db.loanpayment.ALL)
for pay in payy:
loanpay=int(pay.amount_payed)
form.vars.net = 
totgross-form.vars.rssb_emp-form.vars.paye-loanpay

#form = SQLFORM(db.payslip)

else:
response.flash=T('Select a salary structure and contract')


def batch_payslip():
   db.payslip.gross.readonly =True
   db.payslip.net.readable =False
   db.payslip.rssb_emp.readable =False
   #db.payslip.salary_structure.readable =False
   db.payslip.rssb_comp.readable =False
   db.payslip.paye.readable =False
   db.payslip.employee.readable =False
   db.payslip.employee.writable =False
   db.payslip.contract.readable =False
   db.payslip.contract.writable =False
   db.payslip.payslip_name.readable =False
   db.payslip.payslip_name.writable =False
   db.payslip.loan.readable =False
   db.payslip.loan.writable =False
   db.payslip.user.readable =False
   db.payslip.user.writable =False
   form = SQLFORM(db.payslip)

   if form.process(onvalidation=check_batch).accepted:
   response.flash=T('Payslip Added')
   return dict(form=form)


im getting this error

ValueError: invalid literal for long() with base 10: 'with a contract name'

-- 
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: Creating a batch using a loop

2016-09-26 Thread Anthony
Hard to say what the problem is without seeing the full traceback as well 
as your models.

Also, what are you trying to do in the check_batch function? You are 
looping through some records and making assignments to form.vars, but only 
the final run of the loop will end up taking effect -- so what is the point 
of the loop?

Anthony

On Monday, September 26, 2016 at 8:29:35 AM UTC-4, Oasis Agano wrote:
>
> Greetings
> im creating a payroll app and i need a to create a batch of payslips
>
> i want to create payslips for all contracts in the database within the 
> running state
>  the code
>
> def check_batch(form):
>
> contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
> for contraa in contraaa:
>
> if contraa.salary_structure == 'Less than 3':
> totgross=contraa.wage+contraa.allowances
>
> form.vars.employee=contraa.employee.fullname
> form.vars.payslip_name=contraa.employee.fullname
> form.vars.contract=contraa.contract_name
>
> form.vars.gross=totgross
> form.vars.rssb_emp = totgross*0.03
> form.vars.rssb_comp = totgross*0.05
> form.vars.paye = 0
> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
> if type(form.vars.loan) !=int :
>
> form.vars.net = totgross-form.vars.rssb_emp
> else:
> payy=db(db.loanpayment.id == 
> form.vars.loan).select(db.loanpayment.ALL)
> for pay in payy:
> loanpay=int(pay.amount_payed)
> form.vars.net = totgross-form.vars.rssb_emp-loanpay
>
> elif contraa.salary_structure == 'Between 3 and 10':
>
> form.vars.employee=contraa.employee.fullname
> form.vars.payslip_name=contraa.employee.fullname
> form.vars.contract=contraa.contract_name
>
> totgross=contraa.wage+contraa.allowances
> form.vars.gross=totgross
> form.vars.rssb_emp = totgross*0.03
> form.vars.rssb_comp = totgross*0.05
> varia =totgross-3
> form.vars.paye = varia*0.2
> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
> if type(form.vars.loan) !=int :
> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
> else:
> payy=db(db.loanpayment.id == 
> form.vars.loan).select(db.loanpayment.ALL)
> for pay in payy:
> loanpay=int(pay.amount_payed)
> form.vars.net = 
> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>
>
> #form = SQLFORM(db.payslip)
>
>
>
> elif contraa.salary_structure=='Great than 10':
>
> form.vars.employee=contraa.employee
> form.vars.payslip_name=contraa.employee
> form.vars.contract=contraa.contract_name
>
> totgross=contraa.wage+contraa.allowances
> form.vars.gross=totgross
> form.vars.rssb_emp = totgross*0.03
> form.vars.rssb_comp = totgross*0.05
> varia2 =totgross-10
> variah = varia2*0.3
> varia3 =7*0.2
> form.vars.paye = variah+varia3
> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
> if type(form.vars.loan) !=int :
> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
> else:
> payy=db(db.loanpayment.id == 
> form.vars.loan).select(db.loanpayment.ALL)
> for pay in payy:
> loanpay=int(pay.amount_payed)
> form.vars.net = 
> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>
> #form = SQLFORM(db.payslip)
>
> else:
> response.flash=T('Select a salary structure and contract')
>
>
> def batch_payslip():
>db.payslip.gross.readonly =True
>db.payslip.net.readable =False
>db.payslip.rssb_emp.readable =False
>#db.payslip.salary_structure.readable =False
>db.payslip.rssb_comp.readable =False
>db.payslip.paye.readable =False
>db.payslip.employee.readable =False
>db.payslip.employee.writable =False
>db.payslip.contract.readable =False
>db.payslip.contract.writable =False
>db.payslip.payslip_name.readable =False
>db.payslip.payslip_name.writable =False
>db.payslip.loan.readable =False
>db.payslip.loan.writable =False
>db.payslip.user.readable =False
>db.payslip.user.writable =False
>form = SQLFORM(db.payslip)
>
>if form.process(onvalidation=check_batch).accepted:
>response.flash=T('Payslip Added')
>return dict(for

Re: [web2py] Re: Creating a batch using a loop

2016-09-26 Thread Michele Comitini
Could be an issue with some reference field.  Are you using a IS_IN_DB
validator in your model? could be that you are passing a wrong parameter to
the validator.   But with so little info it is just a guess.



2016-09-26 15:21 GMT+02:00 Anthony :

> Hard to say what the problem is without seeing the full traceback as well
> as your models.
>
> Also, what are you trying to do in the check_batch function? You are
> looping through some records and making assignments to form.vars, but only
> the final run of the loop will end up taking effect -- so what is the point
> of the loop?
>
> Anthony
>
>
> On Monday, September 26, 2016 at 8:29:35 AM UTC-4, Oasis Agano wrote:
>>
>> Greetings
>> im creating a payroll app and i need a to create a batch of payslips
>>
>> i want to create payslips for all contracts in the database within the
>> running state
>>  the code
>>
>> def check_batch(form):
>>
>> contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
>> for contraa in contraaa:
>>
>> if contraa.salary_structure == 'Less than 3':
>> totgross=contraa.wage+contraa.allowances
>>
>> form.vars.employee=contraa.employee.fullname
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.contract_name
>>
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> form.vars.paye = 0
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>>
>> form.vars.net = totgross-form.vars.rssb_emp
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = totgross-form.vars.rssb_emp-loanpay
>>
>> elif contraa.salary_structure == 'Between 3 and 10':
>>
>> form.vars.employee=contraa.employee.fullname
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.contract_name
>>
>> totgross=contraa.wage+contraa.allowances
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> varia =totgross-3
>> form.vars.paye = varia*0.2
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = 
>> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>>
>>
>> #form = SQLFORM(db.payslip)
>>
>>
>>
>> elif contraa.salary_structure=='Great than 10':
>>
>> form.vars.employee=contraa.employee
>> form.vars.payslip_name=contraa.employee
>> form.vars.contract=contraa.contract_name
>>
>> totgross=contraa.wage+contraa.allowances
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> varia2 =totgross-10
>> variah = varia2*0.3
>> varia3 =7*0.2
>> form.vars.paye = variah+varia3
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = 
>> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>>
>> #form = SQLFORM(db.payslip)
>>
>> else:
>> response.flash=T('Select a salary structure and contract')
>>
>>
>> def batch_payslip():
>>db.payslip.gross.readonly =True
>>db.payslip.net.readable =False
>>db.payslip.rssb_emp.readable =False
>>#db.payslip.salary_structure.readable =False
>>db.payslip.rssb_comp.readable =False
>>db.payslip.paye.readable =False
>>db.payslip.employee.readable =False
>>db.payslip.employee.writable =False
>>db.payslip.contract.readable =False
>>db.payslip.contract.writable =False
>>db.payslip.payslip_name.readable =False
>>   

Re: [web2py] Re: vue.js

2016-09-26 Thread Michele Comitini
Of course I like vue.js too.  I use ractive.js also: they are very similar
in many aspects.

2016-09-26 12:37 GMT+02:00 Marlysson Silva :

> I intend to delve me in the Vuejs , it's an awesome library
>
> Facilitates futher development
>
> Em domingo, 25 de setembro de 2016 00:25:51 UTC-3, Massimo Di Pierro
> escreveu:
>>
>> I am becoming a huge fan of vue.js. Any other user here?
>>
> --
> 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.
>

-- 
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: vue.js

2016-09-26 Thread JorgeH
I like Riot.js 


http://riotjs.com/

Give it a try!

On Saturday, September 24, 2016 at 10:25:51 PM UTC-5, Massimo Di Pierro 
wrote:
>
> I am becoming a huge fan of vue.js. Any other user here?
>

-- 
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: Include tag doesn't preserve indentation level on included text

2016-09-26 Thread Anthony


> The {{include}} statement is intended to include exactly what is in the 
>> included file, starting at the point of the {{include}} -- if the text in 
>> the included file is not indented, then neither will it be indented once 
>> included. If you want it indented, then you must indent the text in the 
>> included file.
>>
>> Also, note that if you are producing HTML, indenting is not necessary 
>> anyway.
>>
>> Anthony
>>
>
> Yes I'm producing HTML and I know it's not a big problem since it's not 
> affecting to functionality. But still I prefer end result which looks clean 
> and is indented in a proper manner. Indenting matters for the readability 
> of HTML so I want it to be right.
>

Readability is most important in the files you edit (i.e., the view files). 
Why do you need the final HTML to be so readable? If it's for debugging, I 
suppose you could always pass the output through something like Beautiful 
Soup prettify() 
 
when in development.
 

> I could get a right end result if I manually indent every other than first 
> line
>

Or indent everything (including the first line) in the included file but 
don't indent the {{include}} in the extended view.
 

> In my opinion, include statement should work so that it preserves the 
> original indentation. So if include statement is indented for example three 
> tabs, then every line in included file should be indented three tabs plus 
> their indentation in original file.
>

That would not be good default behavior because we can't always assume 
leading space represents indentation. Indentation would need to be an 
option triggered by some kind of flag.
 

> Is there any quick fix how I could implement that?
>

I don't think so. I would suggest using an alternative templating engine, 
but I don't think others (e.g., Django, Jinja2, Mako) provide this option 
either (solutions I've seen require you to specify the indentation level, 
somewhat defeating the purpose).

You could probably write a function to add the indentation, but it would 
have to be called dynamically on the included template, which would kill 
the speed benefit of compiled views.

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: Creating a batch using a loop

2016-09-26 Thread Oasis Agano
TRACEBACK

Traceback (most recent call last):
  File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\restricted.py", line 227, 
in restricted
exec ccode in environment
  File 
"D:/lab/PycharmProjects/Smartwork/web2py/applications/smartwork/controllers/default.py"
 , 
line 708, in 
  File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\globals.py", line 417, in 

self._caller = lambda f: f()
  File 
"D:/lab/PycharmProjects/Smartwork/web2py/applications/smartwork/controllers/default.py"
 , 
line 300, in batch_payslip
if form.process(onvalidation=check_batch).accepted:
  File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\html.py", line 2298, in 
process
self.validate(**kwargs)
  File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\html.py", line 2236, in 
validate
if self.accepts(**kwargs):
  File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\sqlhtml.py", line 1746, 
in accepts
self.vars.id = self.table.insert(**fields)
  File 
"D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\objects.py", 
line 726, in insert
ret = self._db._adapter.insert(self, self._listify(fields))
  File 
"D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 739, in insert
query = self._insert(table,fields)
  File 
"D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 730, in _insert
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File 
"D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 730, in 
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File 
"D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 962, in expand
rv = self.represent(expression, field_type)
  File 
"D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 1442, in represent
return str(long(obj))
ValueError: invalid literal for long() with base 10: 'Jul Contract'


Note that this contract is the second in the database


Basically what im trying to do is create a loop(from a form) that will create 
payslips for all running contracts


On Monday, September 26, 2016 at 4:21:56 PM UTC+3, Anthony wrote:
>
> Hard to say what the problem is without seeing the full traceback as well 
> as your models.
>
> Also, what are you trying to do in the check_batch function? You are 
> looping through some records and making assignments to form.vars, but only 
> the final run of the loop will end up taking effect -- so what is the point 
> of the loop?
>
> Anthony
>
> On Monday, September 26, 2016 at 8:29:35 AM UTC-4, Oasis Agano wrote:
>>
>> Greetings
>> im creating a payroll app and i need a to create a batch of payslips
>>
>> i want to create payslips for all contracts in the database within the 
>> running state
>>  the code
>>
>> def check_batch(form):
>>
>> contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
>> for contraa in contraaa:
>>
>> if contraa.salary_structure == 'Less than 3':
>> totgross=contraa.wage+contraa.allowances
>>
>> form.vars.employee=contraa.employee.fullname
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.contract_name
>>
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> form.vars.paye = 0
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>>
>> form.vars.net = totgross-form.vars.rssb_emp
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = totgross-form.vars.rssb_emp-loanpay
>>
>> elif contraa.salary_structure == 'Between 3 and 10':
>>
>> form.vars.employee=contraa.employee.fullname
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.contract_name
>>
>> totgross=contraa.wage+contraa.allowances
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> varia =totgross-3
>> form.vars.paye = varia*0.2
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
>> else:
>>

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Anthony
Well, you still haven't shown your models. My guess is one of your fields 
is a reference field, which stores long int values representing the record 
ID of the referenced record, but you are attempting to insert a string 
value.

Anyway, your approach won't work because SQLFORM only does a single insert, 
which happens after the onvalidation callback runs. So, only the last set 
of form.vars values assigned in the onvalidation for loop will end up being 
inserted in the database.

Anthony

On Monday, September 26, 2016 at 9:56:34 AM UTC-4, Oasis Agano wrote:
>
> TRACEBACK
>
> Traceback (most recent call last):
>   File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\restricted.py", line 
> 227, in restricted
> exec ccode in environment
>   File 
> "D:/lab/PycharmProjects/Smartwork/web2py/applications/smartwork/controllers/default.py"
>  , 
> line 708, in 
>   File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\globals.py", line 417, 
> in 
> self._caller = lambda f: f()
>   File 
> "D:/lab/PycharmProjects/Smartwork/web2py/applications/smartwork/controllers/default.py"
>  , 
> line 300, in batch_payslip
> if form.process(onvalidation=check_batch).accepted:
>   File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\html.py", line 2298, in 
> process
> self.validate(**kwargs)
>   File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\html.py", line 2236, in 
> validate
> if self.accepts(**kwargs):
>   File "D:\lab\PycharmProjects\Smartwork\web2py\gluon\sqlhtml.py", line 1746, 
> in accepts
> self.vars.id = self.table.insert(**fields)
>   File 
> "D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\objects.py",
>  line 726, in insert
> ret = self._db._adapter.insert(self, self._listify(fields))
>   File 
> "D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
>  line 739, in insert
> query = self._insert(table,fields)
>   File 
> "D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
>  line 730, in _insert
> values = ','.join(self.expand(v, f.type) for f, v in fields)
>   File 
> "D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
>  line 730, in 
> values = ','.join(self.expand(v, f.type) for f, v in fields)
>   File 
> "D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
>  line 962, in expand
> rv = self.represent(expression, field_type)
>   File 
> "D:\lab\PycharmProjects\Smartwork\web2py\gluon\packages\dal\pydal\adapters\base.py",
>  line 1442, in represent
> return str(long(obj))
> ValueError: invalid literal for long() with base 10: 'Jul Contract'
>
>
> Note that this contract is the second in the database
>
>
> Basically what im trying to do is create a loop(from a form) that will create 
> payslips for all running contracts
>
>
> On Monday, September 26, 2016 at 4:21:56 PM UTC+3, Anthony wrote:
>>
>> Hard to say what the problem is without seeing the full traceback as well 
>> as your models.
>>
>> Also, what are you trying to do in the check_batch function? You are 
>> looping through some records and making assignments to form.vars, but only 
>> the final run of the loop will end up taking effect -- so what is the point 
>> of the loop?
>>
>> Anthony
>>
>> On Monday, September 26, 2016 at 8:29:35 AM UTC-4, Oasis Agano wrote:
>>>
>>> Greetings
>>> im creating a payroll app and i need a to create a batch of payslips
>>>
>>> i want to create payslips for all contracts in the database within the 
>>> running state
>>>  the code
>>>
>>> def check_batch(form):
>>>
>>> contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
>>> for contraa in contraaa:
>>>
>>> if contraa.salary_structure == 'Less than 3':
>>> totgross=contraa.wage+contraa.allowances
>>>
>>> form.vars.employee=contraa.employee.fullname
>>> form.vars.payslip_name=contraa.employee.fullname
>>> form.vars.contract=contraa.contract_name
>>>
>>> form.vars.gross=totgross
>>> form.vars.rssb_emp = totgross*0.03
>>> form.vars.rssb_comp = totgross*0.05
>>> form.vars.paye = 0
>>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>>> if type(form.vars.loan) !=int :
>>>
>>> form.vars.net = totgross-form.vars.rssb_emp
>>> else:
>>> payy=db(db.loanpayment.id == 
>>> form.vars.loan).select(db.loanpayment.ALL)
>>> for pay in payy:
>>> loanpay=int(pay.amount_payed)
>>> form.vars.net = totgross-form.vars.rssb_emp-loanpay
>>>
>>> elif contraa.salary_structure == 'Between 3 and 10':
>>>
>>>

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Oasis Agano


Models are here, if this way cant work can you suggest another way of doing it

MARITAL_SET = [
T('Single'),
T('Married'),
T('Divorced'),
T('Widower')


]
TIME_SET = [
T('Part time'),
T('Full time'),


]

STATE_SET = [
T('Trial'),
T('Employed'),
T('Fired'),
T('Retired'),


]
#@auth.requires_login()

db.define_table('employee',
Field('emp_photo', 'upload',label='Photo'),
Field('first_name','string',label='First Name'),
Field('last_name','string',label='Last Name'),
Field('fullname','string',readable='False',compute=lambda r: 
r.first_name+' '+r.last_name),
Field('email','string'),
Field('phone','string'),
Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
zero=T('--choose marital status--'))),
Field('number_of_children', 'string'),
Field('name_of_children','text'),
Field('address','text'),
Field('Manager', 'reference employee'),
#Field('date','datetime'),
Field('dob', 'datetime', label='Date of Birth'),
Field('doj', 'datetime', label='Hired Date'),
Field('ismanager', 'boolean', default=False,label='Is 
Department Manager'),
Field('department', 'reference 
department',requires=IS_EMPTY_OR(IS_IN_DB(db, "department.id", 
'%(department_name)s'))),
Field('user', 'reference 
auth_user',requires=IS_EMPTY_OR(IS_IN_DB(db, "auth_user.id", '%(fullname)s'))),
Field('job', 'reference job_title'),
Field('Other', 'text'),
Field('state', requires=IS_IN_SET(STATE_SET, zero=T('--choose 
employment status--'))),
auth.signature,
format='%(fullname)s'

)
db.define_table('job_title',
Field('job_name', 'string', label='Job Title'),
auth.signature,
format='%(job_name)s'
)
#db = DAL(lazy_tables=True)
db.define_table('department',
Field('department_name', 'string', label='Department Name'),
Field('parent_dept', 'reference department'),
Field('Other', 'text'),
format='%(department_name)s'
)
#db.employee.department.requires = IS_IN_DB(db, db.department.id, 
'%(department_name)s')
 
CONTRACTTYPE_SET = [
T('Employee'),
T('Consultant'),
T('Freelance'),
T('Internship'),

]

SALARYSTRUCTURE_SET = [
T('Less than 3'),
T('Between 3 and 10'),
T('Great than 10')

]

CONTRACTSTATE_SET = [
T('Draft'),
T('Running'),
T('Expired/To Renew'),
T('Closed'),
T('Cancelled'),


]


db.define_table('contract',
Field('employee', 'reference employee', required='true',
  requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
# Field('date','datetime'),
Field('contract_name', 'string', label='Contract Title'),
Field('contract_type', requires=IS_IN_SET(CONTRACTTYPE_SET, 
zero=T('--choose contract type--'))),
Field('salary_structure', 
requires=IS_IN_SET(SALARYSTRUCTURE_SET, zero=T('--choose salary type--'))),
Field('job', 'reference job_title'),
Field('contract_scan', 'upload',label='Contract Upload'),
Field('date_trial_start', 'datetime', label='Starting Trial 
Date'),
Field('date_trial_end', 'datetime', label='End Trial Date'),
Field('date_work_start', 'datetime', label='Starting Working 
Date'),
Field('date_work_end', 'datetime', label='End of Contract'),
Field('wage', 'float'),
Field('rssb', 'boolean', default=True, label='Pay RSSB'),
Field('batch', 'boolean', default=True, label='Enable Batch 
Payslip'),
Field('allowances', 'float'),
Field('visa_no', 'string', label='Visa No'),
Field('work_permit_no', 'string', label='Work Permit No'),
Field('visa_exp', 'datetime', label='Visa Expiry Date'),
Field('other','text'),
Field('state', requires=IS_IN_SET(CONTRACTSTATE_SET, 
zero=T('--State--'))),
auth.signature
)



LOANSTATE_SET = [
T('Draft'),
T('Confirmed'),
T('Refused'),
T('Paid'),



]

LOANTYPE_SET = [
T('Advance'),
T('Long Term'),

]
db.define_table('loans',
Field('loan_name', 'string', label='Loan Title'),
Field('employee', 'reference employee', required='true',
  requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
Field('contract', 'reference contract', required='true',
  requires=IS_IN_DB(db, "contract.id", 
'%(contract_name)s')),
Field('loan_type',

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Anthony
In your model, db.payslip.contract is a reference field, but in your code, 
you attempt to assign a string value to it (form.vars.contract = 
contraa.contract_name).

Anthony

On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:
>
> Models are here, if this way cant work can you suggest another way of doing it
>
> MARITAL_SET = [
> T('Single'),
> T('Married'),
> T('Divorced'),
> T('Widower')
>
>
> ]
> TIME_SET = [
> T('Part time'),
> T('Full time'),
>
>
> ]
>
> STATE_SET = [
> T('Trial'),
> T('Employed'),
> T('Fired'),
> T('Retired'),
>
>
> ]
> #@auth.requires_login()
>
> db.define_table('employee',
> Field('emp_photo', 'upload',label='Photo'),
> Field('first_name','string',label='First Name'),
> Field('last_name','string',label='Last Name'),
> Field('fullname','string',readable='False',compute=lambda r: 
> r.first_name+' '+r.last_name),
> Field('email','string'),
> Field('phone','string'),
> Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
> zero=T('--choose marital status--'))),
> Field('number_of_children', 'string'),
> Field('name_of_children','text'),
> Field('address','text'),
> Field('Manager', 'reference employee'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date of Birth'),
> Field('doj', 'datetime', label='Hired Date'),
> Field('ismanager', 'boolean', default=False,label='Is 
> Department Manager'),
> Field('department', 'reference 
> department',requires=IS_EMPTY_OR(IS_IN_DB(db, "department.id", 
> '%(department_name)s'))),
> Field('user', 'reference 
> auth_user',requires=IS_EMPTY_OR(IS_IN_DB(db, "auth_user.id", 
> '%(fullname)s'))),
> Field('job', 'reference job_title'),
> Field('Other', 'text'),
> Field('state', requires=IS_IN_SET(STATE_SET, zero=T('--choose 
> employment status--'))),
> auth.signature,
> format='%(fullname)s'
>
> )
> db.define_table('job_title',
> Field('job_name', 'string', label='Job Title'),
> auth.signature,
> format='%(job_name)s'
> )
> #db = DAL(lazy_tables=True)
> db.define_table('department',
> Field('department_name', 'string', label='Department Name'),
> Field('parent_dept', 'reference department'),
> Field('Other', 'text'),
> format='%(department_name)s'
> )
> #db.employee.department.requires = IS_IN_DB(db, db.department.id, 
> '%(department_name)s')
>  
> CONTRACTTYPE_SET = [
> T('Employee'),
> T('Consultant'),
> T('Freelance'),
> T('Internship'),
>
> ]
>
> SALARYSTRUCTURE_SET = [
> T('Less than 3'),
> T('Between 3 and 10'),
> T('Great than 10')
>
> ]
>
> CONTRACTSTATE_SET = [
> T('Draft'),
> T('Running'),
> T('Expired/To Renew'),
> T('Closed'),
> T('Cancelled'),
>
>
> ]
>
>
> db.define_table('contract',
> Field('employee', 'reference employee', required='true',
>   requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
> # Field('date','datetime'),
> Field('contract_name', 'string', label='Contract Title'),
> Field('contract_type', requires=IS_IN_SET(CONTRACTTYPE_SET, 
> zero=T('--choose contract type--'))),
> Field('salary_structure', 
> requires=IS_IN_SET(SALARYSTRUCTURE_SET, zero=T('--choose salary type--'))),
> Field('job', 'reference job_title'),
> Field('contract_scan', 'upload',label='Contract Upload'),
> Field('date_trial_start', 'datetime', label='Starting Trial 
> Date'),
> Field('date_trial_end', 'datetime', label='End Trial Date'),
> Field('date_work_start', 'datetime', label='Starting Working 
> Date'),
> Field('date_work_end', 'datetime', label='End of Contract'),
> Field('wage', 'float'),
> Field('rssb', 'boolean', default=True, label='Pay RSSB'),
> Field('batch', 'boolean', default=True, label='Enable Batch 
> Payslip'),
> Field('allowances', 'float'),
> Field('visa_no', 'string', label='Visa No'),
> Field('work_permit_no', 'string', label='Work Permit No'),
> Field('visa_exp', 'datetime', label='Visa Expiry Date'),
> Field('other','text'),
> Field('state', requires=IS_IN_SET(CONTRACTSTATE_SET, 
> zero=T('--State--'))),
> auth.signature
> )
>
>
>
> LOANSTATE_SET = [
> T('Draft'),
> T('Confirmed'),
> T('Refused'),
> T

[web2py] Re: Include tag doesn't preserve indentation level on included text

2016-09-26 Thread Marko Seppälä


maanantai 26. syyskuuta 2016 16.55.13 UTC+3 Anthony kirjoitti:
>
>
> The {{include}} statement is intended to include exactly what is in the 
>>> included file, starting at the point of the {{include}} -- if the text in 
>>> the included file is not indented, then neither will it be indented once 
>>> included. If you want it indented, then you must indent the text in the 
>>> included file.
>>>
>>> Also, note that if you are producing HTML, indenting is not necessary 
>>> anyway.
>>>
>>> Anthony
>>>
>>
>> Yes I'm producing HTML and I know it's not a big problem since it's not 
>> affecting to functionality. But still I prefer end result which looks clean 
>> and is indented in a proper manner. Indenting matters for the readability 
>> of HTML so I want it to be right.
>>
>
> Readability is most important in the files you edit (i.e., the view 
> files). Why do you need the final HTML to be so readable? If it's for 
> debugging, I suppose you could always pass the output through something 
> like Beautiful Soup prettify() 
>  
> when in development.
>  
>
>> I could get a right end result if I manually indent every other than 
>> first line
>>
>
> Or indent everything (including the first line) in the included file but 
> don't indent the {{include}} in the extended view.
>  
>
>> In my opinion, include statement should work so that it preserves the 
>> original indentation. So if include statement is indented for example three 
>> tabs, then every line in included file should be indented three tabs plus 
>> their indentation in original file.
>>
>
> That would not be good default behavior because we can't always assume 
> leading space represents indentation. Indentation would need to be an 
> option triggered by some kind of flag.
>  
>
>> Is there any quick fix how I could implement that?
>>
>
> I don't think so. I would suggest using an alternative templating engine, 
> but I don't think others (e.g., Django, Jinja2, Mako) provide this option 
> either (solutions I've seen require you to specify the indentation level, 
> somewhat defeating the purpose).
>
> You could probably write a function to add the indentation, but it would 
> have to be called dynamically on the included template, which would kill 
> the speed benefit of compiled views.
>
> Anthony
>

It actually doesn't matter that much for me, I only work with web2py 
templates.  End result just looks little unprofessional since it's not 
formatted properly and I couldn't figure out any reason why not to do so. 
But I understand now your point. Django doesn't have this feature either.

I think this would be a nice to have feature in production to get cleaner 
and more professional looking end result. And human readable HTML helps 
also in development, especially if you're working with someone who is not 
familiar with web2py templates. Optional flag solution would be good which 
could be set if we want to preserve the indentation.

-- 
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: Creating a batch using a loop

2016-09-26 Thread Oasis Agano
i changed it to form.vars.contract = contraa.id
but still getting the same error

On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:
>
> In your model, db.payslip.contract is a reference field, but in your code, 
> you attempt to assign a string value to it (form.vars.contract = 
> contraa.contract_name).
>
> Anthony
>
> On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:
>>
>> Models are here, if this way cant work can you suggest another way of doing 
>> it
>>
>> MARITAL_SET = [
>> T('Single'),
>> T('Married'),
>> T('Divorced'),
>> T('Widower')
>>
>>
>> ]
>> TIME_SET = [
>> T('Part time'),
>> T('Full time'),
>>
>>
>> ]
>>
>> STATE_SET = [
>> T('Trial'),
>> T('Employed'),
>> T('Fired'),
>> T('Retired'),
>>
>>
>> ]
>> #@auth.requires_login()
>>
>> db.define_table('employee',
>> Field('emp_photo', 'upload',label='Photo'),
>> Field('first_name','string',label='First Name'),
>> Field('last_name','string',label='Last Name'),
>> Field('fullname','string',readable='False',compute=lambda r: 
>> r.first_name+' '+r.last_name),
>> Field('email','string'),
>> Field('phone','string'),
>> Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
>> zero=T('--choose marital status--'))),
>> Field('number_of_children', 'string'),
>> Field('name_of_children','text'),
>> Field('address','text'),
>> Field('Manager', 'reference employee'),
>> #Field('date','datetime'),
>> Field('dob', 'datetime', label='Date of Birth'),
>> Field('doj', 'datetime', label='Hired Date'),
>> Field('ismanager', 'boolean', default=False,label='Is 
>> Department Manager'),
>> Field('department', 'reference 
>> department',requires=IS_EMPTY_OR(IS_IN_DB(db, "department.id", 
>> '%(department_name)s'))),
>> Field('user', 'reference 
>> auth_user',requires=IS_EMPTY_OR(IS_IN_DB(db, "auth_user.id", 
>> '%(fullname)s'))),
>> Field('job', 'reference job_title'),
>> Field('Other', 'text'),
>> Field('state', requires=IS_IN_SET(STATE_SET, 
>> zero=T('--choose employment status--'))),
>> auth.signature,
>> format='%(fullname)s'
>>
>> )
>> db.define_table('job_title',
>> Field('job_name', 'string', label='Job Title'),
>> auth.signature,
>> format='%(job_name)s'
>> )
>> #db = DAL(lazy_tables=True)
>> db.define_table('department',
>> Field('department_name', 'string', label='Department Name'),
>> Field('parent_dept', 'reference department'),
>> Field('Other', 'text'),
>> format='%(department_name)s'
>> )
>> #db.employee.department.requires = IS_IN_DB(db, db.department.id, 
>> '%(department_name)s')
>>  
>> CONTRACTTYPE_SET = [
>> T('Employee'),
>> T('Consultant'),
>> T('Freelance'),
>> T('Internship'),
>>
>> ]
>>
>> SALARYSTRUCTURE_SET = [
>> T('Less than 3'),
>> T('Between 3 and 10'),
>> T('Great than 10')
>>
>> ]
>>
>> CONTRACTSTATE_SET = [
>> T('Draft'),
>> T('Running'),
>> T('Expired/To Renew'),
>> T('Closed'),
>> T('Cancelled'),
>>
>>
>> ]
>>
>>
>> db.define_table('contract',
>> Field('employee', 'reference employee', required='true',
>>   requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
>> # Field('date','datetime'),
>> Field('contract_name', 'string', label='Contract Title'),
>> Field('contract_type', requires=IS_IN_SET(CONTRACTTYPE_SET, 
>> zero=T('--choose contract type--'))),
>> Field('salary_structure', 
>> requires=IS_IN_SET(SALARYSTRUCTURE_SET, zero=T('--choose salary type--'))),
>> Field('job', 'reference job_title'),
>> Field('contract_scan', 'upload',label='Contract Upload'),
>> Field('date_trial_start', 'datetime', label='Starting Trial 
>> Date'),
>> Field('date_trial_end', 'datetime', label='End Trial Date'),
>> Field('date_work_start', 'datetime', label='Starting Working 
>> Date'),
>> Field('date_work_end', 'datetime', label='End of Contract'),
>> Field('wage', 'float'),
>> Field('rssb', 'boolean', default=True, label='Pay RSSB'),
>> Field('batch', 'boolean', default=True, label='Enable Batch 
>> Payslip'),
>> Field('allowances', 'float'),
>> Field('visa_no', 'string', label='Visa No'),
>> Field('work_permit_no', 'string', label='Work Permit No'),
>> Field('visa_exp', 'datetime', label='Visa Expiry

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Jim S
You're setting form.vars.employee = contraa.employee.fullname 

It should be set to the employee id, not the name.  Results in the same 
problem as with contract name/id.

Should just be contraa.employee I believe...

-Jim

On Monday, September 26, 2016 at 10:23:15 AM UTC-5, Oasis Agano wrote:
>
> i changed it to form.vars.contract = contraa.id
> but still getting the same error
>
> On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:
>>
>> In your model, db.payslip.contract is a reference field, but in your 
>> code, you attempt to assign a string value to it (form.vars.contract = 
>> contraa.contract_name).
>>
>> Anthony
>>
>> On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:
>>>
>>> Models are here, if this way cant work can you suggest another way of doing 
>>> it
>>>
>>> MARITAL_SET = [
>>> T('Single'),
>>> T('Married'),
>>> T('Divorced'),
>>> T('Widower')
>>>
>>>
>>> ]
>>> TIME_SET = [
>>> T('Part time'),
>>> T('Full time'),
>>>
>>>
>>> ]
>>>
>>> STATE_SET = [
>>> T('Trial'),
>>> T('Employed'),
>>> T('Fired'),
>>> T('Retired'),
>>>
>>>
>>> ]
>>> #@auth.requires_login()
>>>
>>> db.define_table('employee',
>>> Field('emp_photo', 'upload',label='Photo'),
>>> Field('first_name','string',label='First Name'),
>>> Field('last_name','string',label='Last Name'),
>>> Field('fullname','string',readable='False',compute=lambda 
>>> r: r.first_name+' '+r.last_name),
>>> Field('email','string'),
>>> Field('phone','string'),
>>> Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
>>> zero=T('--choose marital status--'))),
>>> Field('number_of_children', 'string'),
>>> Field('name_of_children','text'),
>>> Field('address','text'),
>>> Field('Manager', 'reference employee'),
>>> #Field('date','datetime'),
>>> Field('dob', 'datetime', label='Date of Birth'),
>>> Field('doj', 'datetime', label='Hired Date'),
>>> Field('ismanager', 'boolean', default=False,label='Is 
>>> Department Manager'),
>>> Field('department', 'reference 
>>> department',requires=IS_EMPTY_OR(IS_IN_DB(db, "department.id", 
>>> '%(department_name)s'))),
>>> Field('user', 'reference 
>>> auth_user',requires=IS_EMPTY_OR(IS_IN_DB(db, "auth_user.id", 
>>> '%(fullname)s'))),
>>> Field('job', 'reference job_title'),
>>> Field('Other', 'text'),
>>> Field('state', requires=IS_IN_SET(STATE_SET, 
>>> zero=T('--choose employment status--'))),
>>> auth.signature,
>>> format='%(fullname)s'
>>>
>>> )
>>> db.define_table('job_title',
>>> Field('job_name', 'string', label='Job Title'),
>>> auth.signature,
>>> format='%(job_name)s'
>>> )
>>> #db = DAL(lazy_tables=True)
>>> db.define_table('department',
>>> Field('department_name', 'string', label='Department Name'),
>>> Field('parent_dept', 'reference department'),
>>> Field('Other', 'text'),
>>> format='%(department_name)s'
>>> )
>>> #db.employee.department.requires = IS_IN_DB(db, db.department.id, 
>>> '%(department_name)s')
>>>  
>>> CONTRACTTYPE_SET = [
>>> T('Employee'),
>>> T('Consultant'),
>>> T('Freelance'),
>>> T('Internship'),
>>>
>>> ]
>>>
>>> SALARYSTRUCTURE_SET = [
>>> T('Less than 3'),
>>> T('Between 3 and 10'),
>>> T('Great than 10')
>>>
>>> ]
>>>
>>> CONTRACTSTATE_SET = [
>>> T('Draft'),
>>> T('Running'),
>>> T('Expired/To Renew'),
>>> T('Closed'),
>>> T('Cancelled'),
>>>
>>>
>>> ]
>>>
>>>
>>> db.define_table('contract',
>>> Field('employee', 'reference employee', required='true',
>>>   requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
>>> # Field('date','datetime'),
>>> Field('contract_name', 'string', label='Contract Title'),
>>> Field('contract_type', requires=IS_IN_SET(CONTRACTTYPE_SET, 
>>> zero=T('--choose contract type--'))),
>>> Field('salary_structure', 
>>> requires=IS_IN_SET(SALARYSTRUCTURE_SET, zero=T('--choose salary type--'))),
>>> Field('job', 'reference job_title'),
>>> Field('contract_scan', 'upload',label='Contract Upload'),
>>> Field('date_trial_start', 'datetime', label='Starting Trial 
>>> Date'),
>>> Field('date_trial_end', 'datetime', label='End Trial Date'),
>>> Field('date_work_start', 'datetime', label='Starting 
>>> Working Date'),
>>> Field('date_work_end', 'datetime', label='End of Contract'),
>>> Field('wage', 'float

[web2py] Re: Include tag doesn't preserve indentation level on included text

2016-09-26 Thread Anthony


> It actually doesn't matter that much for me, I only work with web2py 
> templates.  End result just looks little unprofessional since it's not 
> formatted properly and I couldn't figure out any reason why not to do so.
>

"Unprofessional" to whom? Who's looking at the page source that you're 
trying to impress (that wouldn't understand the nature of template engines 
and the unimportance of indentation)?
 

> I think this would be a nice to have feature in production to get cleaner 
> and more professional looking end result.
>

Production is the one place you probably don't want this feature, as it 
would require a little extra processing and increase the payload.
 

> And human readable HTML helps also in development, especially if you're 
> working with someone who is not familiar with web2py templates.
>

Again, keep in mind that you can just indent the content in the included 
file. Any decent code editor will let you quickly indent multiple lines 
simultaneously.

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: Include tag doesn't preserve indentation level on included text

2016-09-26 Thread Marko Seppälä


maanantai 26. syyskuuta 2016 20.11.06 UTC+3 Anthony kirjoitti:
>
>
> It actually doesn't matter that much for me, I only work with web2py 
>> templates.  End result just looks little unprofessional since it's not 
>> formatted properly and I couldn't figure out any reason why not to do so.
>>
>
> "Unprofessional" to whom? Who's looking at the page source that you're 
> trying to impress (that wouldn't understand the nature of template engines 
> and the unimportance of indentation)?
>  
>
>> I think this would be a nice to have feature in production to get cleaner 
>> and more professional looking end result.
>>
>
> Production is the one place you probably don't want this feature, as it 
> would require a little extra processing and increase the payload.
>  
>
>> And human readable HTML helps also in development, especially if you're 
>> working with someone who is not familiar with web2py templates.
>>
>
> Again, keep in mind that you can just indent the content in the included 
> file. Any decent code editor will let you quickly indent multiple lines 
> simultaneously.
>
> Anthony
>

Yes I know I can indent multiple lines simultaneously but it's still manual 
and unnecessary work, also messes up my source so not really an option. The 
whole point was that if there is no harm to indent everything properly by 
template engine, then why not to do it. But I understood your point why 
it's not implemented by default so basically it answers to my question.

Not sure how much more processing and payload is needed if this is 
implemented. If it's practically zero then I would do it but of course if 
it's significant then it's better to let it be like it's now.

-- 
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] embed a video file

2016-09-26 Thread SR
How do I embed a video file in my webpage?

-- 
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: Creating a batch using a loop

2016-09-26 Thread Oasis Agano
Well its progressing now, using 

form.vars.employee=contraa.employee
form.vars.payslip_name=contraa.employee.fullname
form.vars.contract=contraa.id


Now it is inserting only one payslip(from one contract) but not inserting the 
other one


On Monday, September 26, 2016 at 7:54:03 PM UTC+3, Jim S wrote:
>
> You're setting form.vars.employee = contraa.employee.fullname 
>
> It should be set to the employee id, not the name.  Results in the same 
> problem as with contract name/id.
>
> Should just be contraa.employee I believe...
>
> -Jim
>
> On Monday, September 26, 2016 at 10:23:15 AM UTC-5, Oasis Agano wrote:
>>
>> i changed it to form.vars.contract = contraa.id
>> but still getting the same error
>>
>> On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:
>>>
>>> In your model, db.payslip.contract is a reference field, but in your 
>>> code, you attempt to assign a string value to it (form.vars.contract = 
>>> contraa.contract_name).
>>>
>>> Anthony
>>>
>>> On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:

 Models are here, if this way cant work can you suggest another way of 
 doing it

 MARITAL_SET = [
 T('Single'),
 T('Married'),
 T('Divorced'),
 T('Widower')


 ]
 TIME_SET = [
 T('Part time'),
 T('Full time'),


 ]

 STATE_SET = [
 T('Trial'),
 T('Employed'),
 T('Fired'),
 T('Retired'),


 ]
 #@auth.requires_login()

 db.define_table('employee',
 Field('emp_photo', 'upload',label='Photo'),
 Field('first_name','string',label='First Name'),
 Field('last_name','string',label='Last Name'),
 Field('fullname','string',readable='False',compute=lambda 
 r: r.first_name+' '+r.last_name),
 Field('email','string'),
 Field('phone','string'),
 Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
 zero=T('--choose marital status--'))),
 Field('number_of_children', 'string'),
 Field('name_of_children','text'),
 Field('address','text'),
 Field('Manager', 'reference employee'),
 #Field('date','datetime'),
 Field('dob', 'datetime', label='Date of Birth'),
 Field('doj', 'datetime', label='Hired Date'),
 Field('ismanager', 'boolean', default=False,label='Is 
 Department Manager'),
 Field('department', 'reference 
 department',requires=IS_EMPTY_OR(IS_IN_DB(db, "department.id", 
 '%(department_name)s'))),
 Field('user', 'reference 
 auth_user',requires=IS_EMPTY_OR(IS_IN_DB(db, "auth_user.id", 
 '%(fullname)s'))),
 Field('job', 'reference job_title'),
 Field('Other', 'text'),
 Field('state', requires=IS_IN_SET(STATE_SET, 
 zero=T('--choose employment status--'))),
 auth.signature,
 format='%(fullname)s'

 )
 db.define_table('job_title',
 Field('job_name', 'string', label='Job Title'),
 auth.signature,
 format='%(job_name)s'
 )
 #db = DAL(lazy_tables=True)
 db.define_table('department',
 Field('department_name', 'string', label='Department 
 Name'),
 Field('parent_dept', 'reference department'),
 Field('Other', 'text'),
 format='%(department_name)s'
 )
 #db.employee.department.requires = IS_IN_DB(db, db.department.id, 
 '%(department_name)s')
  
 CONTRACTTYPE_SET = [
 T('Employee'),
 T('Consultant'),
 T('Freelance'),
 T('Internship'),

 ]

 SALARYSTRUCTURE_SET = [
 T('Less than 3'),
 T('Between 3 and 10'),
 T('Great than 10')

 ]

 CONTRACTSTATE_SET = [
 T('Draft'),
 T('Running'),
 T('Expired/To Renew'),
 T('Closed'),
 T('Cancelled'),


 ]


 db.define_table('contract',
 Field('employee', 'reference employee', required='true',
   requires=IS_IN_DB(db, "employee.id", 
 '%(fullname)s')),
 # Field('date','datetime'),
 Field('contract_name', 'string', label='Contract Title'),
 Field('contract_type', 
 requires=IS_IN_SET(CONTRACTTYPE_SET, zero=T('--choose contract type--'))),
 Field('salary_structure', 
 requires=IS_IN_SET(SALARYSTRUCTURE_SET, zero=T('--choose salary type--'))),
 Field('job', 'reference job_title'),
 

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Jim S
I think that is all that it should do.

Your check_batch function is being called at the validation stage of 
processing your form.  All your check_batch function does is reassign 
values to the form variables that you've captured.  After it is done, the 
web2py form processing will insert the current values of the form variables 
into the database for you.  See Anthony's first reply.  I think your 
approach to this is somewhat flawed.

Here is what I see is happening:

1. User makes a request to the batch_payslips function.  Result is that a 
form is displayed.  
2. User enters values into the form and clicks on Submit.
3. Your onvalidation method (check_batch) is invoked.  This method resets a 
bunch of the form variables, but since it is in a loop, the variables set 
in the last pass through the loop are retained in the form variables.
4. sqlform.process().accepted takes over and inserts a record into payslips 
based on the current values of the form variables.

>From what I think you're trying to do, I'd re-architect a bit.

1. Use a SQFORM.factory to gather whatever information it is your asking of 
the user. 
 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-factory
2. Instead of loop through the RUNNING contracts in the onvalidation 
function (check_batch), put that code after the "if 
form.process().accepts:" statement.
3. Update that code to manually insert the records into payslips instead of 
just assigning values to the form 
variables. 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert

I hope this helps.  My apologies if I'm misunderstanding your goals.

-Jim


On Monday, September 26, 2016 at 2:48:32 PM UTC-5, Oasis Agano wrote:
>
> Well its progressing now, using 
>
> form.vars.employee=contraa.employee
> form.vars.payslip_name=contraa.employee.fullname
> form.vars.contract=contraa.id
>
>
> Now it is inserting only one payslip(from one contract) but not inserting the 
> other one
>
>
> On Monday, September 26, 2016 at 7:54:03 PM UTC+3, Jim S wrote:
>>
>> You're setting form.vars.employee = contraa.employee.fullname 
>>
>> It should be set to the employee id, not the name.  Results in the same 
>> problem as with contract name/id.
>>
>> Should just be contraa.employee I believe...
>>
>> -Jim
>>
>> On Monday, September 26, 2016 at 10:23:15 AM UTC-5, Oasis Agano wrote:
>>>
>>> i changed it to form.vars.contract = contraa.id
>>> but still getting the same error
>>>
>>> On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:

 In your model, db.payslip.contract is a reference field, but in your 
 code, you attempt to assign a string value to it (form.vars.contract = 
 contraa.contract_name).

 Anthony

 On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:
>
> Models are here, if this way cant work can you suggest another way of 
> doing it
>
> MARITAL_SET = [
> T('Single'),
> T('Married'),
> T('Divorced'),
> T('Widower')
>
>
> ]
> TIME_SET = [
> T('Part time'),
> T('Full time'),
>
>
> ]
>
> STATE_SET = [
> T('Trial'),
> T('Employed'),
> T('Fired'),
> T('Retired'),
>
>
> ]
> #@auth.requires_login()
>
> db.define_table('employee',
> Field('emp_photo', 'upload',label='Photo'),
> Field('first_name','string',label='First Name'),
> Field('last_name','string',label='Last Name'),
> Field('fullname','string',readable='False',compute=lambda 
> r: r.first_name+' '+r.last_name),
> Field('email','string'),
> Field('phone','string'),
> Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
> zero=T('--choose marital status--'))),
> Field('number_of_children', 'string'),
> Field('name_of_children','text'),
> Field('address','text'),
> Field('Manager', 'reference employee'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date of Birth'),
> Field('doj', 'datetime', label='Hired Date'),
> Field('ismanager', 'boolean', default=False,label='Is 
> Department Manager'),
> Field('department', 'reference 
> department',requires=IS_EMPTY_OR(IS_IN_DB(db, "department.id", 
> '%(department_name)s'))),
> Field('user', 'reference 
> auth_user',requires=IS_EMPTY_OR(IS_IN_DB(db, "auth_user.id", 
> '%(fullname)s'))),
> Field('job', 'reference job_title'),
> Field('Other', 'text'),
> Field('state', requires=IS_IN_SET(STATE_SET, 
> zero=T('--choose employment status--'))),
> auth.signature,
>>

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Oasis Agano
Briefly what im trying to do is to create payslips for all contracts in the 
db through a loop,
i just checked sqlform factory but i have a question where do i pass the 
form(payslip table) to insert in into after if form.process().accepts:

On Monday, September 26, 2016 at 11:09:52 PM UTC+3, Jim S wrote:
>
> I think that is all that it should do.
>
> Your check_batch function is being called at the validation stage of 
> processing your form.  All your check_batch function does is reassign 
> values to the form variables that you've captured.  After it is done, the 
> web2py form processing will insert the current values of the form variables 
> into the database for you.  See Anthony's first reply.  I think your 
> approach to this is somewhat flawed.
>
> Here is what I see is happening:
>
> 1. User makes a request to the batch_payslips function.  Result is that a 
> form is displayed.  
> 2. User enters values into the form and clicks on Submit.
> 3. Your onvalidation method (check_batch) is invoked.  This method resets 
> a bunch of the form variables, but since it is in a loop, the variables set 
> in the last pass through the loop are retained in the form variables.
> 4. sqlform.process().accepted takes over and inserts a record into 
> payslips based on the current values of the form variables.
>
> From what I think you're trying to do, I'd re-architect a bit.
>
> 1. Use a SQFORM.factory to gather whatever information it is your asking 
> of the user.  
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-factory
> 2. Instead of loop through the RUNNING contracts in the onvalidation 
> function (check_batch), put that code after the "if 
> form.process().accepts:" statement.
> 3. Update that code to manually insert the records into payslips instead 
> of just assigning values to the form variables. 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert
>
> I hope this helps.  My apologies if I'm misunderstanding your goals.
>
> -Jim
>
>
> On Monday, September 26, 2016 at 2:48:32 PM UTC-5, Oasis Agano wrote:
>>
>> Well its progressing now, using 
>>
>> form.vars.employee=contraa.employee
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.id
>>
>>
>> Now it is inserting only one payslip(from one contract) but not inserting 
>> the other one
>>
>>
>> On Monday, September 26, 2016 at 7:54:03 PM UTC+3, Jim S wrote:
>>>
>>> You're setting form.vars.employee = contraa.employee.fullname 
>>>
>>> It should be set to the employee id, not the name.  Results in the same 
>>> problem as with contract name/id.
>>>
>>> Should just be contraa.employee I believe...
>>>
>>> -Jim
>>>
>>> On Monday, September 26, 2016 at 10:23:15 AM UTC-5, Oasis Agano wrote:

 i changed it to form.vars.contract = contraa.id
 but still getting the same error

 On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:
>
> In your model, db.payslip.contract is a reference field, but in your 
> code, you attempt to assign a string value to it (form.vars.contract = 
> contraa.contract_name).
>
> Anthony
>
> On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:
>>
>> Models are here, if this way cant work can you suggest another way of 
>> doing it
>>
>> MARITAL_SET = [
>> T('Single'),
>> T('Married'),
>> T('Divorced'),
>> T('Widower')
>>
>>
>> ]
>> TIME_SET = [
>> T('Part time'),
>> T('Full time'),
>>
>>
>> ]
>>
>> STATE_SET = [
>> T('Trial'),
>> T('Employed'),
>> T('Fired'),
>> T('Retired'),
>>
>>
>> ]
>> #@auth.requires_login()
>>
>> db.define_table('employee',
>> Field('emp_photo', 'upload',label='Photo'),
>> Field('first_name','string',label='First Name'),
>> Field('last_name','string',label='Last Name'),
>> 
>> Field('fullname','string',readable='False',compute=lambda r: 
>> r.first_name+' '+r.last_name),
>> Field('email','string'),
>> Field('phone','string'),
>> Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
>> zero=T('--choose marital status--'))),
>> Field('number_of_children', 'string'),
>> Field('name_of_children','text'),
>> Field('address','text'),
>> Field('Manager', 'reference employee'),
>> #Field('date','datetime'),
>> Field('dob', 'datetime', label='Date of Birth'),
>> Field('doj', 'datetime', label='Hired Date'),
>> Field('ismanager', 'boolean', default=False,label='Is 
>> Department Manager'),
>> Field('department', 'reference 
>> department',requires=IS_EMPTY_

[web2py] Re: Looking for a web2py contractor

2016-09-26 Thread Jeff Lipkowitz
Looking forward!

On Friday, 23 September 2016 10:49:52 UTC-5, Jeff Lipkowitz wrote:
>
> I'm looking for a web2py contractor with SOAP experience.  
>
> Please send resumes and work experience examples to 
> j...@redbrickanalytics.com 
>

-- 
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: Creating a batch using a loop

2016-09-26 Thread Oasis Agano
Well all the answers helped but the sqlform factory solved it

On Monday, September 26, 2016 at 3:29:35 PM UTC+3, Oasis Agano wrote:
>
> Greetings
> im creating a payroll app and i need a to create a batch of payslips
>
> i want to create payslips for all contracts in the database within the 
> running state
>  the code
>
> def check_batch(form):
>
> contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
> for contraa in contraaa:
>
> if contraa.salary_structure == 'Less than 3':
> totgross=contraa.wage+contraa.allowances
>
> form.vars.employee=contraa.employee.fullname
> form.vars.payslip_name=contraa.employee.fullname
> form.vars.contract=contraa.contract_name
>
> form.vars.gross=totgross
> form.vars.rssb_emp = totgross*0.03
> form.vars.rssb_comp = totgross*0.05
> form.vars.paye = 0
> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
> if type(form.vars.loan) !=int :
>
> form.vars.net = totgross-form.vars.rssb_emp
> else:
> payy=db(db.loanpayment.id == 
> form.vars.loan).select(db.loanpayment.ALL)
> for pay in payy:
> loanpay=int(pay.amount_payed)
> form.vars.net = totgross-form.vars.rssb_emp-loanpay
>
> elif contraa.salary_structure == 'Between 3 and 10':
>
> form.vars.employee=contraa.employee.fullname
> form.vars.payslip_name=contraa.employee.fullname
> form.vars.contract=contraa.contract_name
>
> totgross=contraa.wage+contraa.allowances
> form.vars.gross=totgross
> form.vars.rssb_emp = totgross*0.03
> form.vars.rssb_comp = totgross*0.05
> varia =totgross-3
> form.vars.paye = varia*0.2
> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
> if type(form.vars.loan) !=int :
> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
> else:
> payy=db(db.loanpayment.id == 
> form.vars.loan).select(db.loanpayment.ALL)
> for pay in payy:
> loanpay=int(pay.amount_payed)
> form.vars.net = 
> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>
>
> #form = SQLFORM(db.payslip)
>
>
>
> elif contraa.salary_structure=='Great than 10':
>
> form.vars.employee=contraa.employee
> form.vars.payslip_name=contraa.employee
> form.vars.contract=contraa.contract_name
>
> totgross=contraa.wage+contraa.allowances
> form.vars.gross=totgross
> form.vars.rssb_emp = totgross*0.03
> form.vars.rssb_comp = totgross*0.05
> varia2 =totgross-10
> variah = varia2*0.3
> varia3 =7*0.2
> form.vars.paye = variah+varia3
> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
> if type(form.vars.loan) !=int :
> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
> else:
> payy=db(db.loanpayment.id == 
> form.vars.loan).select(db.loanpayment.ALL)
> for pay in payy:
> loanpay=int(pay.amount_payed)
> form.vars.net = 
> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>
> #form = SQLFORM(db.payslip)
>
> else:
> response.flash=T('Select a salary structure and contract')
>
>
> def batch_payslip():
>db.payslip.gross.readonly =True
>db.payslip.net.readable =False
>db.payslip.rssb_emp.readable =False
>#db.payslip.salary_structure.readable =False
>db.payslip.rssb_comp.readable =False
>db.payslip.paye.readable =False
>db.payslip.employee.readable =False
>db.payslip.employee.writable =False
>db.payslip.contract.readable =False
>db.payslip.contract.writable =False
>db.payslip.payslip_name.readable =False
>db.payslip.payslip_name.writable =False
>db.payslip.loan.readable =False
>db.payslip.loan.writable =False
>db.payslip.user.readable =False
>db.payslip.user.writable =False
>form = SQLFORM(db.payslip)
>
>if form.process(onvalidation=check_batch).accepted:
>response.flash=T('Payslip Added')
>return dict(form=form)
>
>
> im getting this error
>
> ValueError: invalid literal for long() with base 10: 'with a contract name'
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/we

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Anthony
Note, you don't have to use SQLFORM.factory -- you can simply use SQLFORM 
and either call form.validate() or form.process(dbio=False) -- both of 
those options do the form validation but do not do any database insert. 
SQLFORM.factory is typically used when you need to create a form that is 
not based on a database model (i.e., when creating a form from scratch or 
when combining more than one model in a single form).

Anthony

On Monday, September 26, 2016 at 5:13:46 PM UTC-4, Oasis Agano wrote:
>
> Well all the answers helped but the sqlform factory solved it
>
> On Monday, September 26, 2016 at 3:29:35 PM UTC+3, Oasis Agano wrote:
>>
>> Greetings
>> im creating a payroll app and i need a to create a batch of payslips
>>
>> i want to create payslips for all contracts in the database within the 
>> running state
>>  the code
>>
>> def check_batch(form):
>>
>> contraaa = db(db.contract.state == 'Running').select(db.contract.ALL)
>> for contraa in contraaa:
>>
>> if contraa.salary_structure == 'Less than 3':
>> totgross=contraa.wage+contraa.allowances
>>
>> form.vars.employee=contraa.employee.fullname
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.contract_name
>>
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> form.vars.paye = 0
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>>
>> form.vars.net = totgross-form.vars.rssb_emp
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = totgross-form.vars.rssb_emp-loanpay
>>
>> elif contraa.salary_structure == 'Between 3 and 10':
>>
>> form.vars.employee=contraa.employee.fullname
>> form.vars.payslip_name=contraa.employee.fullname
>> form.vars.contract=contraa.contract_name
>>
>> totgross=contraa.wage+contraa.allowances
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> varia =totgross-3
>> form.vars.paye = varia*0.2
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = 
>> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>>
>>
>> #form = SQLFORM(db.payslip)
>>
>>
>>
>> elif contraa.salary_structure=='Great than 10':
>>
>> form.vars.employee=contraa.employee
>> form.vars.payslip_name=contraa.employee
>> form.vars.contract=contraa.contract_name
>>
>> totgross=contraa.wage+contraa.allowances
>> form.vars.gross=totgross
>> form.vars.rssb_emp = totgross*0.03
>> form.vars.rssb_comp = totgross*0.05
>> varia2 =totgross-10
>> variah = varia2*0.3
>> varia3 =7*0.2
>> form.vars.paye = variah+varia3
>> totrssb=form.vars.rssb_emp+form.vars.rssb_comp
>> form.vars.rssb_tot=form.vars.rssb_emp+form.vars.rssb_comp
>> if type(form.vars.loan) !=int :
>> form.vars.net = totgross-form.vars.rssb_emp-form.vars.paye
>> else:
>> payy=db(db.loanpayment.id == 
>> form.vars.loan).select(db.loanpayment.ALL)
>> for pay in payy:
>> loanpay=int(pay.amount_payed)
>> form.vars.net = 
>> totgross-form.vars.rssb_emp-form.vars.paye-loanpay
>>
>> #form = SQLFORM(db.payslip)
>>
>> else:
>> response.flash=T('Select a salary structure and contract')
>>
>>
>> def batch_payslip():
>>db.payslip.gross.readonly =True
>>db.payslip.net.readable =False
>>db.payslip.rssb_emp.readable =False
>>#db.payslip.salary_structure.readable =False
>>db.payslip.rssb_comp.readable =False
>>db.payslip.paye.readable =False
>>db.payslip.employee.readable =False
>>db.payslip.employee.writable =False
>>db.payslip.contract.readable =False
>>db.payslip.contract.writable =False
>>db.payslip.payslip_name.readable =False
>>db.payslip.payslip_name.writa

[web2py] Re: Creating a batch using a loop

2016-09-26 Thread Dave S
On Monday, September 26, 2016 at 1:34:00 PM UTC-7, Oasis Agano wrote:
>
> Briefly what im trying to do is to create payslips for all contracts in 
> the db through a loop,
>
 

I don't understand.  Is what is supposed to be done a response to a user?  
Is that user an employee logging the time spent on jobs? Is that user a 
bookkeeper processing data for several employees?

If every contract in the database needs a payslip for every employee, then 
perhaps a scheduled task would be better than an interactive page.  Tasks 
that take a long time have issues if the browser times out, or even if it 
just feels like it is never going to return a response.

On the other hand, if the user is an employee entering the time spent, is 
the task to divide the time up among the contracts the employee is attached 
to?   Does the user have to show how many hours were spent on each contract?

/dps



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


[web2py] Re: Looking for a web2py contractor

2016-09-26 Thread Jeff Lipkowitz
Please send a email for more details

On Friday, 23 September 2016 10:49:52 UTC-5, Jeff Lipkowitz wrote:
>
> I'm looking for a web2py contractor with SOAP experience.  
>
> Please send resumes and work experience examples to 
> j...@redbrickanalytics.com 
>

-- 
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] looking for a web2py contractor with SOAP experience.

2016-09-26 Thread Jeff Lipkowitz
I'm looking for a web2py contractor with SOAP experience.  

Please send resumes and work experience examples to 
j...@redbrickanalytics.com 

-- 
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: looking for a web2py contractor with SOAP experience.

2016-09-26 Thread Dave S


On Monday, September 26, 2016 at 7:38:36 PM UTC-7, Jeff Lipkowitz wrote:
>
> I'm looking for a web2py contractor with SOAP experience.  
>
> Please send resumes and work experience examples to 
> je...@redbrickanalytics.com  
>

I have used Web2py as a Soap service provider (and consumer), so it is 
possible, but I am not a contractor at this time.

I'm going to guess that you are in the US, and that you've already looked 
at the Web2py Consulting thread.

Good luck!

Dave S
/dps
 

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


Re: [web2py] Re: Creating a batch using a loop

2016-09-26 Thread Jim Steil
You don't have to pass it.  Just use the DAL to insert the records you
need.

What fields are you having the user enter data into when the form is
displayed?

You can just use SQLFORM.factory to gather them.  Then in the 'if
form.process().accepted:' put the code to insert the records into the
database.

Tell me what fields you're gathering from the user and I can write up a
sample for you.

-Jim


On Mon, Sep 26, 2016 at 3:33 PM, Oasis Agano  wrote:

> Briefly what im trying to do is to create payslips for all contracts in
> the db through a loop,
> i just checked sqlform factory but i have a question where do i pass the
> form(payslip table) to insert in into after if form.process().accepts:
>
> On Monday, September 26, 2016 at 11:09:52 PM UTC+3, Jim S wrote:
>>
>> I think that is all that it should do.
>>
>> Your check_batch function is being called at the validation stage of
>> processing your form.  All your check_batch function does is reassign
>> values to the form variables that you've captured.  After it is done, the
>> web2py form processing will insert the current values of the form variables
>> into the database for you.  See Anthony's first reply.  I think your
>> approach to this is somewhat flawed.
>>
>> Here is what I see is happening:
>>
>> 1. User makes a request to the batch_payslips function.  Result is that a
>> form is displayed.
>> 2. User enters values into the form and clicks on Submit.
>> 3. Your onvalidation method (check_batch) is invoked.  This method resets
>> a bunch of the form variables, but since it is in a loop, the variables set
>> in the last pass through the loop are retained in the form variables.
>> 4. sqlform.process().accepted takes over and inserts a record into
>> payslips based on the current values of the form variables.
>>
>> From what I think you're trying to do, I'd re-architect a bit.
>>
>> 1. Use a SQFORM.factory to gather whatever information it is your asking
>> of the user.  http://web2py.com/books/default/chapter/29/07/forms-and-
>> validators#SQLFORM-factory
>> 2. Instead of loop through the RUNNING contracts in the onvalidation
>> function (check_batch), put that code after the "if
>> form.process().accepts:" statement.
>> 3. Update that code to manually insert the records into payslips instead
>> of just assigning values to the form variables. http://web2py.com/b
>> ooks/default/chapter/29/06/the-database-abstraction-layer#insert
>>
>> I hope this helps.  My apologies if I'm misunderstanding your goals.
>>
>> -Jim
>>
>>
>> On Monday, September 26, 2016 at 2:48:32 PM UTC-5, Oasis Agano wrote:
>>>
>>> Well its progressing now, using
>>>
>>> form.vars.employee=contraa.employee
>>> form.vars.payslip_name=contraa.employee.fullname
>>> form.vars.contract=contraa.id
>>>
>>>
>>> Now it is inserting only one payslip(from one contract) but not inserting 
>>> the other one
>>>
>>>
>>> On Monday, September 26, 2016 at 7:54:03 PM UTC+3, Jim S wrote:

 You're setting form.vars.employee = contraa.employee.fullname

 It should be set to the employee id, not the name.  Results in the same
 problem as with contract name/id.

 Should just be contraa.employee I believe...

 -Jim

 On Monday, September 26, 2016 at 10:23:15 AM UTC-5, Oasis Agano wrote:
>
> i changed it to form.vars.contract = contraa.id
> but still getting the same error
>
> On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:
>>
>> In your model, db.payslip.contract is a reference field, but in your
>> code, you attempt to assign a string value to it (form.vars.contract =
>> contraa.contract_name).
>>
>> Anthony
>>
>> On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano wrote:
>>>
>>> Models are here, if this way cant work can you suggest another way of 
>>> doing it
>>>
>>> MARITAL_SET = [
>>> T('Single'),
>>> T('Married'),
>>> T('Divorced'),
>>> T('Widower')
>>>
>>>
>>> ]
>>> TIME_SET = [
>>> T('Part time'),
>>> T('Full time'),
>>>
>>>
>>> ]
>>>
>>> STATE_SET = [
>>> T('Trial'),
>>> T('Employed'),
>>> T('Fired'),
>>> T('Retired'),
>>>
>>>
>>> ]
>>> #@auth.requires_login()
>>>
>>> db.define_table('employee',
>>> Field('emp_photo', 'upload',label='Photo'),
>>> Field('first_name','string',label='First Name'),
>>> Field('last_name','string',label='Last Name'),
>>> 
>>> Field('fullname','string',readable='False',compute=lambda r: 
>>> r.first_name+' '+r.last_name),
>>> Field('email','string'),
>>> Field('phone','string'),
>>> Field('marital_status', requires=IS_IN_SET(MARITAL_SET, 
>>> zero=T('--choose marital status--'))),
>>> Field('number_of_children', 'string

[web2py] Is there a plan to put an official image of web2py on Docker?

2016-09-26 Thread JorgeH
It would be a great idea.

To have one with the latest release.

Or what of the current images do you recommend?

https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=web2py&starCount=0


-- 
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: Is there a plan to put an official image of web2py on Docker?

2016-09-26 Thread JorgeH
I meant a repository

On Monday, September 26, 2016 at 10:00:55 PM UTC-5, JorgeH wrote:
>
> It would be a great idea.
>
> To have one with the latest release.
>
> Or what of the current images do you recommend?
>
>
> https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=web2py&starCount=0
>
>
>

-- 
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: Creating a batch using a loop

2016-09-26 Thread Oasis Agano
I solved it already using sqlform factory then if form accepted do the 
loops...
and thanks for your help

On Tuesday, September 27, 2016 at 5:48:14 AM UTC+3, Jim S wrote:
>
> You don't have to pass it.  Just use the DAL to insert the records you 
> need.  
>
> What fields are you having the user enter data into when the form is 
> displayed?
>
> You can just use SQLFORM.factory to gather them.  Then in the 'if 
> form.process().accepted:' put the code to insert the records into the 
> database.
>
> Tell me what fields you're gathering from the user and I can write up a 
> sample for you.
>
> -Jim
>
>
> On Mon, Sep 26, 2016 at 3:33 PM, Oasis Agano  > wrote:
>
>> Briefly what im trying to do is to create payslips for all contracts in 
>> the db through a loop,
>> i just checked sqlform factory but i have a question where do i pass the 
>> form(payslip table) to insert in into after if form.process().accepts:
>>
>> On Monday, September 26, 2016 at 11:09:52 PM UTC+3, Jim S wrote:
>>>
>>> I think that is all that it should do.
>>>
>>> Your check_batch function is being called at the validation stage of 
>>> processing your form.  All your check_batch function does is reassign 
>>> values to the form variables that you've captured.  After it is done, the 
>>> web2py form processing will insert the current values of the form variables 
>>> into the database for you.  See Anthony's first reply.  I think your 
>>> approach to this is somewhat flawed.
>>>
>>> Here is what I see is happening:
>>>
>>> 1. User makes a request to the batch_payslips function.  Result is that 
>>> a form is displayed.  
>>> 2. User enters values into the form and clicks on Submit.
>>> 3. Your onvalidation method (check_batch) is invoked.  This method 
>>> resets a bunch of the form variables, but since it is in a loop, the 
>>> variables set in the last pass through the loop are retained in the form 
>>> variables.
>>> 4. sqlform.process().accepted takes over and inserts a record into 
>>> payslips based on the current values of the form variables.
>>>
>>> From what I think you're trying to do, I'd re-architect a bit.
>>>
>>> 1. Use a SQFORM.factory to gather whatever information it is your asking 
>>> of the user.  
>>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-factory
>>> 2. Instead of loop through the RUNNING contracts in the onvalidation 
>>> function (check_batch), put that code after the "if 
>>> form.process().accepts:" statement.
>>> 3. Update that code to manually insert the records into payslips instead 
>>> of just assigning values to the form variables. 
>>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert
>>>
>>> I hope this helps.  My apologies if I'm misunderstanding your goals.
>>>
>>> -Jim
>>>
>>>
>>> On Monday, September 26, 2016 at 2:48:32 PM UTC-5, Oasis Agano wrote:

 Well its progressing now, using 

 form.vars.employee=contraa.employee
 form.vars.payslip_name=contraa.employee.fullname
 form.vars.contract=contraa.id


 Now it is inserting only one payslip(from one contract) but not inserting 
 the other one


 On Monday, September 26, 2016 at 7:54:03 PM UTC+3, Jim S wrote:
>
> You're setting form.vars.employee = contraa.employee.fullname 
>
> It should be set to the employee id, not the name.  Results in the 
> same problem as with contract name/id.
>
> Should just be contraa.employee I believe...
>
> -Jim
>
> On Monday, September 26, 2016 at 10:23:15 AM UTC-5, Oasis Agano wrote:
>>
>> i changed it to form.vars.contract = contraa.id
>> but still getting the same error
>>
>> On Monday, September 26, 2016 at 5:39:41 PM UTC+3, Anthony wrote:
>>>
>>> In your model, db.payslip.contract is a reference field, but in your 
>>> code, you attempt to assign a string value to it (form.vars.contract = 
>>> contraa.contract_name).
>>>
>>> Anthony
>>>
>>> On Monday, September 26, 2016 at 10:04:30 AM UTC-4, Oasis Agano 
>>> wrote:

 Models are here, if this way cant work can you suggest another way of 
 doing it

 MARITAL_SET = [
 T('Single'),
 T('Married'),
 T('Divorced'),
 T('Widower')


 ]
 TIME_SET = [
 T('Part time'),
 T('Full time'),


 ]

 STATE_SET = [
 T('Trial'),
 T('Employed'),
 T('Fired'),
 T('Retired'),


 ]
 #@auth.requires_login()

 db.define_table('employee',
 Field('emp_photo', 'upload',label='Photo'),
 Field('first_name','string',label='First Name'),
 Field('last_name','string',label='Last Name'),
 
 Field('fullname','str

[web2py] Re: RuntimeError: table appears corrupted

2016-09-26 Thread Maurice Waka
Good morning all.
I came across this post when searching for an answer. I got this error from 
my app::
Traceback

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

Traceback (most recent call last):
  File "C:\Python27\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "C:/Python27/web2py/applications/hestQue/models/db2.py" 
, line 33, in 

auth.signature)
  File "C:\Python27\web2py\gluon\packages\dal\pydal\base.py", line 834, in 
define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "C:\Python27\web2py\gluon\packages\dal\pydal\base.py", line 873, in 
lazy_define_table
polymodel=polymodel)
  File "C:\Python27\web2py\gluon\packages\dal\pydal\adapters\base.py", line 
503, in create_table
raise RuntimeError('File %s appears corrupted' % table._dbt)
RuntimeError: File 
C:\Python27\web2py\applications\hestQue\databases\c8b669d15150d7109e5f7ab36744a5b7_comm.table
 appears corrupted



Any reason why this happened and how I can sort it out??

Kind reagrds


On Saturday, December 29, 2012 at 7:33:11 AM UTC+3, Richard Penman wrote:
>
> I have had an app running for a few months and recently could not connect 
> to (nginx) server. Then after restart got this error:
> RuntimeError: table appears corrupted
>
> If I add migrate=False,fake_migrate=True to DAL then app works. But when 
> remove this error returns. 
> Any idea what is going wrong?
>

-- 
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: How to update multiple records

2016-09-26 Thread 'Annet' via web2py-users
Hi Anthony,

Thanks for your reply. Problem solved.


Best 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.