[web2py] Re: left join (Attribute Error)

2018-02-11 Thread 'Annet' via web2py-users
Hi,

I think it should be:

left=db.requestlist.on(db.procedures.id == db.requestlist.proceduresid)


Regards,

Annet

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


[web2py] left join (Attribute Error)

2018-02-11 Thread F.C.
I am trying to create a left join query and must be something stupidly 
wrong as it doesn't work

Any suggestions? Thanks for any help!

db.define_table('procedures',
Field('id',writable=False, readable=False, label='ID'),
Field('procedurenumber', unique=True, label='Procedure 
Number'),
Field('procedurename', unique=True, label='Procedure Name'),
Field('proceduredesc', label='Procedure Description'),
Field('procdomain',label='ITGC Domain'))


db.define_table('requestlist',
Field('id',writable=False, readable=False, label='ID'),
Field('requestdesc', label='Request'),
Field('phaseid', 'reference phase', format = '%(pname)s', 
label='Phase'),
Field('proceduresid', 'reference procedures', format = 
'%(procedurename)s', label='Procedure Name'),
Field('reqrequestdate', 'date', label='Request Date', 
widget=SQLFORM.widgets.date.widget),
Field('reqduedate', 'date', label='Due Date'),
Field('reqdaysoutstanding', label='Days Outstanding', 
writable=False),
Field('reqdateexpected', 'datetime', label='Date Expected'),
Field('reqdatedelivered', 'datetime', label='Date 
Delivered'),
Field('reqstatus', label='Status'),
Field('assignedto', 'reference poc', format='%(pocname)s', 
label='Assigned To'),
Field('reqevidenceloc', label='Evidence Location'),
Field('reqrequestorid', 'reference poc', 
format='%(pocname)s', label='Requestor'))

def pbc():
records = db().select(db.requestlist.ALL, db.procedures.ALL, 
left=db.procedures.on(db.procedures.id == db.requestlist.proceduresid))
return dict(records=records)

-- 
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: code written by Massimo Di Pierro in the web2py video tutorial

2018-02-11 Thread pbreit
I think some of the code may be at Github:
https://github.com/mdipierro/web2py-appliances
https://github.com/mdipierro/web2py-recipes-source/tree/master/apps

-- 
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] Error in IS_DATE / IS_DATETIME validator?

2018-02-11 Thread Alfonso Serra
This one took me a while to figure it out:

im declaring a model as:
date_format = "%Y-%m-%d"

db.define_table("bookings"
, Field("start_date", "datetime")
, Field("end_date", "date", requires = IS_DATE(format=date_format))
, Field("agency", "reference agencies", format="{agency}")
, Field("name", "string", length=10)
, Field("people", "integer", default=0)
, Field("rooms", "integer", default=0)
, Field("price", "double", default=0.0)
)
def TextWidget(field, value):
return INPUT(_value = value, requires=field.requires, _name=field.name, 
_class="form-control input-sm")

db.bookings.name.widget = TextWidget
db.bookings.end_date.widget = TextWidget

And a text widget to output the fields:

On my view i get the right iso representation but when i submit the form i 
get this error:


My browser locale was set Spanish (es-ES). 

The IS_DATE validator outputs the declared date format but tries to 
validate with a translated one which is really weird way to process a form. 
Also the translation of Year to "Año" is not something python would 
recognize.

At the default es.py we can find:


Which is contributing to this error.

So the IS_DATE is doing something different to what was been told which is 
to use the specified format regardless the accepted language. 
The validators should not be translating anything unless they are told to. 
It would be more versatile to pass the translated format to the validator 
instead of doing this behind the scenes. Something like 
IS_DATE(format=T(my_date_format))

validators.py, line 2235 IS_DATE
 def __init__(self, format='%Y-%m-%d',
 error_message='Enter date as %(format)s'):
self.format = translate(format)

For now ill modify the validators not to translate, but without patching 
this, either you have to delete the related Spanish entries or maybe set 
them the same as the English ones.

Thanks
Best Regards.




-- 
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] PYTHON 3

2018-02-11 Thread Carlos Cesar Caballero Díaz



PS: For the love of all that's holy,  please don't name it web3py.

:)


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

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-02-11 Thread 'jim kaubisch' via web2py-users
Thank you, Massimo !!

Is there any reason that one could not have 2 versions of web2py on disk at 
the same time? 
The reason for wanting that is that is conservatism
   - Having thousands of lines of code developed under 2.14.6 and migrating 
them to 2.16.1
 if something doesn't work under the new version, being able to go back 
to the old might be useful to identify issues

What is the reason for the "ImportError: cannot import name InDBMigrator" 
error. Same error whether separately downloading source or using the 
builtin web2py "update" option 

Thanks

On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>
> Hi,
>
> I needed to directed my attention away from my web2py project a few months 
> ago but am now trying to get back into it. 
> A wise Step 1 would seem to be to update from 2.14.6 to the current 
> version (2.16.1 I assume).
>
> First tried from source but got 
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 21, in 
>
> import gluon.widget
>
>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>
> from .dal import DAL, Field
>
>   File “./Development/web2py/gluon/dal.py", line 17, in 
>
> from pydal.migrator import Migrator, InDBMigrator
>
> ImportError: cannot import name InDBMigrator
>
>
> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
> problem?
>
>
> so I downloaded the mac "mac_osx.zip" to try that but - 
>
> after unzipping, when I try to run the resulting web2py/web2py.app I just 
> get a pop up saying "web2py error". 
>
> When I look at the file info for the web2py.app file it says Version 
> 2.4.7, dated 29 May, 2013
>
>
> What am I doing wrong? 
>
> The app file info certainly doesn't look encouraging. 
>
> I assume having 2 versions of web2py in separate sub-trees shouldn't be a 
> problem
>
>
> Thanks,
>
> Jim
>
>
>

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