[web2py] IIS help with permissions

2014-09-23 Thread Tim Richardson
With IIS 8, I am trying to get web2py running with wfastcgi.py v2.1RC2, 
web2py 2.9.11, python 2.7 32 bit
I have welcome running, and I can access admin.
However, when I try to create a new simple application, it fails. It does 
create the folder name structure (e.g. models, controllers folders are 
created) but there is no content in them.
Frustratingly, I can find no error messages logged anywhere, even after I 
activated logging. The request appears to terminate with no error in the 
browser. 

I have actually given the group IIS_IUSRS full permissions and I can see 
that this permission has been inherited by the empty controllers folder, 
for example. 
I think that it is a permission error. When I modify db.py in the the 
welcome app (by adding a comment) and try to save (edited via the admin 
app) I do get an error in the session: "communication error". Meanwhile, 
the file db.py has become empty. 
It is a bit subtle for me. 





-- 
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: Version 2.9.6 indeed breaks backward compat for some users

2014-09-23 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 05-09-2014 17:03, Leonel Câmara wrote:
> I feel like the only clean approach is to have a LIKE and a ILIKE.
> 

Me too.

> The problem is that we don't have any mechanism to make compatibility breaking
> changes.
> 
> I think ideally applications should report what version of web2py or of the 
> DAL
> they were made for (and if they don't, we assume they're older than 2.9.6 or
> something). That way we could have a PostgresPre296Adapter that had the old 
> LIKE
> implementation and we would use that for the older applications.
> 
> I'm all for maintaining backwards compatibility, I think it is absolutely
> indispensable, but we need a sane way to move forward while keeping it.
> 

Perhaps this could be addressed in DAL initialization,,, something like:

db = DAL( ..., case_sensitive_like=True )

with the default value being set to False?
- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iEYEARECAAYFAlQh6kcACgkQ90uzwjA1SJXY+gCgzfBJYbKEEmDp8utT+BpL/CMV
ih4AnRmk91F0lpGZccDOEKHZLWbDruUg
=s0w5
-END PGP SIGNATURE-

-- 
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: Version 2.9.6 indeed breaks backward compat for some users

2014-09-23 Thread Niphlod
sorry for being not that deeply explicit in the previous post.

contains() on list:something is case-insensitive.
If you try to create a table with a TEXT field, then do a *LOWER(textfield) 
LIKE '%whatever%'* on it. 
You'll find out that while lots of functions can be applied to varchar, not 
all of them can be used on text (lower() being one of them).
If you try a simple db(thetable.textfield.lower().like('%whatever%')) the 
same issue arises.
To have consistent resultsets independently on the collation being set on 
the database, the workaround may be identified in doing a 
*LOWER(CONVERT(VARCHAR(MAX), 
textfield)) LIKE '%whatever%'*, but on sql2000, varchar(max) isn't allowed. 
You'll find yourself screwed because you can at most use *VARCHAR(8000)*, 
but doing so textfield will be truncated at 8000 chars.

tl;dr: either you use mssql:// and then convert by hand every "text" field 
into a varchar(max) if you are on >= 2005, or with mssql:// you'll face the 
issue, there's no way around it without falling into limitations (such as, 
on = 2000, changing by hand every text into a varchar(8000), knowing that 
you'll store AT MOST some text 8000 chars long). And let's face it, text is 
"officially" going towards being discontinued. Varchar(max), where 
available, has better performances and no cons.
Given that mssql3:// and mssql4:// are created with the original purpose of 
circumventing another "famous" issue with pagination, and that mssql3:// is 
meant to be used with >= 2005, while mssql4:// with >= 2012, there are 
overrides in place to make every Field(..., 'text') created as a 
varchar(max) by default, that will annihilate the issues with columns being 
"limited" by what the "text" type offers.

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Richard
No hard feelings, the coding was very simple and out of the box, performing 
perfectly until 
But I agree, not a really production proof design.

I already redesigned the functionality using SQLFORM.factory and using an 
existing table for the time-sequences.

On Tuesday, September 23, 2014 9:10:17 PM UTC+2, Niphlod wrote:
>
> sorry for being - probably - overzealous, but you're not trying to create 
> a table with 2 columns with an indefinite number of rows. You're doing the 
> exact opposite: creating a table with an indefinite number of columns. This 
> is confirmed by the fact that the variable in your code is indeed 
> *issue_var_field and the error you're facing (if you care to read mysql 
> manual, you'll find about innodb storage per-row limitations).
> At this point, I strongly suggest to reengineer your code to use a fixed 
> number of columns ^_^'
>
> On Tuesday, September 23, 2014 5:09:56 PM UTC+2, Richard wrote:
>>
>> Leonel,
>>
>> You are right, the most important message you and Niphlod give me is the 
>> bad design of the dynamic tables and the need for migration=True.
>> Is this conclusion correct?
>>
>> If so, I'll redesign the functionality towards a table containing the 
>> time sequences and the relation to a table with the meta data.
>>
>> regards,
>> Richard D
>>
>> On Tuesday, September 23, 2014 4:54:56 PM UTC+2, Leonel Câmara wrote:
>>>
>>>  table per time sequence is needed because I want to have security 
 levels on those table devided in view and edit.
>>>
>>>
>>> Why do you need a new table for that? You can create whatever 
>>> permissions you want, if you need you can create read and update 
>>> permissions per record.
>>>
>>

-- 
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: Version 2.9.6 indeed breaks backward compat for some users

2014-09-23 Thread Derek
I use 'Like' on mssql 2000 pretty much every day, what are you saying? why 
can't it map to varchar?

On Monday, September 22, 2014 3:02:33 PM UTC-7, Niphlod wrote:
>
> Unfortunately, mssql:// is there only for MSSQL 2000 (and others derived 
> from that baseclass). 
>
> It's a known issue...unfortunately there's no operator / function that can 
> turn a 'text' into a something that gets a LIKE applied correctly without 
> the possibility of truncation, not until MSSQL 2005 at least. 
>
> If you're on 2012, use mssql4:// by default.
>
> Related note: I'm pushing a PR to use the same mappings in mssql3:// too 
> that use correct mappings instead of the base ones.
>
> PS: you can then think at a mssql3:// by default if you're at least on 
> 2005 and at mssql4:// if you're at least on a 2012 
>
> On Monday, September 22, 2014 11:45:41 PM UTC+2, Leonel Câmara wrote:
>>
>> The MSSQLAdapter could cast to varchar and avoid the problem.
>>
>

-- 
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: Customize SQLFORM.grid view page and add custom "Back" button

2014-09-23 Thread Kyle Flanagan
For anyone else looking for a similar answer, I solved this by doing the 
following in my controller:

back_button = A(T('Back'), _href=URL('controller', 'function', 
user_signature=True), _class='btn')


Returned this as part of my dict back to my view and then did the following 
at the top of the view for "view" pages:

{{=back_button}}



On Tuesday, September 23, 2014 11:12:14 AM UTC-5, Kyle Flanagan wrote:
>
> I have a controller that creates a grid off of a table -- very basic grid. 
> I test to see if the user is "viewing" an item in the grid (if request.args 
> and request.args[0] == 'view') and if so, I customize the view to present 
> the information in the grid in a different layout.
>
> Now, I'd like to add a back button similar to what you get on the standard 
> view for a grid but without displaying the grid on the 'view' page.
>
> I know how to create the button in the view, but I'm not sure how to 
> create the URL since it's using the signature in the link.
>
> {{=A(T('Back'), _href=URL(), _class='btn')}}
>
>

-- 
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: Default time for datetime picker widget

2014-09-23 Thread Niphlod
Sometimes, in web2py, it's just THAT simple

import datetime
.
Field('whatever', 'time', default=datetime.time(0,0,0))



;-)

On Tuesday, September 23, 2014 10:59:30 AM UTC+2, libe...@gmail.com wrote:
>
> Hi,
>
> I was wondering if there is an easy way to specify a default time (say 
> 00:00)   in place of the current system time in the
> datetime picker widget included in the web2py distribution
>
> Regards
>
> Luca
>

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Niphlod
sorry for being - probably - overzealous, but you're not trying to create a 
table with 2 columns with an indefinite number of rows. You're doing the 
exact opposite: creating a table with an indefinite number of columns. This 
is confirmed by the fact that the variable in your code is indeed 
*issue_var_field and the error you're facing (if you care to read mysql 
manual, you'll find about innodb storage per-row limitations).
At this point, I strongly suggest to reengineer your code to use a fixed 
number of columns ^_^'

On Tuesday, September 23, 2014 5:09:56 PM UTC+2, Richard wrote:
>
> Leonel,
>
> You are right, the most important message you and Niphlod give me is the 
> bad design of the dynamic tables and the need for migration=True.
> Is this conclusion correct?
>
> If so, I'll redesign the functionality towards a table containing the time 
> sequences and the relation to a table with the meta data.
>
> regards,
> Richard D
>
> On Tuesday, September 23, 2014 4:54:56 PM UTC+2, Leonel Câmara wrote:
>>
>>  table per time sequence is needed because I want to have security levels 
>>> on those table devided in view and edit.
>>
>>
>> Why do you need a new table for that? You can create whatever permissions 
>> you want, if you need you can create read and update permissions per record.
>>
>

-- 
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: Response Stream Control

2014-09-23 Thread Leonel Câmara
Even if TCP doesn't fail there could be corruption copying the file to 
disk. Hell a cosmic ray may flip a bit, it can happen. The only way to be 
sure is to verify.

-- 
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] Response Stream Control

2014-09-23 Thread Derek
TCP is not as reliable as you think. A half open connection can leave both 
sides confused, and then you have no way of knowing if your transfer got 
through or not. 
Generally, it does a good job, but when you absolutely need to know if a 
file has transferred successfully or not, you need something better than 
TCP.

On Monday, September 22, 2014 4:36:59 PM UTC-7, Ricardo Pedroso wrote:
>
> On 9/22/14, Aldo Bassanini > wrote: 
> > Hello everyone. 
> > Is there any way to control the final status of the response.stream 
> > function? 
> > 
> > I need to serve a small file to a client application (the client app 
> uses 
> > wget, not a browser), but I wish to know if the client successfully 
> > downloaded the file, in order to update some server-side data. 
> > 
> > The way that I am thinking to achieve this, is programming the client 
> > application (a shell script) to GET a second URL (sending a session-id 
> or 
> > something like that) from the server, after downloading the file, but 
> this 
> > means, that I have to develop some file validation logic to verifiy the 
> > correct downloading (md5suming? or alikes) in the client, that I prefer 
> to 
> > avoid, since the client has a very small environment (OpenWrt's Busybox 
> > Shell) and very small CPU and RAM. 
>
>
> If I understood correctly, you only need to know if the file was 
> successfuly downloaded 
> or not on the server side. 
>
> Don't know if there are better ways in web2py but... 
> ...this code, that goes into a controller, should do the trick: 
>
> import os, sys 
>
> def abort(status_code, message=None): 
> raise HTTP(404, message) 
>
> def index(): 
> filename = request.args(0) or abort(404) 
> fullpath = os.path.join(request.folder, 'uploads', filename) 
>
> def stream(): 
> try: 
> with open(fullpath, 'rb') as f: 
> while True: 
> data = f.read(1024) 
> if not data: 
> break 
> yield data 
> except: 
> # with any error, assume file not fully downloaded 
> print >>sys.stderr, 'failed' 
> else: 
> # if you reach this point the file was successfully 
> # downloaded. Do what you need on the backend side. 
> print >>sys.stderr, 'done' 
>
> headers = {'Content-Type': 'application/octet-stream'} 
> raise HTTP(200, stream(), **headers) 
>
>
> PS: You dont need to do any checksum anywhere. TCP is reliable. 
> It guarantees that everything that is transmitted is error free and 
> ordered. 
>
>
> Ricardo 
>

-- 
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] Customize SQLFORM.grid view page and add custom "Back" button

2014-09-23 Thread Kyle Flanagan
I have a controller that creates a grid off of a table -- very basic grid. 
I test to see if the user is "viewing" an item in the grid (if request.args 
and request.args[0] == 'view') and if so, I customize the view to present 
the information in the grid in a different layout.

Now, I'd like to add a back button similar to what you get on the standard 
view for a grid but without displaying the grid on the 'view' page.

I know how to create the button in the view, but I'm not sure how to create 
the URL since it's using the signature in the link.

{{=A(T('Back'), _href=URL(), _class='btn')}}

-- 
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 meetup with Massimo in north Bay Area

2014-09-23 Thread weheh
Massimo can not commit to a date yet, but his best guess is December 5. 
Pencil it into your calendar please: Friday December 5, 6PM to 9PM. 
Location, Berkeley CA. THIS IS AN ESTIMATE ONLY AND TENTATIVE.

On Monday, September 15, 2014 7:18:48 PM UTC-7, weheh wrote:
>
> Target early December. How much interest? Looking for another speaker. 
>
> Will try to leverage python user's group. Otherwise, I have a nice room on 
> UC Berkeley campus large enough for 20+.
>
> Trying to get a measure of the audience. 1 additional volunteer speaker 
> requested.
>

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Richard
Leonel,

You are right, the most important message you and Niphlod give me is the 
bad design of the dynamic tables and the need for migration=True.
Is this conclusion correct?

If so, I'll redesign the functionality towards a table containing the time 
sequences and the relation to a table with the meta data.

regards,
Richard D

On Tuesday, September 23, 2014 4:54:56 PM UTC+2, Leonel Câmara wrote:
>
>  table per time sequence is needed because I want to have security levels 
>> on those table devided in view and edit.
>
>
> Why do you need a new table for that? You can create whatever permissions 
> you want, if you need you can create read and update permissions per record.
>

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Leonel Câmara

>
>  table per time sequence is needed because I want to have security levels 
> on those table devided in view and edit.


Why do you need a new table for that? You can create whatever permissions 
you want, if you need you can create read and update permissions per record.

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Richard
I have a table which contains the tablenames and table meta-data. This 
table is used for defining the table programmatically.
A table per time sequence is needed because I want to have security levels 
on those table devided in view and edit.

Sorry , but I do not understand your idea for the timesequence table.


On Tuesday, September 23, 2014 2:26:23 PM UTC+2, Leonel Câmara wrote:
>
> I still don't see the need for dynamic tables. Why do timesequences need 
> to be dynamic tables? Where do you store the table definitions for the 
> dynamically created tables?
>
> It's a huge mess to go at it that way. 
>
>
> Couldn't this suffice?
>
> db.define_table('timesequence',
> Field('sort_position', 'integer'),
> Field('parent_id', 'reference timesequence'),
> Field('name'),
> )
>
> This way you have timesequences which may have any number of children 
> timesequences which are ordered.
>
>
>

-- 
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: ordering in dropdown

2014-09-23 Thread libertil
Manuele, Leonel thank you for the answer!

It works as a charm now...

@Leonel 
Strings ids come from specifications that are beyond my control : (.
However I have to admin that they were useful in some cases. 
I did not put the unique in the model even though the contraint is
implemented db side because the pollutant and pollutant_info tables
are assumed to be 'read_only' from the point of view of my webapp.
The tables are lookup tables that come from standard codelists whose
key values are not supposed to change in the future.

Thanks again
Luca

On Tuesday, September 23, 2014 3:39:22 PM UTC+2, Leonel Câmara wrote:
>
> IS_IN_DB actually accepts an orderby kwarg so you can just ask for the 
> order you want.
>
> That said why are you making your own string ids and why are they not 
> unique=True?
>

-- 
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: ordering in dropdown

2014-09-23 Thread Leonel Câmara
IS_IN_DB actually accepts an orderby kwarg so you can just ask for the 
order you want.

That said why are you making your own string ids and why are they not 
unique=True?

-- 
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] ordering in dropdown

2014-09-23 Thread Manuele Pesenti
Il 23/09/14 15:03, liber...@gmail.com ha scritto:
> using a query
> qry=db(db.pollutants.pollutant_id == 
> db.pollutants_info.pollutant_id).select(orderby=db.pollutants_info.pollutant_order)
well I notice that IS_IN_DB validator accepts db|set while you pass a
result of a selection... try this code instead:
qry=db(db.pollutants.pollutant_id ==  db.pollutants_info.pollutant_id)

and look inside the validator code how ordering is supported.

Hope it could be of any help.

Manuele
> db.models.pollutant_fk.requires =
> IS_IN_DB(qry,'pollutants.pollutant_id','%(pollutants.pollutant_label)s')

-- 
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] ordering in dropdown

2014-09-23 Thread libertil
Hi,
 I am trying to implement a data entry form for an entity called Model.
It should have a drop down menu showing entries from linked table pollutans.
So far no problem in implementing it. I want now to reorder the elements in
the dropdown menu using the field pollutant_order' in the pollutants_info 
table.
pollutants_info table has a 1:1 link to the pollutants table and is used to 
store
values that do not belong to the business data model.

I tried modifying the 

db.models.pollutant_fk.requires = 
IS_IN_DB(db,'pollutants.pollutant_id','%(pollutant_label)s')

using a query
qry=db(db.pollutants.pollutant_id ==  
db.pollutants_info.pollutant_id).select(orderby=db.pollutants_info.pollutant_order)

db.models.pollutant_fk.requires = 
IS_IN_DB(qry,'pollutants.pollutant_id','%(pollutants.pollutant_label)s')
but I get an exception

type 'exceptions.AttributeError'> 'Table' object has no attribute 
'pollutants.pollutant_label'
I think there is concept in the DAL that baffles me!



*Model *db.define_table('pollutant', 

   Field('pollutant_id', type='string'),

   Field('pollutant_notation', type='string'),

   Field('pollutant_label', type='string'),

   Field('pollutant_definition', type='string'),

   primarykey=['pollutant_id'],

   format='%(pollutant_definition)s',

   migrate=False)


db.define_table('pollutants_info',

   Field('pollutant_id', type='string'),

   Field('pollutant_order', type='integer'),

   Field('required_a', type='boolean'),

   Field('required_b', type='boolean'),

   primarykey=['pollutant_id'],

   format='%(pollutant_order)s',

   migrate=False)


db.define_table('models',
Field('model_id', type='integer'),
Field('model_code', type='string'),
Field('pollutant_fk','reference pollutants.pollutant_id', represent= 
lambda id, row: db.pollutants(id).pollutant_label if id else ''),
format='%(model_code)s',
primarykey = ['model_id'],
migrate=False)

db.models.pollutant_fk.requires = 
IS_IN_DB(db,'pollutants.pollutant_id','%(pollutant_label)s')

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Leonel Câmara
I still don't see the need for dynamic tables. Why do timesequences need to 
be dynamic tables? Where do you store the table definitions for the 
dynamically created tables?

It's a huge mess to go at it that way. 


Couldn't this suffice?

db.define_table('timesequence',
Field('sort_position', 'integer'),
Field('parent_id', 'reference timesequence'),
Field('name'),
)

This way you have timesequences which may have any number of children 
timesequences which are ordered.


-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Richard
I'll explain, the app we are building is a generic management framework 
which will be used in many different domains because the theory it is based 
on is domain invariant. Part of the functionality is capturing dynamics 
through time sequences. These time sequences are stored in dynamically 
created tables, this works fine. Adding and changing data to these tables 
is the subject of this 139 error.

In short: how to populate a table with 2 columns having an unknown amount 
of rows. 
In very short: grid functionality.

  

On Tuesday, September 23, 2014 1:02:17 PM UTC+2, Leonel Câmara wrote:
>
> I find that creating tables dynamically is almost always not what you want 
> or need. What are you really trying to do feature wise?
>

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Leonel Câmara
I find that creating tables dynamically is almost always not what you want 
or need. What are you really trying to do feature wise?

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Richard
Leonel and Niphlod,

I want to populate a table that is dynamically created have 2 colmuns and 
an unknown but limited amount of rows.
Using SQLform as input was kind of a clever solution, I thought. This is 
apparently not the case. Any suggestion would be welcome.

Richard D



On Tuesday, September 23, 2014 11:03:09 AM UTC+2, Leonel Câmara wrote:
>
> You're probably going over the column limit. This seems stupid. What are 
> you trying to achieve?
>

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Leonel Câmara
You're probably going over the column limit. This seems stupid. What are 
you trying to achieve?

-- 
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] Default time for datetime picker widget

2014-09-23 Thread libertil
Hi,

I was wondering if there is an easy way to specify a default time (say 
00:00)   in place of the current system time in the
datetime picker widget included in the web2py distribution

Regards

Luca

-- 
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: Table creation error 139 using MySql

2014-09-23 Thread Niphlod
ask them, it's an error on mysql side, not web2py's. BTW: creating 
temporary tables at runtime is the dumbest thing since the invention of 
ORMs. 

On Tuesday, September 23, 2014 9:02:25 AM UTC+2, Richard wrote:
>
> I am hosting my app on python anywhere and get sometimes the following 
> error:
>
>  (1005, "Can't create table 
> 'richdijk$imanops03d.form_iv_9cf75329ccbc' (errno: 139)")
> when creating a new table using:
>
> issue_var_fields= [
> Field( 
> "d"+str(db[issue_var_table][date_row.id]['iv_date']).replace("-", 
> ""),
>   issue_var.data_type,
>   default=db[issue_var_table][date_row.id
> ]['iv_value'],
>   label = str(db[issue_var_table][date_row.id
> ]['iv_date'])
>  )
>  for date_row in db(db[issue_var_table]).select()
>  ]
> db.define_table('form_%s'%issue_var_table, *issue_var_fields)
>
> What may be the cause of this when the error occur? Sometimes the table is 
> created without an error.
>

-- 
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] Table creation error 139 using MySql

2014-09-23 Thread Richard
I am hosting my app on python anywhere and get the following error:

 (1005, "Can't create table 
'richdijk$imanops03d.form_iv_9cf75329ccbc' (errno: 139)")
when creating a new table using:

issue_var_fields= [
Field( 
"d"+str(db[issue_var_table][date_row.id]['iv_date']).replace("-", ""),
  issue_var.data_type,
  
default=db[issue_var_table][date_row.id]['iv_value'],
  label = 
str(db[issue_var_table][date_row.id]['iv_date'])
 )
 for date_row in db(db[issue_var_table]).select()
 ]
db.define_table('form_%s'%issue_var_table, *issue_var_fields)

What may be the cause of this?

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