Re: [web2py] Custom information page after registration and hide field

2021-02-02 Thread 'brushek' via web2py-users


wtorek, 2 lutego 2021 o 20:51:16 UTC+1 brushek napisał(a):

> poniedziałek, 1 lutego 2021 o 10:50:51 UTC+1 snide...@gmail.com 
> napisał(a):
>
>>
>> On Sunday, January 31, 2021 at 3:05:09 PM UTC-8 brushek wrote:
>> [...] 
>>
>>> def qrcode():
>>>  response.view = 'qrcode.html' 
>>>  response.flash = 'you clicked on register'
>>>  return dict(message="you clicked on register")
>>>
>>> I have a question about response.view - when I comment this out, I get 
>>> in browser:
>>>
>>> invalid view (default/register.html)
>>>
>>> why view isn't pick based on controller's function name now ?
>>>
>>>
>> What directory is your view in?  What controller is your function in?
>>
>
> hi, the function is in default.py controller in directory 
> welcome/controllers/ and view is next to generic.html file, in 
> welcome/views/ directory.
>

Thank You for Your questions. And sorry for not RTFM :). The view is 
working correctly, after moving it to the default welcome/views/default 
directory. Will try do my best to not bother You with such stupid cases...

Regards
brushek

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6f7a8571-6be2-44a9-89a5-20f19ce9n%40googlegroups.com.


Re: [web2py] Custom information page after registration and hide field

2021-02-02 Thread 'brushek' via web2py-users


poniedziałek, 1 lutego 2021 o 10:50:51 UTC+1 snide...@gmail.com napisał(a):

>
> On Sunday, January 31, 2021 at 3:05:09 PM UTC-8 brushek wrote:
> [...] 
>
>> def qrcode():
>>  response.view = 'qrcode.html' 
>>  response.flash = 'you clicked on register'
>>  return dict(message="you clicked on register")
>>
>> I have a question about response.view - when I comment this out, I get in 
>> browser:
>>
>> invalid view (default/register.html)
>>
>> why view isn't pick based on controller's function name now ?
>>
>>
> What directory is your view in?  What controller is your function in?
>

hi, the function is in default.py controller in directory 
welcome/controllers/ and view is next to generic.html file, in 
welcome/views/ directory.

Regards
brushek


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/225da0f1-37a7-4016-8592-3f26e2ce45a9n%40googlegroups.com.


Re: [web2py] Custom information page after registration and hide field

2021-01-31 Thread 'brushek' via web2py-users


niedziela, 31 stycznia 2021 o 18:02:41 UTC+1 mauri...@gmail.com napisał(a):

> If its about QR codes, these are what I mean't:
> http://www.web2pyslices.com/slice/show/1462/qr-code-builder-with-web2py
> https://github.com/minlaxz/python-qr
> https://github.com/laconic75/QR-Inventory
>

OK, thank You, but I will use this one for this purpose:

https://github.com/christiancoleman/gooQR

and regarding form: It was very long time I wasn't using web2py (but I have 
still systems working on it - very old version... :/), so I didn't go with 
simple solution...:

def register():

response.view = 'register.html' 
form=auth.register()
if form.accepts(request,session):
   response.flash="form accepted"
   redirect(URL('qrcode'))
return dict(form=form)

def qrcode():
 response.view = 'qrcode.html' 
 response.flash = 'you clicked on register'
 return dict(message="you clicked on register")

I have a question about response.view - when I comment this out, I get in 
browser:

invalid view (default/register.html)

why view isn't pick based on controller's function name now ?

Regards
brushek

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5604dd46-dec8-4a6e-9c9f-b03b87ff5b6an%40googlegroups.com.


Re: [web2py] Custom information page after registration and hide field

2021-01-31 Thread 'brushek' via web2py-users
OK, Your suggestion is to search in examples of web2py and github ?

Regards


niedziela, 31 stycznia 2021 o 03:48:08 UTC+1 mauri...@gmail.com napisał(a):

> I thought I must have seen an example of the same from github or Web2py 
> examples.
> Regards 
>
> On Sun, Jan 31, 2021, 02:47 'brushek' via web2py-users <
> web...@googlegroups.com> wrote:
>
>>
>> Hello,
>>
>> I have two problems to solve, I think they are simple, but couldn't find 
>> proper solution in docs.
>>
>> I would like to show qrcode generated by qrcode module which will be used 
>> for Google Authenticator for every user after proper registration. This 
>> qrcode should be generated randomly and inserted into database. I don't 
>> wont (now) to allow edit this field by users in profile and in registration 
>> form.
>> I added this field this way:
>>
>> #Before define tables, we add some extra field to auth_user
>> auth.settings.extra_fields['auth_user'] = [
>> Field('motp_secret', 'password', length=512, default='', label='MOTP 
>> Secret',requires = 
>> IS_STRONG(min=16,max=16,special=0,lower=0,number=3,upper=13)),
>> ]
>>
>> but this way this field is seen by user  in registration form and profile 
>> editing. I would like to generate this secret and insert into database, but 
>> without possibility to edit this by user, and give him (only once) AFTER 
>> registration qrcode to scan with information, that he/she won't be allowed 
>> to login if doesn't scan qrcode and add it Google authenticator.
>>
>> So questions :)
>> 1. How to redirect after proper registration to some page on which will 
>> be custom message with qrcode ?
>> 2. How to add silently this motp_secret field to database during 
>> registration of new user without his interaction/knowing about it
>>
>> Regards
>> brushek
>>
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/a22212bc-d6ef-4e97-907f-d7e2a7ff7b3dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/a22212bc-d6ef-4e97-907f-d7e2a7ff7b3dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/23a3c3e7-8495-4c4b-8108-efd5a9f1ebd1n%40googlegroups.com.


[web2py] Custom information page after registration and hide field

2021-01-30 Thread &#x27;brushek' via web2py-users

Hello,

I have two problems to solve, I think they are simple, but couldn't find 
proper solution in docs.

I would like to show qrcode generated by qrcode module which will be used 
for Google Authenticator for every user after proper registration. This 
qrcode should be generated randomly and inserted into database. I don't 
wont (now) to allow edit this field by users in profile and in registration 
form.
I added this field this way:

#Before define tables, we add some extra field to auth_user
auth.settings.extra_fields['auth_user'] = [
Field('motp_secret', 'password', length=512, default='', label='MOTP 
Secret',requires = 
IS_STRONG(min=16,max=16,special=0,lower=0,number=3,upper=13)),
]

but this way this field is seen by user  in registration form and profile 
editing. I would like to generate this secret and insert into database, but 
without possibility to edit this by user, and give him (only once) AFTER 
registration qrcode to scan with information, that he/she won't be allowed 
to login if doesn't scan qrcode and add it Google authenticator.

So questions :)
1. How to redirect after proper registration to some page on which will be 
custom message with qrcode ?
2. How to add silently this motp_secret field to database during 
registration of new user without his interaction/knowing about it

Regards
brushek


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a22212bc-d6ef-4e97-907f-d7e2a7ff7b3dn%40googlegroups.com.


[web2py] Re: Problem after git pull with sqlrow

2017-05-07 Thread brushek
I found that it looks like for problem in SQLTABLE:
{{
=SQLTABLE(table,_id="gpon_lista",_style="width: 850px; text-align: center; 
align: center;") 
}}

after commenting this line out error didn't show, but of course this not 
proper solution for me...

Please advice, becouse I don't want to mess up in web2py code, and it seems 
to be some web2py issue...

Regards
brk

W dniu niedziela, 7 maja 2017 13:46:04 UTC+2 użytkownik brushek napisał:
>
> Hello,
>
> I have recently did git pull for some old web2py powered project, after 
> that I get:
>
>  'Rows' object has no attribute 'fields' 
> Version 
> web2py™ Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 
> Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr) Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
>
> Traceback (most recent call last):
>   File "/home/brushek/web2py/gluon/restricted.py", line 216, in restricted
> exec(ccode, environment)
>   File "", line 102, in 
>   File "/home/brushek/web2py/gluon/sqlhtml.py", line 3314, in __init__
> fieldmap = dict(zip(sqlrows.colnames, sqlrows.fields))
> AttributeError: 'Rows' object has no attribute 'fields'
>
> Error snapshot [image: help] 
> <https://gpon.betanet.pl/admin/default/ticket/GPON/89.72.161.229.2017-05-07.13-37-09.01336f84-f856-41e6-a7cb-6dd6934f60f9#>
>  
>
> ('Rows' object has no attribute 'fields')
>
>
> This is all code for controller:
>
>
> def listuj():
> (dev,telnet) = gpon.connect_GPON()
> onts_s = gpon.ont_state(telnet)
> table = db(db.gpon_ont._id>0).select()
> return dict(table=table,statusy=onts_s,message='Lista wszystkich ONT w 
> bazie danych')
>
>
> Can You advice what is wrong ?
>
>
> Regards
>
> brk
>

-- 
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] Problem after git pull with sqlrow

2017-05-07 Thread brushek
Hello,

I have recently did git pull for some old web2py powered project, after 
that I get:

 'Rows' object has no attribute 'fields' 
Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 
Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr) Traceback 

1.
2.
3.
4.
5.
6.
7.
8.

Traceback (most recent call last):
  File "/home/brushek/web2py/gluon/restricted.py", line 216, in restricted
exec(ccode, environment)
  File "", line 102, in 
  File "/home/brushek/web2py/gluon/sqlhtml.py", line 3314, in __init__
fieldmap = dict(zip(sqlrows.colnames, sqlrows.fields))
AttributeError: 'Rows' object has no attribute 'fields'

Error snapshot [image: help] 
<https://gpon.betanet.pl/admin/default/ticket/GPON/89.72.161.229.2017-05-07.13-37-09.01336f84-f856-41e6-a7cb-6dd6934f60f9#>
 

('Rows' object has no attribute 'fields')


This is all code for controller:


def listuj():
(dev,telnet) = gpon.connect_GPON()
onts_s = gpon.ont_state(telnet)
table = db(db.gpon_ont._id>0).select()
return dict(table=table,statusy=onts_s,message='Lista wszystkich ONT w 
bazie danych')


Can You advice what is wrong ?


Regards

brk

-- 
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 login_onaccept works ?

2014-02-23 Thread brushek
Yes, I'm sure, but Marin wrote why it was wrong.

Thank both of You for Your time

regards
brushek


W dniu piątek, 21 lutego 2014 16:57:13 UTC+1 użytkownik Massimo Di Pierro 
napisał:
>
> Are you sure? It should only fire once.
>
> On Thursday, 20 February 2014 17:56:13 UTC-6, brushek wrote:
>>
>> Hello web2py users and devs,
>>
>> I have simple question: does auth.settings.login_onaccept should fire 
>> only once after login, or it is normal that it is running in every click 
>> after login ?
>>
>> I have folowing code in default.py:
>>
>> def check_production(towar=1):
>> if not session.auth:
>> return
>> user_id = str(session.auth.user.id)
>> import datetime
>> 
>> db.produkcja.update_or_insert((db.produkcja.id_field == 2) & (db.
>> produkcja.id_user == user_id),end_time = datetime.datetime.now(),id_towaru 
>> = towar)
>>
>> auth.settings.login_onaccept = check_production(1)
>>
>> As I can see, the end_time field is updated in database every time I 
>> click on site (after login). It is correct behavior ? I would like to fire 
>> this function only once, after user login. Is there any other way to achive 
>> one-time run of function after login ?
>>
>>
>> Regards 
>> brushek
>>
>>

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


Re: [web2py] how login_onaccept works ?

2014-02-21 Thread brushek
Thank You Marin, that was the case :)

Regards
brushek

W dniu piątek, 21 lutego 2014 01:22:44 UTC+1 użytkownik Marin Pranjić 
napisał:
>
> you are calling the function and assigning the return value
>
> use = lambda: check_production(1)
> or just = check_production, without (1)
>
> Marin (mobile)
> On Feb 21, 2014 12:56 AM, "brushek" > 
> wrote:
>
>> Hello web2py users and devs,
>>
>> I have simple question: does auth.settings.login_onaccept should fire 
>> only once after login, or it is normal that it is running in every click 
>> after login ?
>>
>> I have folowing code in default.py:
>>
>> def check_production(towar=1):
>> if not session.auth:
>> return
>> user_id = str(session.auth.user.id)
>> import datetime
>> 
>> db.produkcja.update_or_insert((db.produkcja.id_field == 2) & (db.
>> produkcja.id_user == user_id),end_time = datetime.datetime.now(),id_towaru 
>> = towar)
>>
>> auth.settings.login_onaccept = check_production(1)
>>
>> As I can see, the end_time field is updated in database every time I 
>> click on site (after login). It is correct behavior ? I would to fire this 
>> function only once, after user login.
>>
>>
>> Regards 
>> brushek
>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>

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


[web2py] how login_onaccept works ?

2014-02-20 Thread brushek
Hello web2py users and devs,

I have simple question: does auth.settings.login_onaccept should fire only 
once after login, or it is normal that it is running in every click after 
login ?

I have folowing code in default.py:

def check_production(towar=1):
if not session.auth:
return
user_id = str(session.auth.user.id)
import datetime

db.produkcja.update_or_insert((db.produkcja.id_field == 2) & (db.
produkcja.id_user == user_id),end_time = datetime.datetime.now(),id_towaru 
=towar
)

auth.settings.login_onaccept = check_production(1)

As I can see, the end_time field is updated in database every time I click 
on site (after login). It is correct behavior ? I would to fire this 
function only once, after user login.


Regards 
brushek

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


[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-07 Thread brushek
Thank You Massimo, it's enaugh for me - indeed, the code is rather simple.

Regards and good luck :)
brushek

W dniu wtorek, 7 stycznia 2014 09:09:04 UTC+1 użytkownik Massimo Di Pierro 
napisał:
>
> This is the source for SQLFORM.dictform:
>
> def dictform(dictionary, **kwargs):
> fields = []
> for key, value in sorted(dictionary.items()):
> t, requires = SQLFORM.AUTOTYPES.get(type(value), (None, None))
> if t:
> fields.append(Field(key, t, requires=requires,
> default=value))
> return SQLFORM.factory(*fields, **kwargs)
>
> As you can see it is just a SQLFORM.factory except that it makes a guess 
> for field types and requires. If you want to change those defaults, than 
> you do not need this function at all. Perhaps it can be used as an example 
> of how to do what you need to do.
>
>
>
> On Sunday, 5 January 2014 10:48:08 UTC-6, brushek wrote:
>>
>> Thank You Masimo for answer,
>>
>> Hm... so this is huge problem for me, because I have in dict many other 
>> options (I showed only one field to show the problem). Is there any easy 
>> way to append or insert Field (with corect select option generated in the 
>> view) to the form created by SQLFORM.dictform ? Or, to change the 
>> SQLFORM.dictform to SQLFORM.factory, but factory need to take dict with 
>> (many) fields ? I was very happy to see dictform - it perfectly fit into 
>> the config setter/updater for me, last thing I needed is to make select for 
>> some of the fields :(. 
>>
>> Regards
>> brushek
>>
>>
>>
>>
>> W dniu niedziela, 5 stycznia 2014 17:07:09 UTC+1 użytkownik Massimo Di 
>> Pierro napisał:
>>>
>>> Unfortunately dictform does not support this. You can do:
>>>
>>> session.config = dict(NAME = 'a')
>>> form = 
>>> SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'),
>>>  
>>> error_message="Choose between a and e")))
>>>  if form.process().accepted: 
>>> session.config['NAME'] = form.vars['NAME']
>>>
>>>
>>>
>>> On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote:
>>>>
>>>> Hello :)
>>>>
>>>> I have following code in controller:
>>>>
>>>> session.config = dict(NAME = 'a')
>>>> form = SQLFORM.dictform(session.config)
>>>> form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), 
>>>> error_message="Choose between a and e")
>>>>  if form.process().accepted: 
>>>> session.config.update(form.vars)
>>>>
>>>> validator is working OK, but I would like to change the type of NAME 
>>>> field in form to select dropdown, instead simple input. How to do this ? 
>>>> How to change the type of field after it is created by any SQLFORM(.*)  ?
>>>>
>>>> Regards
>>>> brushek
>>>>
>>>

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


[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread brushek
Thank You Masimo for answer,

Hm... so this is huge problem for me, because I have in dict many other 
options (I showed only one field to show the problem). Is there any easy 
way to append or insert Field (with corect select option generated in the 
view) to the form created by SQLFORM.dictform ? Or, to change the 
SQLFORM.dictform to SQLFORM.factory, but factory need to take dict with 
(many) fields ? I was very happy to see dictform - it perfectly fit into 
the config setter/updater for me, last thing I needed is to make select for 
some of the fields :(. 

Regards
brushek




W dniu niedziela, 5 stycznia 2014 17:07:09 UTC+1 użytkownik Massimo Di 
Pierro napisał:
>
> Unfortunately dictform does not support this. You can do:
>
> session.config = dict(NAME = 'a')
> form = 
> SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'),
>  
> error_message="Choose between a and e")))
>  if form.process().accepted: 
> session.config['NAME'] = form.vars['NAME']
>
>
>
> On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote:
>>
>> Hello :)
>>
>> I have following code in controller:
>>
>> session.config = dict(NAME = 'a')
>> form = SQLFORM.dictform(session.config)
>> form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), 
>> error_message="Choose between a and e")
>>  if form.process().accepted: 
>> session.config.update(form.vars)
>>
>> validator is working OK, but I would like to change the type of NAME 
>> field in form to select dropdown, instead simple input. How to do this ? 
>> How to change the type of field after it is created by any SQLFORM(.*)  ?
>>
>> Regards
>> brushek
>>
>

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


[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread brushek
Hi, 

I'm still searching, and I found in the web2py book something like this in 
widget section:

The "options" widget is used when a field's requires is IS_IN_SET or 
IS_IN_DB with multiple=False (default behavior).


I assumed, that if I change the 'requires' of field (after 
SQLFORM.dictform, see bellow), than the widget will change automatically, 
but it seems not working that way. What I should also change to get select 
in view (now it is still [probably default] input  field) ?


W dniu sobota, 4 stycznia 2014 18:26:10 UTC+1 użytkownik brushek napisał:
>
> Hello :)
>
> I have following code in controller:
>
> session.config = dict(NAME = 'a')
> form = SQLFORM.dictform(session.config)
> form.custom.widget.NAME <http://form.custom.widget.name/>['requires'] 
> =IS_IN_SET
> (('a','b','c','d','e'), error_message="Choose between a and e")
>
>
>  if form.process().accepted: 
> session.config.update(form.vars)
>
>
>
> validator is working OK, but I would like to change the type of NAME field 
> in form to select dropdown, instead simple input. How to do this ? How to 
> change the type of field after it is created by any SQLFORM(.*)  ?
>
> Regards
> brushek
>

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


[web2py] IS_IN_SET in SQLFORM.dictform

2014-01-04 Thread brushek
Hello :)

I have following code in controller:

session.config = dict(NAME = 'a')
form = SQLFORM.dictform(session.config)
form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), 
error_message="Choose between a and e")
 if form.process().accepted: 
session.config.update(form.vars)

validator is working OK, but I would like to change the type of NAME field 
in form to select dropdown, instead simple input. How to do this ? How to 
change the type of field after it is created in any SQLFORM.* type ?

Regards
brushek

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


[web2py] changing validator of one field based on choice of another field

2013-03-02 Thread brushek
Hello,

I have a form (generated by FORM) in which I want to change validator if 
user checks diffrent radio button, it is somothing like this (pseudocode):

input field is named deg_or_rad

if radio1 checked:
 then deg_or_rad is checked against range (-4:4)
if radio2 checked:
 then de_or_rad is checked against range (-360:360)

Can I do this without using javascript ?

regards
brushek


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Problem with legacy tables

2012-01-27 Thread brushek
And yes, as always Massimo :), it is working now, thank You for
response :).

Taken from trunk:
Version 1.99.4 (2012-01-26 12:53:05) stable

regards
brushek

On 26 Sty, 19:54, Massimo Di Pierro 
wrote:
> Yes. This will be resolved. We are working on it. In fact it may be
> solved already. Please help us test trunk.
>
> On Jan 26, 11:00 am,brushek wrote:
>
>
>
>
>
>
>
> > Yes indeed. But the quistion is, if this will be solved some day ? I
> > can stick with old version for a while, but some day I will have to/
> > need to upgrade. The best of web2py was for me that it is backward
> > compatible.
>
> > On 26 Sty, 11:51, Alan Etkin  wrote:
>
> > > In this issue:http://code.google.com/p/web2py/issues/detail?id=634
>
> > > I am trying to solve a (supposedly) similar problem, when using
> > > SQLFORM with tables wich have custom id field names. Maybe there could
> > > be used a common workaround to solve both problems. Anyway, the custom
> > > id problem reproduces only in the new non-stable version.
>
> > > On 25 ene, 18:25, Omi Chiba  wrote:
>
> > > > Sound like it's related to the issue I posted 
> > > > before.http://code.google.com/p/web2py/issues/detail?id=547
>
> > > > The bottom line is you cannot use SQLFORM.grid/SQLTABLE if you don't
> > > > have "id" field.I have also legacy table which doesn't have field
> > > > called "id". I gave using SQLFORM.grid and create the list with
> > > > . If you're looking for paging, you can use the
> > > > following plugin which I use.
>
> > > >http://dev.s-cubism.com/plugin_paginator
>
> > > > On Jan 25, 8:51 am,brushek wrote:
>
> > > > > I'm using vim, editing files directly on server.
>
> > > > > On 25 Sty, 15:47, Marin Pranjić  wrote:
>
> > > > > > What do you use for development? If you use an IDE with debugging
> > > > > > step-by-step featues, you can find out where does "id" come from
>
> > > > > > On Wed, Jan 25, 2012 at 3:35 PM,brushek wrote:
>
> > > > > > > On 25 Sty, 15:17, Anthony  wrote:
> > > > > > > > I left the following comment with the issue:
>
> > > > > > > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id
> > > > > > > ,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
>
> > > > > > > > Note, your refer to db.gk_shop.id, but there is no "id" field 
> > > > > > > > in that
> > > > > > > table. The name of the id field is actually db.gk_shop.id_modulo 
> > > > > > > (the field
> > > > > > > _type_ is "id", but the field _name_ is "id_modulo"). In your 
> > > > > > > code, you
> > > > > > > have to refer to the field name.
>
> > > > > > > > Anthony
>
> > > > > > > OK, I changed the controller:
>
> > > > > > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_
> > > > > > >  modulu],user_signature=False,deletable=False)
>
> > > > > > > and it isn't the case, the error still remain:
>
> > > > > > > Traceback (most recent call last):
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/restricted.py", line 
> > > > > > > 204,
> > > > > > > in restricted
> > > > > > >    exec ccode in environment
> > > > > > >  File "/home/users/brushek/web2py-dev/applications/sdadmin/
> > > > > > > controllers/default.py", line 138, in 
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/globals.py", line 
> > > > > > > 172, in
> > > > > > > 
> > > > > > >    self._caller = lambda f: f()
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/tools.py", line 2551, 
> > > > > > > in
> > > > > > > f
> > > > > > >    return action(*a, **b)
> > > > > > >  File "/home/users/brushek/web2py-dev/applications/sdadmin/
> > > > > > > controllers/default.py", line 16, in shop
>
> > > > > > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_
> > > > > > >  modulu],user_signature=False,deletable=False)
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 
> > > > > > > 1587,
> > > > > > > in grid
> > > > > > >    _class='web2py_form',
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1960, 
> > > > > > > in
> > > > > > > process
> > > > > > >    self.validate(**kwargs)
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1907, 
> > > > > > > in
> > > > > > > validate
> > > > > > >    if self.accepts(**kwargs):
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 
> > > > > > > 1042,
> > > > > > > in accepts
> > > > > > >    formname_id = '.'.join(str(self.record[k])
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5317, in
> > > > > > > __getattr__
> > > > > > >    'firebird': FireBirdAdapter,
> > > > > > >  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5308, in
> > > > > > > __getitem__
> > > > > > >    'postgres': PostgreSQLAdapter,
> > > > > > > KeyError: 'id'


[web2py] Re: Problem with legacy tables

2012-01-26 Thread brushek
Yes indeed. But the quistion is, if this will be solved some day ? I
can stick with old version for a while, but some day I will have to/
need to upgrade. The best of web2py was for me that it is backward
compatible.

On 26 Sty, 11:51, Alan Etkin  wrote:
> In this issue:http://code.google.com/p/web2py/issues/detail?id=634
>
> I am trying to solve a (supposedly) similar problem, when using
> SQLFORM with tables wich have custom id field names. Maybe there could
> be used a common workaround to solve both problems. Anyway, the custom
> id problem reproduces only in the new non-stable version.
>
> On 25 ene, 18:25, Omi Chiba  wrote:
>
>
>
>
>
>
>
> > Sound like it's related to the issue I posted 
> > before.http://code.google.com/p/web2py/issues/detail?id=547
>
> > The bottom line is you cannot use SQLFORM.grid/SQLTABLE if you don't
> > have "id" field.I have also legacy table which doesn't have field
> > called "id". I gave using SQLFORM.grid and create the list with
> > . If you're looking for paging, you can use the
> > following plugin which I use.
>
> >http://dev.s-cubism.com/plugin_paginator
>
> > On Jan 25, 8:51 am, brushek  wrote:
>
> > > I'm using vim, editing files directly on server.
>
> > > On 25 Sty, 15:47, Marin Pranjić  wrote:
>
> > > > What do you use for development? If you use an IDE with debugging
> > > > step-by-step featues, you can find out where does "id" come from
>
> > > > On Wed, Jan 25, 2012 at 3:35 PM, brushek  wrote:
>
> > > > > On 25 Sty, 15:17, Anthony  wrote:
> > > > > > I left the following comment with the issue:
>
> > > > > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id
> > > > > ,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
>
> > > > > > Note, your refer to db.gk_shop.id, but there is no "id" field in 
> > > > > > that
> > > > > table. The name of the id field is actually db.gk_shop.id_modulo (the 
> > > > > field
> > > > > _type_ is "id", but the field _name_ is "id_modulo"). In your code, 
> > > > > you
> > > > > have to refer to the field name.
>
> > > > > > Anthony
>
> > > > > OK, I changed the controller:
>
> > > > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_
> > > > >  modulu],user_signature=False,deletable=False)
>
> > > > > and it isn't the case, the error still remain:
>
> > > > > Traceback (most recent call last):
> > > > >  File "/home/users/brushek/web2py-dev/gluon/restricted.py", line 204,
> > > > > in restricted
> > > > >    exec ccode in environment
> > > > >  File "/home/users/brushek/web2py-dev/applications/sdadmin/
> > > > > controllers/default.py", line 138, in 
> > > > >  File "/home/users/brushek/web2py-dev/gluon/globals.py", line 172, in
> > > > > 
> > > > >    self._caller = lambda f: f()
> > > > >  File "/home/users/brushek/web2py-dev/gluon/tools.py", line 2551, in
> > > > > f
> > > > >    return action(*a, **b)
> > > > >  File "/home/users/brushek/web2py-dev/applications/sdadmin/
> > > > > controllers/default.py", line 16, in shop
>
> > > > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_
> > > > >  modulu],user_signature=False,deletable=False)
> > > > >  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 1587,
> > > > > in grid
> > > > >    _class='web2py_form',
> > > > >  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1960, in
> > > > > process
> > > > >    self.validate(**kwargs)
> > > > >  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1907, in
> > > > > validate
> > > > >    if self.accepts(**kwargs):
> > > > >  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 1042,
> > > > > in accepts
> > > > >    formname_id = '.'.join(str(self.record[k])
> > > > >  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5317, in
> > > > > __getattr__
> > > > >    'firebird': FireBirdAdapter,
> > > > >  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5308, in
> > > > > __getitem__
> > > > >    'postgres': PostgreSQLAdapter,
> > > > > KeyError: 'id'


[web2py] Re: Problem with legacy tables

2012-01-25 Thread brushek
I'm using vim, editing files directly on server.

On 25 Sty, 15:47, Marin Pranjić  wrote:
> What do you use for development? If you use an IDE with debugging
> step-by-step featues, you can find out where does "id" come from
>
>
>
>
>
>
>
> On Wed, Jan 25, 2012 at 3:35 PM, brushek  wrote:
>
> > On 25 Sty, 15:17, Anthony  wrote:
> > > I left the following comment with the issue:
>
> > > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id
> > ,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
>
> > > Note, your refer to db.gk_shop.id, but there is no "id" field in that
> > table. The name of the id field is actually db.gk_shop.id_modulo (the field
> > _type_ is "id", but the field _name_ is "id_modulo"). In your code, you
> > have to refer to the field name.
>
> > > Anthony
>
> > OK, I changed the controller:
>
> > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
>
> > and it isn't the case, the error still remain:
>
> > Traceback (most recent call last):
> >  File "/home/users/brushek/web2py-dev/gluon/restricted.py", line 204,
> > in restricted
> >    exec ccode in environment
> >  File "/home/users/brushek/web2py-dev/applications/sdadmin/
> > controllers/default.py", line 138, in 
> >  File "/home/users/brushek/web2py-dev/gluon/globals.py", line 172, in
> > 
> >    self._caller = lambda f: f()
> >  File "/home/users/brushek/web2py-dev/gluon/tools.py", line 2551, in
> > f
> >    return action(*a, **b)
> >  File "/home/users/brushek/web2py-dev/applications/sdadmin/
> > controllers/default.py", line 16, in shop
>
> > shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
> >  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 1587,
> > in grid
> >    _class='web2py_form',
> >  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1960, in
> > process
> >    self.validate(**kwargs)
> >  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1907, in
> > validate
> >    if self.accepts(**kwargs):
> >  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 1042,
> > in accepts
> >    formname_id = '.'.join(str(self.record[k])
> >  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5317, in
> > __getattr__
> >    'firebird': FireBirdAdapter,
> >  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5308, in
> > __getitem__
> >    'postgres': PostgreSQLAdapter,
> > KeyError: 'id'


[web2py] Re: Problem with legacy tables

2012-01-25 Thread brushek


On 25 Sty, 15:17, Anthony  wrote:
> I left the following comment with the issue:
>
> shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
>
> Note, your refer to db.gk_shop.id, but there is no "id" field in that table. 
> The name of the id field is actually db.gk_shop.id_modulo (the field _type_ 
> is "id", but the field _name_ is "id_modulo"). In your code, you have to 
> refer to the field name.
>
> Anthony
>

OK, I changed the controller:

shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)

and it isn't the case, the error still remain:

Traceback (most recent call last):
  File "/home/users/brushek/web2py-dev/gluon/restricted.py", line 204,
in restricted
exec ccode in environment
  File "/home/users/brushek/web2py-dev/applications/sdadmin/
controllers/default.py", line 138, in 
  File "/home/users/brushek/web2py-dev/gluon/globals.py", line 172, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py-dev/gluon/tools.py", line 2551, in
f
return action(*a, **b)
  File "/home/users/brushek/web2py-dev/applications/sdadmin/
controllers/default.py", line 16, in shop
 
shop=SQLFORM.grid(db.gk_shop,fields=[db.gk_shop.id_modulu,db.gk_shop.nazwa_modulu],user_signature=False,deletable=False)
  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 1587,
in grid
_class='web2py_form',
  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1960, in
process
self.validate(**kwargs)
  File "/home/users/brushek/web2py-dev/gluon/html.py", line 1907, in
validate
if self.accepts(**kwargs):
  File "/home/users/brushek/web2py-dev/gluon/sqlhtml.py", line 1042,
in accepts
formname_id = '.'.join(str(self.record[k])
  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5317, in
__getattr__
'firebird': FireBirdAdapter,
  File "/home/users/brushek/web2py-dev/gluon/dal.py", line 5308, in
__getitem__
'postgres': PostgreSQLAdapter,
KeyError: 'id'


[web2py] Problem with legacy tables

2012-01-25 Thread brushek
Hello,

Because I need to have legacy tables in one of my project, I would
like to please You to see what could be wrong in my model/controller:

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

Massimo reflects if it is bug or not. Could You help ?

regards
brushek


[web2py] Re: SQLFORM.grid custom labels in edit form for each row

2011-12-17 Thread brushek
> The bug isn't with LABEL, it's with SQLFORM.search_menu, which tries to
> translate field.label without first converting to a string in case the
> label is an HTML helper.
>
> Should be an easy fix, but for now, you can do:
>
> label=str(IMG(...))
>
> or
>
> label=IMG(...).xml()

None of this soulutions works :(. I mean, the app doesn't crash, but I
can see the text:



in label of row, but no image, it isn't that what I want.

I tried:
Field('tw1','integer',label=str(IMG(_alt='Woda',_src=URL('static','img_towary/
1.png',
and:
Field('tw1','integer',label=IMG(_alt='Woda',_src=URL('static','img_towary/
1.png')).xml()),


>
> either of which will convert the HTML helper to a string, so it won't cause
> an error with the translator.
>

Indeed, but as You can see above, the output isn't image.

> Also, note that you shouldn't need the LABEL wrapper -- in SQLFORMs, the
> labels are automatically wrapped in a LABEL().
>

I need LABEL to make label with text AND image, and it works in:

/app/default/planetysurowce/edit/gk_planety/1

but not in:

/app/default/planetysurowce

where grid is computed.

Anyway, thanks Anthony, I think (as You said) it will be quick fix,
and all the stuff will work :)

regards
brushek


[web2py] Re: SQLFORM.grid custom labels in edit form for each row

2011-12-17 Thread brushek
But...

LABEL have some bug:

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



On 16 Gru, 23:32, Anthony  wrote:
> In your table definition, you can specify a 'label' argument for each
> field, and I think that can be whatever you want (e.g., an IMG tag, etc.).
>
> db.define_table('mytable', Field('myfield',
> label=IMG(_src=URL('static','img/myimage.png'
>
> Haven't tried it, but hopefully should work.
>
> Anthony
>
>
>
>
>
>
>
> On Friday, December 16, 2011 5:10:53 PM UTC-5, brushek wrote:
>
> > Hello,
>
> > I would like to have images instead of text (or text AND image) in
> > each label for row, when I click edit in form generated by
> > SQLFORM.grid. How to do this in easiest way ?
>
> > Regards
> > brushek


[web2py] Re: SQLFORM.grid custom labels in edit form for each row

2011-12-16 Thread brushek
Thank You, Anthony. It was... so easy!!! I was looking for some very
strange and wierd solutions, big + for You :).

regards
brushek

On 16 Gru, 23:32, Anthony  wrote:
> In your table definition, you can specify a 'label' argument for each
> field, and I think that can be whatever you want (e.g., an IMG tag, etc.).
>
> db.define_table('mytable', Field('myfield',
> label=IMG(_src=URL('static','img/myimage.png'
>
> Haven't tried it, but hopefully should work.
>
> Anthony
>
>
>
>
>
>
>
> On Friday, December 16, 2011 5:10:53 PM UTC-5, brushek wrote:
>
> > Hello,
>
> > I would like to have images instead of text (or text AND image) in
> > each label for row, when I click edit in form generated by
> > SQLFORM.grid. How to do this in easiest way ?
>
> > Regards
> > brushek


[web2py] SQLFORM.grid custom labels in edit form for each row

2011-12-16 Thread brushek
Hello,

I would like to have images instead of text (or text AND image) in
each label for row, when I click edit in form generated by
SQLFORM.grid. How to do this in easiest way ?

Regards
brushek


[web2py] grid edit custom label for fields

2011-12-16 Thread brushek
Hello web2py users ;),

I'm using SQLFORM.grid to create form. I wuold like to change labels
in edit form from fields name to (for example) images. How to this ?

regards

brushek


[web2py] Re: BlockUI with web2py

2011-11-03 Thread brushek
Yes, I think I do that, thanks anyway :).

On 3 Lis, 16:40, Anthony  wrote:
> Is the other stuff inside your queue callback running (e.g., the
> show("blind"))? The whole thing is fairly complicated and a bit hard to
> follow just by reading the code. Maybe try simplifying and build up from
> something more basic.
>
>
>
>
>
>
>
> On Thursday, November 3, 2011 11:11:03 AM UTC-4, brushek wrote:
>
> > without load and without akcje.load i can see the blocking message,
> > but there is no unblock
>
> > if request.vars.a == 'restart':
> >         form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip',
> >             requires=IS_IN_SET(ipvps))),
> >               TR('',INPUT(_type='submit'),
> > formstyle='ul'),_id='staty')
> >         if form.accepts(request,session):
> >             import time
> >             time.sleep(2)
> >             response.flash = 'restart form accepted'
> >             rest=str(iphostserv[request.vars.ip]) + "veid" +
> > str(vids[request.vars.ip])
>
> > and view:
> > {{if request.vars.a == 'restart':}}
> > Restart action
>
> > {{=form}}
> > {{=rest}}
>
> > but then browser isn't unblocked. The javascript is working, because I
> > get it from previus version of panel written in php.
>
> > On 3 Lis, 15:46, Anthony  wrote:
> > > Nothing jumps out. Doesn't look like a web2py issue, though. I think
> > you'll
> > > just have to debug your JS code. Are you sure it's getting to the
> > $.blockUI
> > > call (i.e., it's not returning in the preceding if clause)?
>
> > > On Thursday, November 3, 2011 9:54:30 AM UTC-4, brushek wrote:
>
> > > > I have following javascript function:
>
> > > > (function($) {
> > > >   $.fn.pytacz = function(options) {
> > > >     var opts = $.extend({}, $.fn.pytacz.defaults, options);
> > > >     var details = $('.details');
>
> > > >     opts.message_txt = opts.message_txt.replace('[msg]',
> > > > opts.tekst_czekania);
>
> > > >     return this.submit(function(e) {
> > > >       e.preventDefault();
>
> > > >       if(opts.pytac && !confirm(opts.pytanie) ) {
> > > >         return false;
> > > >       }
> > > >       $.blockUI({ message: opts.message_txt});
> > > >       //setTimeout($.unblockUI, 4000);
> > > >       //$.unblockUI();
>
> > > >       $.post($(this).attr('action'), $(this).serialize(),
> > > > function(data) {
> > > >         details.html(data).queue(function () {
> > > >           $.unblockUI();
> > > >           $(this).show("blind");
> > > >           $(this).dequeue();
> > > >         });
> > > >         $('a:last', details).click(function() {
> > > >           details.hide("fold");
> > > >         });
> > > >       });
> > > >     });
> > > >   }
> > > >   $.fn.pytacz.defaults = {
> > > >     pytanie: 'Zrestartować ?',
> > > >     tekst_czekania: "Proszę czekać ...",
> > > >     pytac: true,
> > > >     message_txt: '[msg]'
> > > >   }
> > > > })(jQuery);
>
> > > > And this function is applied to id 'staty' (which is id of form):
>
> > > > $(document).ready(function(){
>
> > > > $(".details").hide();
> > > > $(".details").fadeIn("slow");
>
> > > >   $('#staty').pytacz({ pytanie: 'Czy zrestartować ?', tekst_czekania:
> > > > 'Proszę czekać. Restart w toku ...' });
>
> > > > });
>
> > > > On 3 Lis, 01:18, Anthony  wrote:
> > > > > Looks like the component will only load if request.vars.a='restart'
> > --
> > > > is
> > > > > the main page visited with '?a=restart' in the URL? Where/how are
> > you
> > > > > invoking BlockUI?
>
> > > > > On Wednesday, November 2, 2011 5:16:42 AM UTC-4, brushek wrote:
>
> > > > > > here is controller (sleep is for emulating long lasting action):
>
> > > > > > def akcje():
> > > > > > [...]
> > > > > >     if request.vars.a == 'restart':
> > > &g

[web2py] Re: BlockUI with web2py

2011-11-03 Thread brushek
without load and without akcje.load i can see the blocking message,
but there is no unblock

if request.vars.a == 'restart':
form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip',
requires=IS_IN_SET(ipvps))),
  TR('',INPUT(_type='submit'),
formstyle='ul'),_id='staty')
if form.accepts(request,session):
import time
time.sleep(2)
response.flash = 'restart form accepted'
rest=str(iphostserv[request.vars.ip]) + "veid" +
str(vids[request.vars.ip])

and view:
{{if request.vars.a == 'restart':}}
Restart action

{{=form}}
{{=rest}}

but then browser isn't unblocked. The javascript is working, because I
get it from previus version of panel written in php.


On 3 Lis, 15:46, Anthony  wrote:
> Nothing jumps out. Doesn't look like a web2py issue, though. I think you'll
> just have to debug your JS code. Are you sure it's getting to the $.blockUI
> call (i.e., it's not returning in the preceding if clause)?
>
>
>
>
>
>
>
> On Thursday, November 3, 2011 9:54:30 AM UTC-4, brushek wrote:
>
> > I have following javascript function:
>
> > (function($) {
> >   $.fn.pytacz = function(options) {
> >     var opts = $.extend({}, $.fn.pytacz.defaults, options);
> >     var details = $('.details');
>
> >     opts.message_txt = opts.message_txt.replace('[msg]',
> > opts.tekst_czekania);
>
> >     return this.submit(function(e) {
> >       e.preventDefault();
>
> >       if(opts.pytac && !confirm(opts.pytanie) ) {
> >         return false;
> >       }
> >       $.blockUI({ message: opts.message_txt});
> >       //setTimeout($.unblockUI, 4000);
> >       //$.unblockUI();
>
> >       $.post($(this).attr('action'), $(this).serialize(),
> > function(data) {
> >         details.html(data).queue(function () {
> >           $.unblockUI();
> >           $(this).show("blind");
> >           $(this).dequeue();
> >         });
> >         $('a:last', details).click(function() {
> >           details.hide("fold");
> >         });
> >       });
> >     });
> >   }
> >   $.fn.pytacz.defaults = {
> >     pytanie: 'Zrestartować ?',
> >     tekst_czekania: "Proszę czekać ...",
> >     pytac: true,
> >     message_txt: '[msg]'
> >   }
> > })(jQuery);
>
> > And this function is applied to id 'staty' (which is id of form):
>
> > $(document).ready(function(){
>
> > $(".details").hide();
> > $(".details").fadeIn("slow");
>
> >   $('#staty').pytacz({ pytanie: 'Czy zrestartować ?', tekst_czekania:
> > 'Proszę czekać. Restart w toku ...' });
>
> > });
>
> > On 3 Lis, 01:18, Anthony  wrote:
> > > Looks like the component will only load if request.vars.a='restart' --
> > is
> > > the main page visited with '?a=restart' in the URL? Where/how are you
> > > invoking BlockUI?
>
> > > On Wednesday, November 2, 2011 5:16:42 AM UTC-4, brushek wrote:
>
> > > > here is controller (sleep is for emulating long lasting action):
>
> > > > def akcje():
> > > > [...]
> > > >     if request.vars.a == 'restart':
> > > >         form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip',
> > > >             requires=IS_IN_SET(ipvps))),
> > > >               TR('',INPUT(_type='submit'),
> > > > formstyle='ul'),_id='staty')
> > > >         if form.accepts(request,session):
> > > >             import time
> > > >             time.sleep(5)
> > > >             response.flash = 'restart form accepted'
> > > >             rest=str(iphostserv[request.vars.ip]) + "veid" +
> > > > str(vids[request.vars.ip])
> > > >         elif form.errors:
> > > >             response.flash = 'form has errors'
> > > >         else:
> > > >             response.flash = 'please fill the form'
>
> > > > and akcje.load:
>
> > > > {{left_sidebar_enabled=right_sidebar_enabled=False}}
> > > > {{#extend 'layout.html'}}
>
> > > > {{#if 'message' in globals():}}
>
> > > > {{if request.vars.a == 'restart':}}
> &

[web2py] Re: BlockUI with web2py

2011-11-03 Thread brushek
I have following javascript function:

(function($) {
  $.fn.pytacz = function(options) {
var opts = $.extend({}, $.fn.pytacz.defaults, options);
var details = $('.details');

opts.message_txt = opts.message_txt.replace('[msg]',
opts.tekst_czekania);

return this.submit(function(e) {
  e.preventDefault();

  if(opts.pytac && !confirm(opts.pytanie) ) {
return false;
  }
  $.blockUI({ message: opts.message_txt});
  //setTimeout($.unblockUI, 4000);
  //$.unblockUI();

  $.post($(this).attr('action'), $(this).serialize(),
function(data) {
details.html(data).queue(function () {
  $.unblockUI();
  $(this).show("blind");
  $(this).dequeue();
});
$('a:last', details).click(function() {
  details.hide("fold");
});
  });
});
  }
  $.fn.pytacz.defaults = {
pytanie: 'Zrestartować ?',
tekst_czekania: "Proszę czekać ...",
pytac: true,
message_txt: '[msg]'
  }
})(jQuery);

And this function is applied to id 'staty' (which is id of form):

$(document).ready(function(){

$(".details").hide();
$(".details").fadeIn("slow");


  $('#staty').pytacz({ pytanie: 'Czy zrestartować ?', tekst_czekania:
'Proszę czekać. Restart w toku ...' });

});

On 3 Lis, 01:18, Anthony  wrote:
> Looks like the component will only load if request.vars.a='restart' -- is
> the main page visited with '?a=restart' in the URL? Where/how are you
> invoking BlockUI?
>
>
>
>
>
>
>
> On Wednesday, November 2, 2011 5:16:42 AM UTC-4, brushek wrote:
>
> > here is controller (sleep is for emulating long lasting action):
>
> > def akcje():
> > [...]
> >     if request.vars.a == 'restart':
> >         form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip',
> >             requires=IS_IN_SET(ipvps))),
> >               TR('',INPUT(_type='submit'),
> > formstyle='ul'),_id='staty')
> >         if form.accepts(request,session):
> >             import time
> >             time.sleep(5)
> >             response.flash = 'restart form accepted'
> >             rest=str(iphostserv[request.vars.ip]) + "veid" +
> > str(vids[request.vars.ip])
> >         elif form.errors:
> >             response.flash = 'form has errors'
> >         else:
> >             response.flash = 'please fill the form'
>
> > and akcje.load:
>
> > {{left_sidebar_enabled=right_sidebar_enabled=False}}
> > {{#extend 'layout.html'}}
>
> > {{#if 'message' in globals():}}
>
> > {{if request.vars.a == 'restart':}}
> > {{=form}}
> > {{=rest}}
>
> > and akcje.html:
>
> > {{left_sidebar_enabled=right_sidebar_enabled=False}}
> > {{extend 'layout.html'}}
>
> > {{#if 'message' in globals():}}
>
> > Akcje
> > 
> > {{if request.vars.a == 'restart':}}
> > Restart action
>
> > {{=LOAD('default','akcje.load',vars={'a':'restart'},content='Poczekaj...',ajax=True)}}
>
> > On 2 Lis, 02:41, Anthony  wrote:
> > > Can you show some code?
>
> > > On Tuesday, November 1, 2011 6:47:13 PM UTC-4, brushek wrote:
>
> > > > Ok, thanks for answer. I would like to use this plugin with LOAD
> > > > helper. How can I connect LOAD with blockUI ? When I use load, then I
> > > > can't make blockUI working (I want to ask user before send the
> > > > validated form wheter do the action (by javascript confirm()) and make
> > > > him waiting with blocked browser with 'Operation in progress...' text
> > > > for a while (by blockUI).
>
> > > > On 1 Lis, 13:39, Anthony  wrote:
> > > > > blockUI is just a client-side jQuery plugin, so just follow the
> > usual
> > > > > instructions:http://jquery.malsup.com/block/. I don't think there's
> > > > > anything special about using it with web2py.
>
> > > > > On Tuesday, November 1, 2011 8:34:42 AM UTC-4, brushek wrote:
>
> > > > > > Hello,
>
> > > > > > I would like to use jquery blockUI with web2py for long time
> > action.
> > > > > > Can You give me some example/advice, how to do this with web2py
> > using
> > > > > > web2py's ajax or jQuery in the best-fashion manner ?
>
> > > > > > regards
> > > > > > brushek


[web2py] Re: BlockUI with web2py

2011-11-02 Thread brushek
Hello,

>     if request.vars.a == 'restart':
>         form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip',
>             requires=IS_IN_SET(ipvps))),
>               TR('',INPUT(_type='submit'),
> formstyle='ul'),_id='staty')
>         if form.accepts(request,session):

I think, that here should be response.js (or something with
javascript) with some statemant, but I can't find good one. Can You
help ?

>             import time
>             time.sleep(5)
>             response.flash = 'restart form accepted'
>             rest=str(iphostserv[request.vars.ip]) + "veid" +
> str(vids[request.vars.ip])
>         elif form.errors:
>             response.flash = 'form has errors'
>         else:
>             response.flash = 'please fill the form'
>


[web2py] Re: BlockUI with web2py

2011-11-02 Thread brushek
here is controller (sleep is for emulating long lasting action):

def akcje():
[...]
if request.vars.a == 'restart':
form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip',
requires=IS_IN_SET(ipvps))),
  TR('',INPUT(_type='submit'),
formstyle='ul'),_id='staty')
if form.accepts(request,session):
import time
time.sleep(5)
response.flash = 'restart form accepted'
rest=str(iphostserv[request.vars.ip]) + "veid" +
str(vids[request.vars.ip])
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'

and akcje.load:

{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{#extend 'layout.html'}}

{{#if 'message' in globals():}}

{{if request.vars.a == 'restart':}}
{{=form}}
{{=rest}}

and akcje.html:

{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{extend 'layout.html'}}

{{#if 'message' in globals():}}

Akcje

{{if request.vars.a == 'restart':}}
Restart action

{{=LOAD('default','akcje.load',vars={'a':'restart'},content='Poczekaj...',ajax=True)}}


On 2 Lis, 02:41, Anthony  wrote:
> Can you show some code?
>
>
>
>
>
>
>
> On Tuesday, November 1, 2011 6:47:13 PM UTC-4, brushek wrote:
>
> > Ok, thanks for answer. I would like to use this plugin with LOAD
> > helper. How can I connect LOAD with blockUI ? When I use load, then I
> > can't make blockUI working (I want to ask user before send the
> > validated form wheter do the action (by javascript confirm()) and make
> > him waiting with blocked browser with 'Operation in progress...' text
> > for a while (by blockUI).
>
> > On 1 Lis, 13:39, Anthony  wrote:
> > > blockUI is just a client-side jQuery plugin, so just follow the usual
> > > instructions:http://jquery.malsup.com/block/. I don't think there's
> > > anything special about using it with web2py.
>
> > > On Tuesday, November 1, 2011 8:34:42 AM UTC-4, brushek wrote:
>
> > > > Hello,
>
> > > > I would like to use jquery blockUI with web2py for long time action.
> > > > Can You give me some example/advice, how to do this with web2py using
> > > > web2py's ajax or jQuery in the best-fashion manner ?
>
> > > > regards
> > > > brushek


[web2py] Re: BlockUI with web2py

2011-11-01 Thread brushek
Ok, thanks for answer. I would like to use this plugin with LOAD
helper. How can I connect LOAD with blockUI ? When I use load, then I
can't make blockUI working (I want to ask user before send the
validated form wheter do the action (by javascript confirm()) and make
him waiting with blocked browser with 'Operation in progress...' text
for a while (by blockUI).

On 1 Lis, 13:39, Anthony  wrote:
> blockUI is just a client-side jQuery plugin, so just follow the usual
> instructions:http://jquery.malsup.com/block/. I don't think there's
> anything special about using it with web2py.
>
>
>
>
>
>
>
> On Tuesday, November 1, 2011 8:34:42 AM UTC-4, brushek wrote:
>
> > Hello,
>
> > I would like to use jquery blockUI with web2py for long time action.
> > Can You give me some example/advice, how to do this with web2py using
> > web2py's ajax or jQuery in the best-fashion manner ?
>
> > regards
> > brushek


[web2py] BlockUI with web2py

2011-11-01 Thread brushek
Hello,

I would like to use jquery blockUI with web2py for long time action.
Can You give me some example/advice, how to do this with web2py using
web2py's ajax or jQuery in the best-fashion manner ?

regards
brushek


[web2py] Re: @auth.requires_login problem

2011-10-21 Thread brushek
And now is all ok, thank You, Massimo.

On 21 Paź, 16:03, Massimo Di Pierro 
wrote:
> typo in last commit. fixed now in trunk
>
> On Oct 21, 5:16 am, brushek  wrote:
>
>
>
>
>
>
>
> > On 21 Paź, 04:33, Massimo Di Pierro 
> > wrote:
>
> > > This is not fixed in trunk. Please check it.
>
> > I don't know if You realy want to write is 'not fixed', but.. yes,
> > this not fixed, but error is diffrent right now.
> > Version of web2py:
>
> > Version 1.99.3 (2011-10-20 22:43:34) dev
>
> > Traceback (most recent call last):
> >   File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
> > restricted
> >     exec ccode in environment
> >   File "/home/users/brushek/web2py/applications/test/controllers/
> > default.py", line 72, in 
> >   File "/home/users/brushek/web2py/gluon/globals.py", line 149, in
> > 
> >     self._caller = lambda f: f()
> >   File "/home/users/brushek/web2py/applications/test/controllers/
> > default.py", line 34, in user
> >     return dict(form=auth())
> >   File "/home/users/brushek/web2py/gluon/tools.py", line 1130, in
> > __call__
> >     return getattr(self,args[0])()
> >   File "/home/users/brushek/web2py/gluon/tools.py", line 1648, in
> > login
> >     user = self.db(table_user[username] ==
> > form.vars[username]).select().first()
> >   File "/home/users/brushek/web2py/gluon/dal.py", line 5777, in select
> >     return self.db._adapter.select(self.query,fields,attributes)
> >   File "/home/users/brushek/web2py/gluon/dal.py", line 1264, in select
> >     sql = self._select(query, fields, attributes)
> >   File "/home/users/brushek/web2py/gluon/dal.py", line 1651, in
> > _select
> >     sql = super(SQLiteAdapter, self)._select(query, fields,
> > attributes)
> >   File "/home/users/brushek/web2py/gluon/dal.py", line 1178, in
> > _select
> >     if self.can_select_with_update is False and for_update is True:
> > AttributeError: 'SQLiteAdapter' object has no attribute
> > 'can_select_with_update'


[web2py] Re: @auth.requires_login problem

2011-10-21 Thread brushek


On 21 Paź, 04:33, Massimo Di Pierro 
wrote:
> This is not fixed in trunk. Please check it.

I don't know if You realy want to write is 'not fixed', but.. yes,
this not fixed, but error is diffrent right now.
Version of web2py:

Version 1.99.3 (2011-10-20 22:43:34) dev

Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/test/controllers/
default.py", line 72, in 
  File "/home/users/brushek/web2py/gluon/globals.py", line 149, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py/applications/test/controllers/
default.py", line 34, in user
return dict(form=auth())
  File "/home/users/brushek/web2py/gluon/tools.py", line 1130, in
__call__
return getattr(self,args[0])()
  File "/home/users/brushek/web2py/gluon/tools.py", line 1648, in
login
user = self.db(table_user[username] ==
form.vars[username]).select().first()
  File "/home/users/brushek/web2py/gluon/dal.py", line 5777, in select
return self.db._adapter.select(self.query,fields,attributes)
  File "/home/users/brushek/web2py/gluon/dal.py", line 1264, in select
sql = self._select(query, fields, attributes)
  File "/home/users/brushek/web2py/gluon/dal.py", line 1651, in
_select
sql = super(SQLiteAdapter, self)._select(query, fields,
attributes)
  File "/home/users/brushek/web2py/gluon/dal.py", line 1178, in
_select
if self.can_select_with_update is False and for_update is True:
AttributeError: 'SQLiteAdapter' object has no attribute
'can_select_with_update'


[web2py] @auth.requires_login problem

2011-10-20 Thread brushek
Hello,

I craated test app, in default.py added above index (and no other
changes in project):

@auth.requires_login()
def index():
...

After logging in, and going to index I get folowing error:


Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/test/controllers/
default.py", line 72, in 
  File "/home/users/brushek/web2py/gluon/globals.py", line 149, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py/gluon/tools.py", line 2465, in f
if condition and callable(condition):
UnboundLocalError: local variable 'condition' referenced before
assignment

Version of web2py:
$ cat VERSION
Version 1.99.3 (2011-10-19 08:46:51) dev

How to solve this problem ?

regards,
 brushek




[web2py] Re: grid usage

2011-10-19 Thread brushek
> the problem is that the controller is reloaded when you click on grid
> command as edit or new page but the variable "a" is no more posted to
> the page... why not to use different controllers?? it's surely the
> easiest way

Well, it depends. I don't like to have many files for views, and
diffrent
controllers will need to have diffrent files for views. But I can pass
args, and that
is fine to me.

regards
brushek



[web2py] Re: grid usage

2011-10-19 Thread brushek


On 19 Paź, 16:38, Martín Mulone  wrote:
> at the moment you can't pass vars to grid, instead use args.
>

OK, understand, thank You.

regards
brushek


[web2py] grid usage

2011-10-19 Thread brushek
Hello,

I want to use SQLFORM.grid in one controller like this:

def klienci():
if request.vars.a == 'adresacje':
grid=SQLFORM.grid(db.adresacje,user_signature=False)
elif request.vars.a == 'serwery' or 'serwery' in request.args:
grid=SQLFORM.grid(db.serwery,user_signature=False)
elif request.vars.a == 'klienci':
grid=SQLFORM.grid(db.klienci,user_signature=False)
return dict(grid=grid)

Form is showing, but when I click on edit (or enything else action) I
get following error:

Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/staty/controllers/
default.py", line 135, in 
  File "/home/users/brushek/web2py/gluon/globals.py", line 149, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py/applications/staty/controllers/
default.py", line 92, in klienci
return dict(grid=grid)
UnboundLocalError: local variable 'grid' referenced before assignment


How to use grid with vars ? Do I need to make diffrent controllers/
views to use grid ?

regards
brushek


[web2py] Re: Problem with SQLFORM.grid

2011-09-05 Thread brushek
Can anybody help ? or grid and smartgrid shouldn't be used with custom
fields ?

Regards
brushek

On 5 Wrz, 16:22, brushek  wrote:
> On 5 Wrz, 15:55, Johann Spies  wrote:
>
> > Hallo Brushek,
>
> > I am also trying out SQLFORM.grid/smartgrid and learn as I go.
>
> > @auth.requires_login()> def dodajserwer():
> > >    response.flash = T('Serwery')
> > >    form=SQLFORM.grid(db.serwery)
>
> > Apparently the usage is either SQLFORM.smartgrid(table) or
> > SQLFORM.grid(query)
>
> > Try   'form = SQLFORM.smartgrid(db.serwery)'
>
> I tried this one before posting...
>
>
>
> > or    'form = SQLFRORM.grid(db(db.serwery.id > 0))'
>
> ... and this one doesn't change the situtaion, the error is the same.
>
> regards
> Brushek


[web2py] Re: Problem with SQLFORM.grid

2011-09-05 Thread brushek


On 5 Wrz, 15:55, Johann Spies  wrote:
> Hallo Brushek,
>
> I am also trying out SQLFORM.grid/smartgrid and learn as I go.
>
> @auth.requires_login()> def dodajserwer():
> >    response.flash = T('Serwery')
> >    form=SQLFORM.grid(db.serwery)
>
> Apparently the usage is either SQLFORM.smartgrid(table) or
> SQLFORM.grid(query)
>
> Try   'form = SQLFORM.smartgrid(db.serwery)'

I tried this one before posting...

>
> or    'form = SQLFRORM.grid(db(db.serwery.id > 0))'
>

... and this one doesn't change the situtaion, the error is the same.

regards
Brushek


[web2py] Problem with SQLFORM.grid

2011-09-05 Thread brushek
Hello,

I have following table with custom type (database: postgres):
from gluon.sql import SQLCustomType
inet = SQLCustomType ( type='string', native='inet', encoder=lambda x:
repr(str(x)))
db.define_table("serwery",
Field("id_klienci",db.klienci),
Field("ip_serwera",type=inet,requires = IS_IPV4()))

When I try to use SQLFORM.grid, like this:

@auth.requires_login()
def dodajserwer():
response.flash = T('Serwery')
form=SQLFORM.grid(db.serwery)

if form.accepts(request.vars, session):
response.flash='Serwer dodany'
elif form.errors:
response.flash = 'popraw'

return dict(form=form)

I get following error:
Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 194, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/welcome/controllers/
default.py", line 138, in 
  File "/home/users/brushek/web2py/gluon/globals.py", line 145, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py/gluon/tools.py", line 2510, in f
return action(*a, **b)
  File "/home/users/brushek/web2py/applications/welcome/controllers/
default.py", line 60, in dodajserwer
form=SQLFORM.grid(db.serwery)
  File "/home/users/brushek/web2py/gluon/sqlhtml.py", line 1430, in
grid
T = current.T
TypeError: reduce() of empty sequence with no initial value

Where can be problem ?

regards
brushek


[web2py] Re: Bug or future ?

2011-08-31 Thread brushek
And that's clear to me right now, Thank You :) !

Regards,
brushek

On 31 Sie, 02:22, Anthony  wrote:
> On Tuesday, August 30, 2011 6:42:20 PM UTC-4, brushek wrote:
>
> > On 31 Sie, 00:03, Bruno Rocha  wrote:
> > > as far as I know, this line "db.dog.owner.requires=IS_IN_DB(db, '
> > person.id')"
> > > is responsible for the dropdown widget.
>
> > > It is a validator, but using it implies the use of widget.
>
> > > if you do not use the IS_IN_DB(..) you will have no widget, then will be
> > > only a text box field to input the id.
>
> > Hm... So You suggests, that if I remove the line
> > db.dog.owner.requires=IS_IN_DB(db, 'person.id') I should get
> > in form generated by SQLFORM text box ? If so, then something is
> > wrong, because I get the select box with numbers (id's from person
> > table).
>
> Because db.dog.owner is a reference field, it automatically gets the
> following validator by default:
>
> db.dog.owner.requires=IS_IN_DB(db, 'person.id', db.person._format)
>
> So, by default, it uses db.person._format (which in this case is
> '%(name)s'), which displays the names instead of the ids. However, you have
> overridden the default validator with your own IS_IN_DB, but you did not
> specify a format. If you don't specify a format in IS_IN_DB, it defaults to
> '%(id)s', which is why you see ids instead of names.
>
> Anthony


[web2py] Re: Bug or future ?

2011-08-30 Thread brushek


On 31 Sie, 00:03, Bruno Rocha  wrote:
> as far as I know, this line "db.dog.owner.requires=IS_IN_DB(db, 'person.id')"
> is responsible for the dropdown widget.
>
> It is a validator, but using it implies the use of widget.
>
> if you do not use the IS_IN_DB(..) you will have no widget, then will be
> only a text box field to input the id.
>

Hm... So You suggests, that if I remove the line
db.dog.owner.requires=IS_IN_DB(db, 'person.id') I should get
in form generated by SQLFORM text box ? If so, then something is
wrong, because I get the select box with numbers (id's from person
table).

Regards
brushek


[web2py] Bug or future ?

2011-08-30 Thread brushek
Hello,

I have tested format argument in define_table:

db.define_table('person', Field('name'), format='%(name)s')

db.define_table('dog',Field('name'),Field('image','upload'),Field('owner',db.person))
db.dog.owner.requires=IS_IN_DB(db, 'person.id')

If I comment out last line, the form=SQLFORM(db.dog, record=None,
deletable=False) will show name in select box (where owner will show),
but without comment there is only id (number).

Is it ok ?

regards
brushek


[web2py] Greenplum support in web2py

2011-08-24 Thread brushek
Hello,

I'm trying to use greenplum database with web2py. It is modified
postgresql to support big data storage, it uses many postgresql's
tools. I created test apllication, and tables are created, but if I
try to register, I get following error:

Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/testgp/controllers/
default.py", line 71, in 
  File "/home/users/brushek/web2py/gluon/globals.py", line 145, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py/applications/testgp/controllers/
default.py", line 33, in user
return dict(form=auth())
  File "/home/users/brushek/web2py/gluon/tools.py", line 1080, in
__call__
    return getattr(self,args[0])()
  File "/home/users/brushek/web2py/gluon/tools.py", line 1778, in
register
onvalidation=onvalidation,hideerror=self.settings.hideerror):
  File "/home/users/brushek/web2py/gluon/sqlhtml.py", line 1223, in
accepts
self.vars.id = self.table.insert(**fields)
  File "/home/users/brushek/web2py/gluon/dal.py", line 4786, in insert
    return self._db._adapter.insert(self,self._listify(fields))
  File "/home/users/brushek/web2py/gluon/dal.py", line 848, in insert
id = self.lastrowid(table)
  File "/home/users/brushek/web2py/gluon/dal.py", line 1768, in
lastrowid
self.execute("select currval('%s')" % table._sequence_name)
  File "/home/users/brushek/web2py/gluon/dal.py", line 1262, in
execute
return self.log_execute(*a, **b)
  File "/home/users/brushek/web2py/gluon/dal.py", line 1257, in
log_execute
ret = self.cursor.execute(*a,**b)
NotSupportedError: currval() not supported

Does anybody tryied to use greenplum with web2py ?

Regards
brushek


[web2py] Re: Deploying with default web2py server?

2011-06-02 Thread brushek
I can add for myself, that under nginx + uwsgi web2py is twice time
faster than Rocket (no offence :) ), look:


nginx:

httperf --hog --server web2py.server.tld (changed) --port 8443 --num-
conns=1000 --num-calls=1
[...]

Request rate: 1258.2 req/s (0.8 ms/req)
[...]

Rocket (standard web2py instalation):

httperf --hog --server web2py.server.tld (changed)  --port 8000 --num-
conns=1000 --num-calls=1
[...]
Request rate: 671.2 req/s (1.5 ms/req)
[...]

I'm using pld linux, but very usefull is file setup-web2py-nginx-uwsgi-
ubuntu.sh in scripts/ in
web2py_src.zip, the name of file is self-explanatory. :)


On 2 Cze, 11:42, cjrh  wrote:
> On May 30, 10:50 pm, "Sebastian E. Ovide" 
> wrote:
>
> > For this reason it is best to deploy web2py behind
> > Apache78
> >  , Lighttpd85  or
> > Cherokee86
>
> I just set up a site using nginx; so far, very impressed.  Perhaps I
> should add a short howto in the book?


[web2py] Re: Error after upgrade to 1.96.1

2011-06-02 Thread brushek
Thank You Masimo, I posted twice, becaouse I didn't see the first
post. So ignore it.

On 2 Cze, 14:19, Massimo Di Pierro  wrote:
> This line:
>
> (T('Index'),URL('index').xml()==URL().xml(),URL('index'),[])
>
> should be
>
> (T('Index'),URL('index')==URL(),URL('index'),[])
>
> This is because this code was generated by the wizard and the wizard
> is still experimental. This worked with only an early version of the
> wizard. The new wizard does not do this any more.
>
> Massimo
>
> On Jun 2, 3:21 am, brushek  wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I get following error after upgrade to 1.96.1:
>
> > Wersja
>
> > web2py™       Version 1.96.1 (2011-06-01 19:20:34)
> > Python  Python 2.7.1: /usr/bin/python
> > Traceback
>
> > Traceback (most recent call last):
> >   File "/home/users/brushek/web2py/gluon/restricted.py", line 184, in
> > restricted
> >     exec ccode in environment
> >   File "/home/users/brushek/web2py/applications/panel_vps2/models/
> > menu.py", line 8, in 
> >     (T('Index'),URL('index').xml()==URL().xml(),URL('index'),[]),
> > AttributeError: 'str' object has no attribute 'xml'
>
> > I didn't change the code, only upgrade to 1.96.1.
>
> > Regards
> > brushek


[web2py] Problem after upgrade to 1.96.1

2011-06-02 Thread brushek
Hello,

I have following error:

Traceback (most recent call last):
  File "/home/services/nginx/web2py/gluon/restricted.py", line 184, in
restricted
exec ccode in environment
  File "/home/services/nginx/web2py/applications/panel_vps2/models/
menu.py", line 8, in 
(T('Index'),URL('index').xml()==URL().xml(),URL('index'),[]),
AttributeError: 'str' object has no attribute 'xml'

response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%s <%s>' % (settings.author,
settings.author_email)
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response.menu = [
(T('Index'),URL('index').xml()==URL().xml(),URL('index'),[]),

Can You give me some advice, what is wrong ?

Regards
brushek


[web2py] Error after upgrade to 1.96.1

2011-06-02 Thread brushek
Hello,

I get following error after upgrade to 1.96.1:

Wersja

web2py™ Version 1.96.1 (2011-06-01 19:20:34)
Python  Python 2.7.1: /usr/bin/python
Traceback

Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 184, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/panel_vps2/models/
menu.py", line 8, in 
(T('Index'),URL('index').xml()==URL().xml(),URL('index'),[]),
AttributeError: 'str' object has no attribute 'xml'

I didn't change the code, only upgrade to 1.96.1.

Regards
brushek