[web2py] web2py for (R)OLAP (pivoting)?

2019-11-27 Thread Jurgis Pralgauskis
Hi, 

OLAP Cube  model is based on dimensions (what to group by) and metrics 
(what to aggregate). 
Dimensions are mostly categorical data -- so can be nearly any fields 
(mostly FK).

Metrics would be aggregations of number fields. -- But [how] could they be 
described (incorporated into data model)?
Does pydal support aggregate expressions (that would be grouped by  
dimensions chosen in form)?

-- 
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/76bb8d25-1310-403b-ad15-26ce200f9bb2%40googlegroups.com.


[web2py] SQLAlchemy Core vs PyDAL?

2019-05-08 Thread Jurgis Pralgauskis
Hi, 

What are main differences between two of those?

their ideology seems similar -- no ORM , but pyDAL seems less verbose
https://docs.sqlalchemy.org/en/13/core/tutorial.html#define-and-create-tables

it also has similar concept for selected results (Store):
https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.ResultProxy

curious, could pyDAL be based on Alchemy Core (Expression language) --  it 
already supports may sql-engines?

-- 
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/52e5b45d-dba7-4f0c-9e69-d748a61b95f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] pyDAL "adapter" for Pandas syntax (phylosophical)

2019-04-04 Thread Jurgis Pralgauskis
I found my idea implementation for Django :)
https://github.com/coady/django-model-values

On Sun, May 6, 2018 at 6:14 AM Massimo Di Pierro 
wrote:

> I would very muck have a db().select_as_pandas() that avoids parsing
> the database response a puts the tuples representing the rows directly in
> DB. If nobody beats me on the time, I may get it done next week.
>
> Massimo
>
> On Friday, 4 May 2018 08:26:35 UTC-5, Richard wrote:
>>
>> By include in pandas I mean add support to pydal in pandas so you can do
>> something like :
>>
>> df = pd.DataFrame.from_pydal(db(...).select(...))
>>
>> Richard
>>
>> On Fri, May 4, 2018 at 1:10 AM, Jurgis Pralgauskis <
>> jurgis.pralgaus...@gmail.com> wrote:
>>
>>> I'd like not to include sth into Pandas, but to adapt Pandas syntax for
>>> DAL (SELECT part mostly, in my case) :)
>>>
>>> --
>>> Jurgis Pralgauskis
>>> tel: 8-616 77613
>>>
>>> 2018-05-03 04:05 popiet "Richard Vézina" 
>>> rašė:
>>>
>>> I use this to merge join dal query :
>>>
>>> # merge_dicts is from here :
>>> #
>>> http://stackoverflow.com/questions/38987/how-can-i-merge-two-python-dictionaries-in-a-single-expression
>>> def merge_dicts(*dict_args):
>>> """
>>> Given any number of dicts, shallow copy and merge into a new dict,
>>> precedence goes to key value pairs in latter dicts.
>>> """
>>> result = {}
>>> for dictionary in dict_args:
>>> result.update(dictionary)
>>> return result
>>>
>>> db(db.table_1.id == something).select(db.table_1.ALL, db.table_2.ALL,
>>> db.table_3.ALL, db.table_4.ALL, join or left=[...]).as_list()
>>>
>>> df = pd.DataFrame([merge_dicts(r['table_1'],
>>>r['table_2'],
>>>r['table_3'],
>>>    r[table_4]) for r in
>>> rows.as_list()])
>>>
>>> What you want would have to be include in pandas.
>>>
>>> Richard
>>>
>>> On Thu, May 3, 2018 at 2:49 AM, Jurgis Pralgauskis <
>>> jurgis.pralgaus...@gmail.com> wrote:
>>>
>>>> Bt if I want select cols/filter rows/aggregate/ join tables
>>>>  - with Pandas syntax directly from DB (for it to work as DAL, not with
>>>> another DAL syntax) ?
>>>>
>>>> --
>>>> Jurgis Pralgauskis
>>>> tel: 8-616 77613
>>>>
>>>> 2018-05-02, tr 22:22, Richard Vézina 
>>>> rašė:
>>>>
>>>>> I am not sure I understand what you want...
>>>>>
>>>>> It a nice thing if Pandas use RAM it means that it use the fastest
>>>>> component of you computer... It should make Pandas fast...
>>>>>
>>>>> I am not sure what would involve overloading operators to use pyDAL...
>>>>> Pandas is used to transform data... If what you do on your dataframe has 
>>>>> to
>>>>> be apply to your data would be really risky on the persistence stand
>>>>> point...
>>>>>
>>>>> To populate dataframe from web2py table :
>>>>>
>>>>> import pandas as pd
>>>>> rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list()
>>>>> df = pd.DataFrame(rows)
>>>>> df.columns  # Should be your fields names
>>>>>
>>>>> Richard
>>>>>
>>>>> On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis <
>>>>> jurgis.pralgaus...@gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Pandas syntax seems very nice (short), and popular ...
>>>>>> But Pandas eat RAM..., and well, most of data is in DB...
>>>>>>
>>>>>> so I wonder, how hard would it be to overload operators to use pyDAL
>>>>>> (or other DAL/ORM)?
>>>>>>
>>>>>> what are the main challanges?
>>>>>>
>>>>>> --
>>>>>> 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)
>>>>>> 

Re: [web2py] pyDAL "adapter" for Pandas syntax (phylosophical)

2018-05-03 Thread Jurgis Pralgauskis
I'd like not to include sth into Pandas, but to adapt Pandas syntax for DAL
(SELECT part mostly, in my case) :)

--
Jurgis Pralgauskis
tel: 8-616 77613

2018-05-03 04:05 popiet "Richard Vézina" <ml.richard.vez...@gmail.com> rašė:

I use this to merge join dal query :

# merge_dicts is from here :
#
http://stackoverflow.com/questions/38987/how-can-i-merge-two-python-dictionaries-in-a-single-expression
def merge_dicts(*dict_args):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for dictionary in dict_args:
result.update(dictionary)
return result

db(db.table_1.id == something).select(db.table_1.ALL, db.table_2.ALL,
db.table_3.ALL, db.table_4.ALL, join or left=[...]).as_list()

df = pd.DataFrame([merge_dicts(r['table_1'],
   r['table_2'],
   r['table_3'],
   r[table_4]) for r in
rows.as_list()])

What you want would have to be include in pandas.

Richard

On Thu, May 3, 2018 at 2:49 AM, Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> Bt if I want select cols/filter rows/aggregate/ join tables
>  - with Pandas syntax directly from DB (for it to work as DAL, not with
> another DAL syntax) ?
>
> --
> Jurgis Pralgauskis
> tel: 8-616 77613
>
> 2018-05-02, tr 22:22, Richard Vézina <ml.richard.vez...@gmail.com> rašė:
>
>> I am not sure I understand what you want...
>>
>> It a nice thing if Pandas use RAM it means that it use the fastest
>> component of you computer... It should make Pandas fast...
>>
>> I am not sure what would involve overloading operators to use pyDAL...
>> Pandas is used to transform data... If what you do on your dataframe has to
>> be apply to your data would be really risky on the persistence stand
>> point...
>>
>> To populate dataframe from web2py table :
>>
>> import pandas as pd
>> rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list()
>> df = pd.DataFrame(rows)
>> df.columns  # Should be your fields names
>>
>> Richard
>>
>> On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis <
>> jurgis.pralgaus...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Pandas syntax seems very nice (short), and popular ...
>>> But Pandas eat RAM..., and well, most of data is in DB...
>>>
>>> so I wonder, how hard would it be to overload operators to use pyDAL (or
>>> other DAL/ORM)?
>>>
>>> what are the main challanges?
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/DIeQ5U-pr6Q/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

Re: [web2py] pyDAL "adapter" for Pandas syntax (phylosophical)

2018-05-03 Thread Jurgis Pralgauskis
Bt if I want select cols/filter rows/aggregate/ join tables
 - with Pandas syntax directly from DB (for it to work as DAL, not with
another DAL syntax) ?

--
Jurgis Pralgauskis
tel: 8-616 77613

2018-05-02, tr 22:22, Richard Vézina <ml.richard.vez...@gmail.com> rašė:

> I am not sure I understand what you want...
>
> It a nice thing if Pandas use RAM it means that it use the fastest
> component of you computer... It should make Pandas fast...
>
> I am not sure what would involve overloading operators to use pyDAL...
> Pandas is used to transform data... If what you do on your dataframe has to
> be apply to your data would be really risky on the persistence stand
> point...
>
> To populate dataframe from web2py table :
>
> import pandas as pd
> rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list()
> df = pd.DataFrame(rows)
> df.columns  # Should be your fields names
>
> Richard
>
> On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis <
> jurgis.pralgaus...@gmail.com> wrote:
>
>> Hi,
>>
>> Pandas syntax seems very nice (short), and popular ...
>> But Pandas eat RAM..., and well, most of data is in DB...
>>
>> so I wonder, how hard would it be to overload operators to use pyDAL (or
>> other DAL/ORM)?
>>
>> what are the main challanges?
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/DIeQ5U-pr6Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] pyDAL "adapter" for Pandas syntax (phylosophical)

2018-05-01 Thread Jurgis Pralgauskis
Hi, 

Pandas syntax seems very nice (short), and popular ...
But Pandas eat RAM..., and well, most of data is in DB...

so I wonder, how hard would it be to overload operators to use pyDAL (or 
other DAL/ORM)?

what are the main challanges?

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

2018-04-09 Thread Jurgis Pralgauskis
Would be good if Py3 support would be highlighted in Instructions 
http://web2py.com/init/default/download  
as now it says 

> python*2.7* web2py.py


Because most guys go there
ps.: and because  https://youtu.be/GudJlbK4TY8

>

-- 
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] autobuild'ing web2py models from MySQL metadata?

2017-07-18 Thread Jurgis Pralgauskis
Thanks for the link!  :)

On Tue, Jul 18, 2017 at 2:23 PM, Anthony <abasta...@gmail.com> wrote:

> Have you tried this: https://github.com/web2py/web2py/blob/master/scripts/
> extract_mysql_models.py
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/ZNr4g6qJm2A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 
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: autobuild'ing web2py models from MySQL metadata?

2017-07-18 Thread Jurgis Pralgauskis
I found, sqlalhemy has reflection/"autoload" 
<http://docs.sqlalchemy.org/en/latest/core/reflection.html> feature per 
table.

and sqlsoup <https://sqlsoup.readthedocs.io/en/latest/tutorial.html> seems 
even better  -- it analyses all tables at once - and can generate code (for 
sqlalchemy).

probaly these can be applied for my conserns.. -- so one only needs to 
define extra constrains..

On Friday, July 7, 2017 at 2:49:41 PM UTC+3, Jurgis Pralgauskis wrote:
>
> Hi, 
>
> As I understand  I could autogenerate table definitions from MySQL 
> INFORMATION 
> SCHEMA <https://dev.mysql.com/doc/refman/en/information-schema.html>  
> (mostly TABLES and COLUMNS tables).
> And references should be figured out somehow (probably in custom way)
>
>
> Maybe someone has tried this?
> Probably this is the way  phpmyadmin / adminer knows db structure?
>
>

-- 
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] Janrain FB auth "unable to sign .. in."?

2017-07-17 Thread Jurgis Pralgauskis
Hi, I set up it today, 

in Janrain I require

   - Ask
   Email
   -  Ask
   Verified Email




in FB app I select "FB Login" product with only 

Yes
No
Web OAuth LoginEnables web based OAuth client


We were temporarily unable to sign you in. We're really sorry.
Here's more info if the problem continue


you can try 
http://jurgisvcs.pythonanywhere.com/web2py_tutor/default/user/login

-- 
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] autobuild'ing web2py models from MySQL metadata?

2017-07-07 Thread Jurgis Pralgauskis
Hi, 

As I understand  I could autogenerate table definitions from MySQL INFORMATION 
SCHEMA   
(mostly TABLES and COLUMNS tables).
And references should be figured out somehow (probably in custom way)


Maybe someone has tried this?
Probably this is the way  phpmyadmin / adminer knows db structure?

-- 
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] db structure graphical analysis tool

2017-07-07 Thread Jurgis Pralgauskis
Hi, 

in our DB we have ~300 tables. So I hacked into graph_model to filter 
 shown tables/fields. 
It was very helpfull for me when I joined the project with so many tables.
The most common use case -- searching for possible join-paths between two 
tables, but also can filter by (fragments of) tablenames.

It shows SVG by default (less memory consumption than png), 
and tables are hyperlinked to their admin pages.

Also made beta plugin 

 (the 
code is quite dirty and  not optimal, but does the job : ).  
src: controller 
,
 
view 

 
screenshot 


Would be glad if someone finds it usefull :)
ps.: what is the best way to distribute it? http://www.web2pyslices.com/ 
seems to be frozen for 1 year..

-- 
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] how to query json field (with filter in/out) by equality

2017-06-06 Thread Jurgis Pralgauskis
Hi, 
I use json field with following filters

Field('responses', 'json'), 


db.learn.responses.filter_in = lambda obj, dumps=dumps: dumps(obj)
db.learn.responses.filter_out = lambda txt, loads=loads: loads(txt)


but if I want to select based on equality -- nothing is found -- query:

db.learn.responses==['foo', 'bar']  


should I apply filter_in here as well?


-- 
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] reusing functions from other controllers

2017-04-19 Thread Jurgis Pralgauskis
Hi,

this would probably be hack'ish, but for testing purposes would be nice to
be able to import from controller in other controller..

normal importing is/seems not supported, but maybe some exec based magic
could help?

-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 
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] how to get ALL db._timings -- override TIMINGSSIZE without touching base.py

2017-04-04 Thread Jurgis Pralgauskis
Hi, 

in  some older web2py ( Version 2.10.4-stable+timestamp.2015.04.26.15.11.54 
)
and I want to get all the SQL's of the request..

I see, that they are stored in db._timings but truncated to 100

 in adapters/base.py  

TIMINGSSIZE = 100  


def log_execute(self, *a, **b):
*...*
ret = self.cursor.execute(command, *a[1:], **b)
self.db._timings.append((command,time.time()-t0))
del self.db._timings[:-TIMINGSSIZE]   ### Truncated here :/
return ret




My question:
(how) can I increase "TIMINGSIZE"  withoug editing the package...


some monkeypaching magic?

ps.: I found i could use pyDAL logger -- but it would mix requests from 
different sessions, I guess..

-- 
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] dynamic extending of views?

2017-03-30 Thread Jurgis Pralgauskis
Hi, 

if I have 2 base views:
base1.html
base2.html


and  I have 3 variants  to ovveride same block: 
A
B
C


Can I dynamically generate extended view, sth like:
render( dyn_view(base, ovverride) ,   dict_vars )

As I feel the standardt way is a bit clumsy:

base1A.html
base1B.html
base1C.html

base2A.html
base2B.html
base2C.html

-- 
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] Could Set also handle having?

2017-03-13 Thread Jurgis Pralgauskis
This would make sense, but would probably need more robust sql generation
for update(..)?

Generally for me Set seems to be  weird layer to hold where clause... why
not just have where-query arg in crud db actions (seems adapters do this)?

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


[web2py] How to get all sql which fire in fragment of code?

2017-03-13 Thread Jurgis Pralgauskis
I know _lastsql ,
But if I have virtual fields in select, they might fire extra sqls. ..

In response toolbar I can see log of all sqls.
How can I get tail of log since some point in code?

-- 
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: how to override "select" method?

2017-03-10 Thread Jurgis Pralgauskis
Common filters only add to query,  but I need to change/replace
fields/expressions .

Now I think of monkeypatch'ing Set 'select' method (probably inside of
objects.py, because I guess Set is imported in different places).

Or maybe I don't need to touch pydal files, if I monkeypatch from db.py
some XAdapter in  DAL ADAPTERS. I hope it is single point of XAdapter
import..

Ps: class method monkeypatching seems quite straightforward
https://tryolabs.com/blog/2013/07/05/run-time-method-patching-python/

2017-03-10 04:28 popiet "Leonel Câmara"  rašė:

> Note that you can do what you want the first feature for, easily with
> common filters:
> http://www.web2py.com/books/default/chapter/29/06/the-
> database-abstraction-layer#Common-filters
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/c_BMpcUu8Vg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] overriding fieldnames for SQLFORM

2017-03-10 Thread Jurgis Pralgauskis
Hi, 

How could I have different name in generated SQLFORM than field.name?

I'd like to have optional  field.formname  

Use-cases:

 - mult-table from with unique inputnames:
 could be:   field.formname='tablename__fieldname'

 - multi-record form (or multiform submision with ajax)
   some inputs serializers for ajax require notation for names like 
"tablename[id].fieldname"
  example https://github.com/maxatwork/form2js 
, https://github.com/marioizquierdo/jquery.serializeJSON

-- 
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: new experimental feature in trunk - rows.join(...)

2017-03-09 Thread Jurgis Pralgauskis
What is more efficient on relational DB (for ex., postgre):  join(..)  or 
 group_by_val(..)  

rows = db(db.person).select().join(db.thing.owner, name="owns", fields=[
db.thing.id, db.thing.name])  

vs

rows = db(db.person).select( db.person.All, db.thing.id, db.thing.name, 
 join=[ ..on.db.thing.owner=...,) ).group_by_val( db.person.id ) 
# 1 db request, but more duplicating info in fetched rows

ps.: maybe join(..) could be named "join_grouped" for less confusion with 
select's arg "join" (and better hint what it does)

-- 
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] how to override "select" method?

2017-03-09 Thread Jurgis Pralgauskis
One more feature:
 - I want to get  result of select()   .compact=False by default

On Thu, Mar 9, 2017 at 8:33 PM, Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> Hi,
>
> I want to have extra features for select(..)
> And the codebase is already quite big -- imo best would be to implement
> the features transparently...
>
> I guess I could make derivative of Set class
> and override __call__ and select (and maybe _select) If I need this only
> for reading information?
>
> or should I think of making/deriving Adapter (in my case Postgre and maybe
> Sqlite)?
>
>
> ps.:
> The features I want to have:
>  - our system stores translations for names of different items from
> different tables...  And I  decorate query and args for select(..) on the
> fly  (src
> <https://github.com/dz0/web2py_grand_helpers/blob/72910a0b82e7e50de6d09b635cfd7855f85abc65/plugins/modules/plugin_AnySQLFORM/GrandRegister.py#L564>
> )
>  - virtual fields would know what extra  fields/Expressions they need (src
> <https://github.com/dz0/web2py_grand_helpers/blob/72910a0b82e7e50de6d09b635cfd7855f85abc65/plugins/controllers/plugin_AnySQLFORM.py#L544>
> )
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/c_BMpcUu8Vg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 
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] how to override "select" method?

2017-03-09 Thread Jurgis Pralgauskis
Hi, 

I want to have extra features for select(..)
And the codebase is already quite big -- imo best would be to implement the 
features transparently...

I guess I could make derivative of Set class
and override __call__ and select (and maybe _select) If I need this only 
for reading information?

or should I think of making/deriving Adapter (in my case Postgre and maybe 
Sqlite)?


ps.:
The features I want to have:
 - our system stores translations for names of different items from 
different tables...  And I  decorate query and args for select(..) on the 
fly  (src 

)
 - virtual fields would know what extra  fields/Expressions they need (src 

)

-- 
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: new experimental feature in trunk - rows.join(...)

2017-03-06 Thread Jurgis Pralgauskis
I'd like to.
But it needs review and tests, I guess.

2017-03-06 17:00 "Richard Vézina" <ml.richard.vez...@gmail.com> rašė:

> Hello Jurgis, maybe it could be included as a contrib??
>
> Because as Giovanni mention, your proposal would make the DAL more of an
> ORM in case it been included.
>
> Richard
>
> On Sun, Mar 5, 2017 at 11:44 PM, Jurgis Pralgauskis <
> jurgis.pralgaus...@gmail.com> wrote:
>
>> You can try mu plugin
>>
>> https://github.com/dz0/web2py_grand_helpers/blob/master/plug
>> ins/modules/plugin_joins_builder/joins_builder.py
>>
>> Also mentioned as proposal
>> https://github.com/web2py/pydal/issues/432
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/_xQUWYXZG54/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: VirtualField in select?

2017-03-06 Thread Jurgis Pralgauskis
my solution
https://github.com/dz0/web2py_grand_helpers/blob/72910a0b82e7e50de6d09b635cfd7855f85abc65/plugins/controllers/plugin_AnySQLFORM.py#L544


2017-03-05 09:23 "Jurgis Pralgauskis" <jurgis.pralgaus...@gmail.com> rašė:

> Sorry for no example. I want sth like:
>
> dbset.smart_select(field1, *vfield2*, field3)
>
> And get the corresponding row structure (without extra actions).
>
> And
> field3.readable = False
> could hide it in final structure.
>
>
>
> 2017-03-05 00:39 "Anthony" <abasta...@gmail.com> rašė:
>
>> On Saturday, March 4, 2017 at 6:15:29 AM UTC-5, Jurgis Pralgauskis wrote:
>>>
>>> Hi,
>>>
>>> I would like to have SQLFORM.grid  behaviour for VirtualField, but  I
>>> want get rows instead of TABLE.
>>>
>>> And grid doesn't fit my needs, as it doesn't let Expression
>>> <https://github.com/web2py/web2py/issues/1553>... and I don't
>>> neceserrily need represented values, but raw instead..
>>>
>>> So what's the best way to hack it?
>>>
>>
>> It's not quite clear what your requirements are, so hard to say.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/web2py/jilgqy_HMHQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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: new experimental feature in trunk - rows.join(...)

2017-03-05 Thread Jurgis Pralgauskis
You can try mu plugin

https://github.com/dz0/web2py_grand_helpers/blob/master/plugins/modules/plugin_joins_builder/joins_builder.py

Also mentioned as proposal
https://github.com/web2py/pydal/issues/432

-- 
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: VirtualField in select?

2017-03-04 Thread Jurgis Pralgauskis
Sorry for no example. I want sth like:

dbset.smart_select(field1, *vfield2*, field3)

And get the corresponding row structure (without extra actions).

And
field3.readable = False
could hide it in final structure.



2017-03-05 00:39 "Anthony" <abasta...@gmail.com> rašė:

> On Saturday, March 4, 2017 at 6:15:29 AM UTC-5, Jurgis Pralgauskis wrote:
>>
>> Hi,
>>
>> I would like to have SQLFORM.grid  behaviour for VirtualField, but  I
>> want get rows instead of TABLE.
>>
>> And grid doesn't fit my needs, as it doesn't let Expression
>> <https://github.com/web2py/web2py/issues/1553>... and I don't
>> neceserrily need represented values, but raw instead..
>>
>> So what's the best way to hack it?
>>
>
> It's not quite clear what your requirements are, so hard to say.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/jilgqy_HMHQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] VirtualField in select?

2017-03-04 Thread Jurgis Pralgauskis
Hi, 

I would like to have SQLFORM.grid  behaviour for VirtualField, but  I want 
get rows instead of TABLE.

And grid doesn't fit my needs, as it doesn't let Expression 
... and I don't neceserrily 
need represented values, but raw instead..

So what's the best way to hack it?

I can look somewhere 
in https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2843 ?

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


[web2py] Re: How to add virtual field to table after definition?

2017-03-04 Thread Jurgis Pralgauskis
But then vfield doesn't know it belongs to db.mytable?
And db.mytable doesn't clearly know it holds this field (via fields attr)

2017 m. kovas 2 d., ketvirtadienis 21:31:38 UTC+2, Anthony rašė:
>
> db.mytable.myvfield = Field.Virtual('myvfield', lambda r: ...)
>
> Anthony
>
> On Thursday, March 2, 2017 at 1:51:55 PM UTC-5, Jurgis Pralgauskis wrote:
>>
>> Before trying I wanted to ask, maybe there is some recipy.
>>
>> I think,I should assign vfield as table attr and append it to 
>> table.fields?
>> And set vfield attrs: table, tablename?
>>
>> What else should I consider?
>>
>>

-- 
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] How to add virtual field to table after definition?

2017-03-02 Thread Jurgis Pralgauskis
Before trying I wanted to ask, maybe there is some recipy.

I think,I should assign vfield as table attr and append it to table.fields?
And set vfield attrs: table, tablename?

What else should I consider?

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


[web2py] Re: SQLFORM.grid, groupby and sum/count

2017-01-16 Thread Jurgis Pralgauskis
Hi, 

I think it echoes my isssues
https://github.com/web2py/web2py/issues/1559 
https://github.com/web2py/web2py/issues/1553

-- 
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] field.tablename vs field._tablename ?

2017-01-16 Thread Jurgis Pralgauskis
Hello, 

what is the difference?
I see _tablename used in Field constructor, but not assigned..

in Table constructor I found
   field.tablename = field._tablename = tablename

-- 
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] AnySQLFORM: one Form for Many Tables (even with same field names)

2017-01-15 Thread Jurgis Pralgauskis
Hi, 

I try to develop layer over SQLFORM
which would fully preserve field info (even better than in book example 

)

Ii call it AnySQLFORM 
https://github.com/dz0/web2py_grand_helpers/blob/master/app/controllers/plugin_AnySQLFORM.py

I want it to return Row object:
in my "test" example: 

the fields/expressions are:
db.auth_user.first_name, 
db.auth_user.last_name, 

db.auth_user.id,

db.auth_permission.table_name,
db.auth_permission.id,

Field( 'somefield' ),
Field('user_id', 'reference auth_user', 
requires=IS_IN_DB(db,db.auth_user.id, '%(first_name)s %(last_name)s')),
FormField(db.auth_user.first_name + db.auth_user.last_name, 
name='full_name'),


if *form.vars *are





the *self.**vars_as_Row()* takes request.vars and returns



I want to use it primarily as search from, so it can have even Expresssion 
instead of Field.

***
I implemented FormField as extension of Field, 
and AnySQLFORM as proxy to form_factory result... 

not sure if I do it nicely -- so review/advice is welcome :) 
 

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


[web2py] Re: How to manually construct IS_IN_DB for FK with foreign_table _format?

2017-01-13 Thread Jurgis Pralgauskis
SOLVED:

sf.requires = IS_IN_DB( db(query), db.*other_*table.*_id* , 
label=other_table._format,  left=left, distinct=True )

instead of

sf.requires = IS_IN_DB( db(query), db.table.*other_id* , 
label=other_table._format,  left=left, distinct=True )

:)

On Friday, January 13, 2017 at 11:13:10 AM UTC+2, Jurgis Pralgauskis wrote:
>
>
>
> Hi, 
>
> I have query  to get subset of stuff (and I want to have the same nice 
> options widget as is for default foreign keys)
>
> sf.requires = IS_IN_DB( db(query), db.table.other_id , 
> label=other_table._format,  left=left, distinct=True )
>
>
> but I get
>
> form = SQLFORM.factory( *updatables, table_name="jurgio")
>   File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 1809, in factory
> **attributes)
>   File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 1286, in __init__
> inp = field.widget(field, default)
>   File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 388, in widget
> options = requires[0].options()
>   File "/home/jurgis/dev/web2py_src/gluon/validators.py", line 598, in options
> self.build_set()
>   File "/home/jurgis/dev/web2py_src/gluon/validators.py", line 573, in 
> build_set
> fields = [table[k] for k in self.fieldnames]
>   File "/home/jurgis/dev/web2py_src/gluon/packages/dal/pydal/objects.py", 
> line 510, in __getitem__
> raise KeyError(key)
> KeyError: 'role'
>
>
>
> I could do select myself and construct IS_IN_SET -- but how can I fluently 
> get all the fields needed for   foreign _format (if  _format  varies 
> depending on other_table)? 
>
> any suggestions?
>
> Thanks
>

-- 
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] How to manually construct IS_IN_DB for FK with foreign_table _format?

2017-01-13 Thread Jurgis Pralgauskis


Hi, 

I have query  to get subset of stuff (and I want to have the same nice 
options widget as is for default foreign keys)

sf.requires = IS_IN_DB( db(query), db.table.other_id , 
label=other_table._format,  left=left, distinct=True )


but I get

form = SQLFORM.factory( *updatables, table_name="jurgio")
  File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 1809, in factory
**attributes)
  File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 1286, in __init__
inp = field.widget(field, default)
  File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 388, in widget
options = requires[0].options()
  File "/home/jurgis/dev/web2py_src/gluon/validators.py", line 598, in options
self.build_set()
  File "/home/jurgis/dev/web2py_src/gluon/validators.py", line 573, in build_set
fields = [table[k] for k in self.fieldnames]
  File "/home/jurgis/dev/web2py_src/gluon/packages/dal/pydal/objects.py", line 
510, in __getitem__
raise KeyError(key)
KeyError: 'role'



I could do select myself and construct IS_IN_SET -- but how can I fluently 
get all the fields needed for   foreign _format (if  _format  varies 
depending on other_table)? 

any suggestions?

Thanks

-- 
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] is there "has_signature()" alternative for auth.requires_signature()

2017-01-05 Thread Jurgis Pralgauskis
Hi,

I want to  use @auth.requires_signature() on inner function (which is
defined inside controller function), but this doesn't work.

I imagine 2 solutions:
1)  use  "has" alternative for signature decorator (but didn't notice it --
maybe too lazy to search :/ )

2)  join decorators -- but also doesn't work

@auth.requires_permission('list', 'user')
@auth.requires_signature()
def users():


-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

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


[web2py] Re: How to add Expression as (Virtual) Field to grid?

2017-01-02 Thread Jurgis Pralgauskis
Hi, 

I guess, SQLFORM.grid  is in sqlhtml.py, so this is not pydal stuff?
https://github.com/web2py/pydal/search?utf8=%E2%9C%93=grid

so I submitted to web2py repo
https://github.com/web2py/web2py/issues/1553

On Friday, December 30, 2016 at 5:02:00 PM UTC+2, Anthony wrote:
>
> On Friday, December 30, 2016 at 1:36:44 AM UTC-5, Jurgis Pralgauskis wrote:
>>
>> Hi, 
>>
>> grid allows virtual fields, 
>>
>> but they are calculated in Python layer, though sometimes this could be 
>> done in DB layer.
>>
>> Could I pass Expression of fields in similar way?
>>
>>
>> like I have in my previous question 
>> <https://groups.google.com/forum/#!msg/web2py/f3HdtWviTys/kMHhXIPKDwAJ>
>> db.item.total_price =  Field.Virtual('total_price', lambda row: 
>> row.item.unit_price * row.item.quantity)
>>
>> Would be nice to have
>> db.item.total_price =  Field.Expression('total_price', db.item.unit_price 
>> * db.item.quantity)
>>
>> this could also be applied to aggregates (as I suspect they are not 
>> supported in grid)
>>
>
> Feel free to submit a feature request on Github (in the PyDal repo). I 
> suppose something like this could facilitate displaying aggregates in the 
> grid as well as getting nice names for expressions in queries.
>
> For now, one option is to create a view in your database and define a 
> web2py DAL model that reflects the view. You can then pass that model to 
> the grid and it will display whatever is in the database view. A similar 
> but less efficient option is to do the query you want and load its results 
> into a sqlite:memory database and use that with the grid.
>
> Anthony 
>

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


[web2py] Re: Possible to replace value in SQLFORM.grid with a link?

2016-12-31 Thread Jurgis Pralgauskis
You can override in controller just before calling grid :

db.table.field1.represent =...
... = ...grid(...

-- 
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] How to add Expression as (Virtual) Field to grid?

2016-12-29 Thread Jurgis Pralgauskis
Hi, 

grid allows virtual fields, 

but they are calculated in Python layer, though sometimes this could be 
done in DB layer.

Could I pass Expression of fields in similar way?


like I have in my previous question 

db.item.total_price =  Field.Virtual('total_price', lambda row: 
row.item.unit_price * row.item.quantity)

Would be nice to have
db.item.total_price =  Field.Expression('total_price', db.item.unit_price * 
db.item.quantity)

this could also be applied to aggregates (as I suspect they are not 
supported in grid)

-- 
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] How to list Virtual Field in grid fields?

2016-12-29 Thread Jurgis Pralgauskis
Hi, 

The problem was, that I was not selecting the field  *item.quantity* , 
which is needed to calculate virtual field's value..

so I need to do 

db.*item.quantity*.readable = False
grid=SQLFORM.grid(db.item.id>0, fields=[db.item.unit_price, 
db.item.total_price, db.*item.quantity* ] ) 
 
ps.: 1st argument to grid can be table or query.

On Thursday, December 29, 2016 at 3:27:44 PM UTC+2, Áureo Dias Neto wrote:
>
> The SQLFORM expect to receive, an table, not a query..
>
> What's the name of your table? just put the name of the table on the first 
> argumment, and filter with 'fields' the fields you want to show.
>
> Just change:
> grid=SQLFORM.grid(db.item.id>0, fields=[db.item.unit_price, 
> db.item.total_price ] ) 
> To:
> grid=SQLFORM.grid(db.Y <http://db.item.id/>OUR_TABLE, 
> fields=[db.item.unit_price, db.item.total_price ] ) 
>
> 2016-12-29 11:19 GMT-02:00 Jurgis Pralgauskis <jurgis.pr...@gmail.com 
> >:
>
>> Hi, 
>>
>> I try to use virtual fields as in example
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=virtual#New-style-virtual-fields
>>
>>
>> db.item.total_price = Field.Virtual('total_price',
>>   lambda row: row.item.unit_price * 
>> row.item.quantity)
>>
>> But how can I list virtual field in grid fields?
>>
>> grid=SQLFORM.grid(db.item.id>0, fields=[db.item.unit_price, 
>> db.item.total_price ] ) 
>> 
>> gives error 
>>
>> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 Traceback
>>
>> Traceback (most recent call last):
>>   File "/home/jurgis/dev/web2py_src/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File 
>> "/home/jurgis/dev/web2py_src/applications/app/controllers/plugin_search_form.py"
>>  
>> <http://localhost:8001/admin/default/edit/app/controllers/plugin_search_form.py>,
>>  line 247, in 
>>   File "/home/jurgis/dev/web2py_src/gluon/globals.py", line 417, in 
>> self._caller = lambda f: f()
>>   File 
>> "/home/jurgis/dev/web2py_src/applications/app/controllers/plugin_search_form.py"
>>  
>> <http://localhost:8001/admin/default/edit/app/controllers/plugin_search_form.py>,
>>  line 50, in test_virtual_field
>> grid=SQLFORM.grid(db.item.id>0, fields=[db.item.unit_price, 
>> db.item.total_price ] )
>>   File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 2758, in grid
>> value = row[str(field)]
>>   File "/home/jurgis/dev/web2py_src/gluon/packages/dal/pydal/objects.py", 
>> line 76, in __getitem__
>> raise KeyError
>> KeyError
>>
>>
>>
>>
>> ps.: listing all fields would work, but I don't need all :
>>  grid=SQLFORM.grid(db.item.id>0 ) 
>>
>> or should I use readable = False for the ones I want to hide?
>>
>> -- 
>> Jurgis Pralgauskis
>> tel: 8-616 77613;
>> Don't worry, be happy and make things better ;)
>> http://galvosukykla.lt
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[web2py] How to list Virtual Field in grid fields?

2016-12-29 Thread Jurgis Pralgauskis
Hi,

I try to use virtual fields as in example
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=virtual#New-style-virtual-fields


db.item.total_price = Field.Virtual('total_price',
  lambda row: row.item.unit_price *
row.item.quantity)

But how can I list virtual field in grid fields?

grid=SQLFORM.grid(db.item.id>0, fields=[db.item.unit_price,
db.item.total_price ] )

gives error

web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 Traceback

Traceback (most recent call last):
  File "/home/jurgis/dev/web2py_src/gluon/restricted.py", line 227, in
restricted
exec ccode in environment
  File 
"/home/jurgis/dev/web2py_src/applications/app/controllers/plugin_search_form.py"
<http://localhost:8001/admin/default/edit/app/controllers/plugin_search_form.py>,
line 247, in 
  File "/home/jurgis/dev/web2py_src/gluon/globals.py", line 417, in 
self._caller = lambda f: f()
  File 
"/home/jurgis/dev/web2py_src/applications/app/controllers/plugin_search_form.py"
<http://localhost:8001/admin/default/edit/app/controllers/plugin_search_form.py>,
line 50, in test_virtual_field
grid=SQLFORM.grid(db.item.id>0, fields=[db.item.unit_price,
db.item.total_price ] )
  File "/home/jurgis/dev/web2py_src/gluon/sqlhtml.py", line 2758, in grid
value = row[str(field)]
  File "/home/jurgis/dev/web2py_src/gluon/packages/dal/pydal/objects.py",
line 76, in __getitem__
raise KeyError
KeyError




ps.: listing all fields would work, but I don't need all :
 grid=SQLFORM.grid(db.item.id>0 )

or should I use readable = False for the ones I want to hide?

-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 
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: How to check if expression is Aggregate?

2016-12-23 Thread Jurgis Pralgauskis
Yes, I did --recursive, as in description..

2016-12-24 00:42 "Anthony" <abasta...@gmail.com> rašė:

> On Friday, December 23, 2016 at 11:34:00 AM UTC-5, Jurgis Pralgauskis
> wrote:
>>
>> Hi,
>>
>> I used git clone  from https://github.com/web2py/web2py.git -- that is
>> probably problem
>> adapter always prints as:  > 0x7fc701680450>
>>
>
> PyDAL is now in a separate repository, so you have to do "git clone
> --recursive" to get the PyDAL.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/0IvASrrIDkA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: How to check if expression is Aggregate?

2016-12-23 Thread Jurgis Pralgauskis
Hi,

I used git clone  from https://github.com/web2py/web2py.git -- that is
probably problem
adapter always prints as:  

now I downloaded *_src.zip
and I get  

Thanks, probably I shouldn't use git... (but thought would be easier to
update to newest with pull..)


On Thu, Dec 22, 2016 at 3:36 AM, Anthony <abasta...@gmail.com> wrote:

> What version of web2py, and are you sure it includes the proper version of
> PyDAL?
>
> What is the object type of db._adapter (a) immediately after db is created
> in db.py and (b) when db is assigned from current.db in the module?
>
> Your traceback shows object type "SQLite", but the adapter is not of that
> type.
>
> Anthony
>
>
> On Wednesday, December 21, 2016 at 11:57:24 AM UTC-5, Jurgis Pralgauskis
> wrote:
>>
>>
>> > That's odd. Hard to say what's going on without seeing the code. Maybe
>> attach a minimal app that reproduces the problem.
>>
>> https://github.com/dz0/web2py_grand_helpers/blob/master/app/
>> modules/plugin_search_form/search_form.py#L188
>>
>> you can toggle comment with next line to see the non/working case...
>>
>> ps.: current.db is set in
>> https://github.com/dz0/web2py_grand_helpers/blob/master/app/
>> models/plugin_search_form.py
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/0IvASrrIDkA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 
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: How to check if expression is Aggregate?

2016-12-21 Thread Jurgis Pralgauskis

> That's odd. Hard to say what's going on without seeing the code. Maybe 
attach a minimal app that reproduces the problem.

https://github.com/dz0/web2py_grand_helpers/blob/master/app/modules/plugin_search_form/search_form.py#L188

you can toggle comment with next line to see the non/working case...

ps.: current.db is set in
https://github.com/dz0/web2py_grand_helpers/blob/master/app/models/plugin_search_form.py

-- 
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] Can't import plugin module

2016-12-21 Thread Jurgis Pralgauskis
Hi, 

I am trying to make plugin, but ran into 



Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 Traceback 

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

Traceback (most recent call last):
  File "/home/jurgis/dev/web2py_git/gluon/restricted.py", line 216, in 
restricted
exec(ccode, environment)
  File 
"/home/jurgis/dev/web2py_git/applications/app/controllers/plugin_joins_builder.py:index",
 line 3, in 
  File "/home/jurgis/dev/web2py_git/gluon/custom_import.py", line 104, in 
custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ImportError('No module named 
modules.plugin_joins_builder.joins_builder',), )

In file: 
/home/jurgis/dev/web2py_git/applications/app/controllers/plugin_joins_builder.py
 

1.

 at 0x7f70f00e0a30, file 
"/home/jurgis/dev/web2py_git/applications/app/controllers/plugin_joins_builder.py:index",
 line 3>



The code:
https://github.com/dz0/web2py_grand_helpers/blob/master/app/controllers/plugin_joins_builder.py#L3
https://github.com/dz0/web2py_grand_helpers/tree/master/app/modules/plugin_joins_builder

-- 
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: How to check if expression is Aggregate?

2016-12-21 Thread Jurgis Pralgauskis
> dir(db._adapter)

 ['POOLS', 'REGEX_TABLE_DOT_FIELD', '__class__', '__delattr__', '__dict__',
'__doc__', '__format__', '__getattribute__', '__hash__', '__init__',
'__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
'_add_operators_to_parsed_row', '_add_reference_sets_to_parsed_row',
'_after_connection', '_available_drivers', '_build_cursor',
'_build_handlers_for_execution', '_build_joins_for_select',
'_cached_select', '_clean_cursors', '_colexpand', '_connection_thname_',
'_connection_uname_', '_count', '_cursors_thname_', '_cursors_uname_',
'_delete', '_driver_from_uri', '_drop_table_cleanup', '_expand',
'_expand_for_index', '_find_work_folder', '_geoexpand',
'_get_or_build_free_cursor', '_initialize_', '_insert',
'_load_dependencies', '_parse', '_parse_expand_colnames', '_pid_',
'_regex_select_as_parser', '_register_extract', '_register_regexp',
'_select', '_select_aux', '_select_aux_execute', '_select_wcols',
'_update', 'adapt', 'adapter_args', 'after_connection',
'after_connection_hook', 'alias', 'bulk_insert', 'can_select_for_update',
'check_active_connection', 'close', 'close_all_instances',
'close_connection', 'close_cursor', 'commit', 'commit_on_alter_table',
'commit_prepared', 'common_filter', 'connection', 'connector', 'count',
'create_index', 'create_sequence_and_triggers', 'create_table',
'credential_decoder', 'cursor', 'cursors', 'db', 'db_codec', 'dbengine',
'dbpath', 'delete', 'dialect', 'distributed_transaction_begin', 'driver',
'driver_args', 'driver_name', 'drivers', 'drop', 'drop_index',
'drop_table', 'execute', 'execution_handlers', 'expand', 'expand_all',
'fetchall', 'fetchone', 'filter_sql_command', 'find_driver', 'folder',
'get_table', 'id_query', 'index_expander', 'insert', 'iterparse',
'iterselect', 'lastrowid', 'lock_cursor', 'migrator', 'parse',
'parse_value', 'parser', 'pool_size', 'prepare', 'reconnect',
'release_cursor', 'represent', 'representer', 'rollback',
'rollback_prepared', 'rowslice', 'select', 'set_folder', 'smart_adapt',
'sqlsafe_field', 'sqlsafe_table', 'support_distributed_transaction',
'table_alias', 'tables', 'test_connection', 'truncate', 'types', 'update',
'uploads_in_blob', 'uri', 'web2py_extract', 'web2py_regexp']

On Wed, Dec 21, 2016 at 12:22 AM, Anthony <abasta...@gmail.com> wrote:

> Not sure what's going on. You'll have to do some digging around. Maybe do
> a dir(db._adapter) to see what the object is.
>
> Anthony
>
> On Tuesday, December 20, 2016 at 4:03:27 PM UTC-5, Jurgis Pralgauskis
> wrote:
>>
>> it just has what  standar app gets:
>>
>> db = DAL(myconf.get('db.uri'),
>>  pool_size=myconf.get('db.pool_size'),
>>  migrate_enabled=myconf.get('db.migrate'),
>>  check_reserved=['all'])
>>
>> @appconfig.ini
>>
>> [db]
>> uri   = sqlite://storage.sqlite
>>
>>
>> On Tue, Dec 20, 2016 at 4:42 PM, Anthony wrote:
>>
>>> How have you defined db? The _adapter attribute of a DAL instance should
>>> be a "SQLiteAdapter" object when using SQLite, not a "SQLite" object.
>>>
>>> Anthony
>>>
>>>
>>> On Tuesday, December 20, 2016 at 5:00:02 AM UTC-5, Jurgis Pralgauskis
>>> wrote:
>>>>
>>>> I have searchform,
>>>>
>>>> where one can define various fields and mapping to expressions for
>>>> comparison,
>>>> and it automatically constructs select query,
>>>>
>>>> but if I want to check if expression is aggregate, and direct thesese
>>>> queries to "having"
>>>>
>>>> but if I try
>>>>
>>>> if filter.target_expression.op == db._adapter.AGGREGATE:
>>>>
>>>> I get
>>>>
>>>> AttributeError: 'SQLite' object has no attribute 'AGGREGATE'
>>>>
>>>>
>>>>
>>>>
>>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/web2py/0IvASrrIDkA/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jurgi

Re: [web2py] Re: How to check if expression is Aggregate?

2016-12-20 Thread Jurgis Pralgauskis
it just has what  standar app gets:

db = DAL(myconf.get('db.uri'),
 pool_size=myconf.get('db.pool_size'),
 migrate_enabled=myconf.get('db.migrate'),
 check_reserved=['all'])

@appconfig.ini

[db]
uri   = sqlite://storage.sqlite


On Tue, Dec 20, 2016 at 4:42 PM, Anthony <abasta...@gmail.com> wrote:

> How have you defined db? The _adapter attribute of a DAL instance should
> be a "SQLiteAdapter" object when using SQLite, not a "SQLite" object.
>
> Anthony
>
>
> On Tuesday, December 20, 2016 at 5:00:02 AM UTC-5, Jurgis Pralgauskis
> wrote:
>>
>> I have searchform,
>>
>> where one can define various fields and mapping to expressions for
>> comparison,
>> and it automatically constructs select query,
>>
>> but if I want to check if expression is aggregate, and direct thesese
>> queries to "having"
>>
>> but if I try
>>
>> if filter.target_expression.op == db._adapter.AGGREGATE:
>>
>> I get
>>
>> AttributeError: 'SQLite' object has no attribute 'AGGREGATE'
>>
>>
>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/0IvASrrIDkA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 
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] How to check if expression is Aggregate?

2016-12-20 Thread Jurgis Pralgauskis
I have searchform, 

where one can define various fields and mapping to expressions for 
comparison, 
and it automatically constructs select query, 

but if I want to check if expression is aggregate, and direct thesese 
queries to "having"

but if I try 

if filter.target_expression.op == db._adapter.AGGREGATE:

I get 

AttributeError: 'SQLite' object has no attribute 'AGGREGATE'




-- 
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] Smart-joins helper needs peer review :)

2016-11-27 Thread Jurgis Pralgauskis
Hi, 

Web2py is nice for its expression brevity -- but  joins still need quite 
long texting..
I wanted to make it simpler, because "readability counts" 
 :)

now you can write

build_joins( ['auth_user', 'auth_membership', 'auth_group', 
'auth_permission'] )

instead of 

[
  db.auth_membership.on( db.auth_membership.user_id == db.auth_user.id ) ),
  db.auth_group.on( db.auth_group.id == db.auth_membership.group_id ) ),
  db.auth_permission.on( db.auth_permission.group_id == db.auth_group.id ) ),]


Helper can use DB model to figure out the needed fields for join'ing 
(if it finds more than one possible field -- would throw an error with 
explatnation)

Alpha version
https://github.com/dz0/web2py_grand_helpers/blob/master/joins_builder.py

Sugestions/patches welcome :)

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


[web2py] Re: how to make Query, which is always "True" (1=1 or so) ?

2016-11-25 Thread Jurgis Pralgauskis


> How are you making your query map reduce?
>
>
query = reduce(lambda a, b: (a & b), queries) 

-- 
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] how to make Query, which is always "True" (1=1 or so) ?

2016-11-23 Thread Jurgis Pralgauskis
Hi, 

   I dynamically generate queries from my search form fields/filters. 
   and then map reduce the query list...
   But if no filter is selected, I get empty list...

  So I  try to add dummy query to the beginning:
  Query(db, db._adapter.EQ, 1, 1) 

  but I get 

AttributeError: 'SQLite' object has no attribute 'EQ'

-- 
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] does field object know it's tablename?

2016-11-21 Thread Jurgis Pralgauskis
or should I pass tablename to function alongside?

-- 
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: Graph Model (proposal to contribute)

2016-11-06 Thread Jurgis Pralgauskis
Hi, I would be interested!

Ps.: I made some subgraph/filtering features, when graph model is big (hundreds 
of tables), but with JS it might work nicer..

-- 
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] Filter for subgraph of graph_model ?

2016-09-21 Thread Jurgis Pralgauskis
Hi, 

I came to a new job where we have ~200 tables... emm... 
graph_model would be more usefull if it could "extract/filter" some domains 
(according to search words for table/field names)
and layout nicely 10-20 tables instead of 200  (it's ok for some references 
to be "orphaned" on one end)

Maybe someone knows a quick hack  directly in  
in 
https://github.com/web2py/web2py/blob/dabe5c4589d974c6eda83e0ee16b6ec04a4a5f6a/applications/admin/controllers/appadmin.py#L569
 
?

-- 
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: Alternative IDEs?

2016-09-19 Thread Jurgis Pralgauskis
Hi, I would like tu wake the topic up :)

What are people mostly using for W2P dev?

>From free (unpaid) alternatives  I found  mentioned
  - Sublime https://bitbucket.org/kfog/w2p (not sure about debug?)
  - PyCharm Community edition populate projects with fake imports
  - Aptana (PyDev) ?
  - VS Code?

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


[web2py] web2py on Android

2016-08-30 Thread Jurgis Pralgauskis
Hi, 

just curious, anybody tried sth like this (web2py + webview)
http://inclem.net/2016/05/07/kivy/python_for_android_webview_support/ ?

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


Re: [web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2016-04-26 Thread Jurgis Pralgauskis
Hi, 

maybe this is possible to do per_app now (without touching web2py core)? :)

ps.: there was also  idea  with ajax

On Friday, June 14, 2013 at 8:00:36 PM UTC+3, Jurgis Pralgauskis wrote:
>
> Generally, maybe error template can be some app config, but not bound to 
> routing?
> and if it is found it is used, and if not found - default template would 
> be used...
>
> and maybe default template could work a bit smarter - check if admin is 
> logged, and then display this iframe with stuff directly?
>
>
> 2013 m. gegužė 22 d., trečiadienis 14:54:52 UTC+3, Anthony rašė:
>>
>> I don't know that you'd want to re-check and possibly re-load all the 
>> routes on every request in production, but I suppose it might be nice in 
>> development (like tracking changes in modules).
>>
>> Anthony
>>
>> On Wednesday, May 22, 2013 4:01:47 AM UTC-4, Jurgis Pralgauskis wrote:
>>>
>>> Thanks, 
>>>
>>> but still would be nicer - if defining in app would be enough (kind of 
>>> KISS style)
>>> and maybe even without need to restart web2py (if just app level 
>>> changes)?
>>>
>>>
>>> On Tue, May 21, 2013 at 7:06 PM, Anthony <abas...@gmail.com> wrote:
>>>
>>>> You can app-specific routes in the app folder, but then you still need 
>>>> to specify routes_app in the root routes.py to tell web2py which apps have 
>>>> app-specific routes.
>>>>
>>>> Anthony
>>>>
>>>>
>>>> On Tuesday, May 21, 2013 10:01:41 AM UTC-4, Jurgis Pralgauskis wrote:
>>>>
>>>>> but even app-specific routes must be specified outside app folder (in 
>>>>> web2py root)?
>>>>>
>>>>>
>>>>> On Tue, May 21, 2013 at 3:01 PM, Anthony <abas...@gmail.com> wrote:
>>>>>
>>>>>> routes_onerror can specify app-specific routes.
>>>>>>
>>>>>>
>>>>>> On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:
>>>>>>
>>>>>>> I mean routes.py is in web2py root, not in app folder..
>>>>>>>
>>>>>>>
>>>>>>> On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis <
>>>>>>> jurgis.pr...@gmail.com> wrote:
>>>>>>>
>>>>>>>> but rootes are described per web2py, not per app..?
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, May 21, 2013 at 10:49 AM, Niphlod <nip...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> there are routes to manage custom error pages.
>>>>>>>>> http://web2py.com/books/default/chapter/29/04#Routes-on-error
>>>>>>>>>
>>>>>>>>> Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis 
>>>>>>>>> Pralgauskis ha scritto:
>>>>>>>>>
>>>>>>>>>> Hi, 
>>>>>>>>>>
>>>>>>>>>> clicking ticket link each time becomes frustrating (time wasting) 
>>>>>>>>>> [SOLVED] :)
>>>>>>>>>>
>>>>>>>>>> I looked arround and tried example from http://www.dev-explorer.c
>>>>>>>>>> om/articles/full-page-iframe
>>>>>>>>>> you only need to escape % for sizing.
>>>>>>>>>> my routes.py: http://pastebin.com/bfKYEhet
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ps.: could error message be customized per app? 
>>>>>>>>>> then I could include in my demo (skeleton) app for students - as 
>>>>>>>>>> my students work through web interface (and I don't want to bother 
>>>>>>>>>> them too 
>>>>>>>>>> much with other issues)...
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>  
>>>>>>>>> --- 
>>>>>>>>> You received this message because you are subscribed to a topic in 
>>>>>>>>> the Google Groups "web2py-users" group.
>>>>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>>>>>>>> topic/web2py/

[web2py] how to indicate which table to delete from when querying from 2?

2013-07-11 Thread Jurgis Pralgauskis
db( (db.MatchPlayers.player==playerID)  (db.MatchPlayers.match_ == 
db.Matches.id)  (db.Matches.started == None) ).delete()

gives:

raise RuntimeError(Too many tables selected)

any hints?

http://web2py.com/books/default/chapter/29/06#count,-isempty,-delete,-update
 
I don't find examples for similar cases

I could select first , and then loop deleting records of needed table ... 
but would be not very efficiet

-- 

--- 
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 to indicate which table to delete from when querying from 2?

2013-07-11 Thread Jurgis Pralgauskis


 From which table do you want to delete records? 


 MatchPlayers , but Matches would be left intact
 

-- 

--- 
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: how to indicate which table to delete from when querying from 2?

2013-07-11 Thread Jurgis Pralgauskis
ps: by the way, would be nice to have a shortcut 
db( (db.MatchPlayers.player==playerID)  (db.MatchPlayers.match_.started == 
None) ).

(for me it didn't work, but in in W2P nonquery syntax this works (and in 
Django such magic works i queries, if I recon  correctly )

2013 m. liepa 11 d., ketvirtadienis 15:17:46 UTC+3, Jurgis Pralgauskis rašė:

 db( (db.MatchPlayers.player==playerID)  (db.MatchPlayers.match_ == 
 db.Matches.id)  (db.Matches.started == None) ).delete()

 gives:

 raise RuntimeError(Too many tables selected)

 any hints?


 http://web2py.com/books/default/chapter/29/06#count,-isempty,-delete,-update
  
 I don't find examples for similar cases

 I could select first , and then loop deleting records of needed table ... 
 but would be not very efficiet


-- 

--- 
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: websocket_messaging.py example: browser WebSocket connection error

2013-07-04 Thread Jurgis Pralgauskis
any ideas why?
and how could I debug in more detail?
I'm on Ubuntu 12.04.2 LTS

2013 m. liepa 2 d., antradienis 15:33:06 UTC+3, Jurgis Pralgauskis rašė:

 Chrome error log says:

 WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: 
 Unexpected response code: 426 

 the mesagges from serverside (python) reach tornado (I see in console)
 I run w2p locally.

 Tested with FF (21.0)  and Chrome (26.0.1410.63 ), which work OK with 
 http://www.websocket.org/echo.html 


-- 

--- 
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: websocket_messaging.py example: browser WebSocket connection error

2013-07-04 Thread Jurgis Pralgauskis
in tornado.websockets.py I find line:

HTTP/1.1 426 Upgrade Required\r\n

what could it mean?
https://github.com/facebook/tornado/blob/60693e011cc0602d83a29ac37fa7263eda107f61/tornado/websocket.py#L151

2013 m. liepa 4 d., ketvirtadienis 11:57:16 UTC+3, Jurgis Pralgauskis rašė:

 any ideas why?
 and how could I debug in more detail?
 I'm on Ubuntu 12.04.2 LTS

 2013 m. liepa 2 d., antradienis 15:33:06 UTC+3, Jurgis Pralgauskis rašė:

 Chrome error log says:

 WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: 
 Unexpected response code: 426 

 the mesagges from serverside (python) reach tornado (I see in console)
 I run w2p locally.

 Tested with FF (21.0)  and Chrome (26.0.1410.63 ), which work OK with 
 http://www.websocket.org/echo.html 



-- 

--- 
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: websocket_messaging.py example: browser WebSocket connection error

2013-07-04 Thread Jurgis Pralgauskis
ps.: how to use newer module of tornado?
as in system install I have  python-tornado 2.1.0-2ubuntu0.1

2013 m. liepa 4 d., ketvirtadienis 15:24:04 UTC+3, Jurgis Pralgauskis rašė:

 in tornado.websockets.py I find line:

 HTTP/1.1 426 Upgrade Required\r\n

 what could it mean?

 https://github.com/facebook/tornado/blob/60693e011cc0602d83a29ac37fa7263eda107f61/tornado/websocket.py#L151

 2013 m. liepa 4 d., ketvirtadienis 11:57:16 UTC+3, Jurgis Pralgauskis rašė:

 any ideas why?
 and how could I debug in more detail?
 I'm on Ubuntu 12.04.2 LTS

 2013 m. liepa 2 d., antradienis 15:33:06 UTC+3, Jurgis Pralgauskis rašė:

 Chrome error log says:

 WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: 
 Unexpected response code: 426 

 the mesagges from serverside (python) reach tornado (I see in console)
 I run w2p locally.

 Tested with FF (21.0)  and Chrome (26.0.1410.63 ), which work OK with 
 http://www.websocket.org/echo.html 



-- 

--- 
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: websocket_messaging.py example: browser WebSocket connection error

2013-07-04 Thread Jurgis Pralgauskis
partially resolved - 
with pip installed tornado 3.1

and now  example  works:

but in console I see Tornado exception:

ERROR:tornado.application:Uncaught exception POST / (127.0.0.1)
HTTPRequest(protocol='http', host='127.0.0.1:', method='POST', uri='/', 
version='HTTP/1.0', remote_ip='127.0.0.1', headers={'Content-Length': '68', 
'Content-Type': 'application/x-www-form-urlencoded', 'Host': 
'127.0.0.1:', 'User-Agent': 'Mozilla/4.0'})
Traceback (most recent call last):
  File /usr/local/lib/python2.7/dist-packages/tornado/web.py, line 1155, 
in _when_complete
raise ValueError(Expected Future or None, got %r % result)
ValueError: Expected Future or None, got 'true'
ERROR:tornado.access:500 POST / (127.0.0.1) 4.52ms


2013 m. liepa 4 d., ketvirtadienis 15:36:25 UTC+3, Jurgis Pralgauskis rašė:

 ps.: how to use newer module of tornado?
 as in system install I have  python-tornado 2.1.0-2ubuntu0.1

 2013 m. liepa 4 d., ketvirtadienis 15:24:04 UTC+3, Jurgis Pralgauskis rašė:

 in tornado.websockets.py I find line:

 HTTP/1.1 426 Upgrade Required\r\n

 what could it mean?

 https://github.com/facebook/tornado/blob/60693e011cc0602d83a29ac37fa7263eda107f61/tornado/websocket.py#L151

 2013 m. liepa 4 d., ketvirtadienis 11:57:16 UTC+3, Jurgis Pralgauskis 
 rašė:

 any ideas why?
 and how could I debug in more detail?
 I'm on Ubuntu 12.04.2 LTS

 2013 m. liepa 2 d., antradienis 15:33:06 UTC+3, Jurgis Pralgauskis rašė:

 Chrome error log says:

 WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: 
 Unexpected response code: 426 

 the mesagges from serverside (python) reach tornado (I see in console)
 I run w2p locally.

 Tested with FF (21.0)  and Chrome (26.0.1410.63 ), which work OK with 
 http://www.websocket.org/echo.html 



-- 

--- 
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] websocket_messaging.py example: browser WebSocket connection error

2013-07-02 Thread Jurgis Pralgauskis
Chrome error log says:

WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: 
Unexpected response code: 426 

the mesagges from serverside (python) reach tornado (I see in console)
I run w2p locally.

Tested with FF (21.0)  and Chrome (26.0.1410.63 ), which work OK with 
http://www.websocket.org/echo.html 

-- 

--- 
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] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-06-14 Thread Jurgis Pralgauskis
Generally, maybe error template can be some app config, but not bound to 
routing?
and if it is found it is used, and if not found - default template would be 
used...

and maybe default template could work a bit smarter - check if admin is 
logged, and then display this iframe with stuff directly?


2013 m. gegužė 22 d., trečiadienis 14:54:52 UTC+3, Anthony rašė:

 I don't know that you'd want to re-check and possibly re-load all the 
 routes on every request in production, but I suppose it might be nice in 
 development (like tracking changes in modules).

 Anthony

 On Wednesday, May 22, 2013 4:01:47 AM UTC-4, Jurgis Pralgauskis wrote:

 Thanks, 

 but still would be nicer - if defining in app would be enough (kind of 
 KISS style)
 and maybe even without need to restart web2py (if just app level changes)?


 On Tue, May 21, 2013 at 7:06 PM, Anthony abas...@gmail.com wrote:

 You can app-specific routes in the app folder, but then you still need 
 to specify routes_app in the root routes.py to tell web2py which apps have 
 app-specific routes.

 Anthony


 On Tuesday, May 21, 2013 10:01:41 AM UTC-4, Jurgis Pralgauskis wrote:

 but even app-specific routes must be specified outside app folder (in 
 web2py root)?


 On Tue, May 21, 2013 at 3:01 PM, Anthony abas...@gmail.com wrote:

 routes_onerror can specify app-specific routes.


 On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:

 I mean routes.py is in web2py root, not in app folder..


 On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis 
 jurgis.pr...@gmail.com wrote:

 but rootes are described per web2py, not per app..?


 On Tue, May 21, 2013 at 10:49 AM, Niphlod nip...@gmail.com wrote:

 there are routes to manage custom error pages.
 http://web2py.com/books/**defaul**t/chapter/29/04#Routes-**on-**
 errorhttp://web2py.com/books/default/chapter/29/04#Routes-on-error

 Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis 
 ha scritto:

 Hi, 

 clicking ticket link each time becomes frustrating (time wasting) 
 [SOLVED] :)

 I looked arround and tried example from http://www.dev-explorer.**
 com/articles/full-page-iframehttp://www.dev-explorer.com/articles/full-page-iframe
 you only need to escape % for sizing.
 my routes.py: 
 http://pastebin.**com/bfKYEhethttp://pastebin.com/bfKYEhet



  ps.: could error message be customized per app? 
 then I could include in my demo (skeleton) app for students - as 
 my students work through web interface (and I don't want to bother 
 them too 
 much with other issues)...

  -- 
  
 --- 
 You received this message because you are subscribed to a topic in 
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/*
 *to**pic/web2py/Qg1O99ojkdo/**unsubsc**ribe?hl=enhttps://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en
 .
  To unsubscribe from this group and all its topics, send an email 
 to web2py+un...@**googlegroups.com.

 For more options, visit https://groups.google.com/**grou**
 ps/opt_out https://groups.google.com/groups/opt_out.
  
  




 -- 
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt 




 -- 
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt 

  -- 
  
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/Qg1O99ojkdo/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  




 -- 
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt 

  -- 
  
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




 -- 
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt 



-- 

--- 
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] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-22 Thread Jurgis Pralgauskis
Thanks,

but still would be nicer - if defining in app would be enough (kind of KISS
style)
and maybe even without need to restart web2py (if just app level changes)?


On Tue, May 21, 2013 at 7:06 PM, Anthony abasta...@gmail.com wrote:

 You can app-specific routes in the app folder, but then you still need to
 specify routes_app in the root routes.py to tell web2py which apps have
 app-specific routes.

 Anthony


 On Tuesday, May 21, 2013 10:01:41 AM UTC-4, Jurgis Pralgauskis wrote:

 but even app-specific routes must be specified outside app folder (in
 web2py root)?


 On Tue, May 21, 2013 at 3:01 PM, Anthony abas...@gmail.com wrote:

 routes_onerror can specify app-specific routes.


 On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:

 I mean routes.py is in web2py root, not in app folder..


 On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis 
 jurgis.pr...@gmail.com wrote:

 but rootes are described per web2py, not per app..?


 On Tue, May 21, 2013 at 10:49 AM, Niphlod nip...@gmail.com wrote:

 there are routes to manage custom error pages.
 http://web2py.com/books/**defaul**t/chapter/29/04#Routes-**on-**errorhttp://web2py.com/books/default/chapter/29/04#Routes-on-error

 Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis
 ha scritto:

 Hi,

 clicking ticket link each time becomes frustrating (time wasting)
 [SOLVED] :)

 I looked arround and tried example from http://www.dev-explorer.**c*
 ***om/articles/full-page-iframehttp://www.dev-explorer.com/articles/full-page-iframe
 you only need to escape % for sizing.
 my routes.py: 
 http://pastebin.**com/bfKYEhethttp://pastebin.com/bfKYEhet



 ps.: could error message be customized per app?
 then I could include in my demo (skeleton) app for students - as my
 students work through web interface (and I don't want to bother them too
 much with other issues)...

  --

 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 to**pic/web2py/Qg1O99ojkdo/**unsubsc**ribe?hl=enhttps://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en
 .
  To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**grou**ps/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt




 --
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/Qg1O99ojkdo/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
Hi, 

clicking ticket link each time becomes frustrating (time wasting) [SOLVED] 
:)

I looked arround and tried example from 
http://www.dev-explorer.com/articles/full-page-iframe
you only need to escape % for sizing.
my routes.py: http://pastebin.com/bfKYEhet



ps.: could error message be customized per app? 
then I could include in my demo (skeleton) app for students - as my 
students work through web interface (and I don't want to bother them too 
much with other 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] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
but rootes are described per web2py, not per app..?


On Tue, May 21, 2013 at 10:49 AM, Niphlod niph...@gmail.com wrote:

 there are routes to manage custom error pages.
 http://web2py.com/books/default/chapter/29/04#Routes-on-error

 Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha
 scritto:

 Hi,

 clicking ticket link each time becomes frustrating (time wasting)
 [SOLVED] :)

 I looked arround and tried example from http://www.dev-explorer.**
 com/articles/full-page-iframehttp://www.dev-explorer.com/articles/full-page-iframe
 you only need to escape % for sizing.
 my routes.py: http://pastebin.**com/bfKYEhethttp://pastebin.com/bfKYEhet



 ps.: could error message be customized per app?
 then I could include in my demo (skeleton) app for students - as my
 students work through web interface (and I don't want to bother them too
 much with other issues)...

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
I mean routes.py is in web2py root, not in app folder..


On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis 
jurgis.pralgaus...@gmail.com wrote:

 but rootes are described per web2py, not per app..?


 On Tue, May 21, 2013 at 10:49 AM, Niphlod niph...@gmail.com wrote:

 there are routes to manage custom error pages.
 http://web2py.com/books/default/chapter/29/04#Routes-on-error

 Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha
 scritto:

 Hi,

 clicking ticket link each time becomes frustrating (time wasting)
 [SOLVED] :)

 I looked arround and tried example from http://www.dev-explorer.**
 com/articles/full-page-iframehttp://www.dev-explorer.com/articles/full-page-iframe
 you only need to escape % for sizing.
 my routes.py: http://pastebin.**com/bfKYEhethttp://pastebin.com/bfKYEhet



 ps.: could error message be customized per app?
 then I could include in my demo (skeleton) app for students - as my
 students work through web interface (and I don't want to bother them too
 much with other issues)...

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






 --
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt




-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
but even app-specific routes must be specified outside app folder (in
web2py root)?


On Tue, May 21, 2013 at 3:01 PM, Anthony abasta...@gmail.com wrote:

 routes_onerror can specify app-specific routes.


 On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:

 I mean routes.py is in web2py root, not in app folder..


 On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis 
 jurgis.pr...@gmail.com wrote:

 but rootes are described per web2py, not per app..?


 On Tue, May 21, 2013 at 10:49 AM, Niphlod nip...@gmail.com wrote:

 there are routes to manage custom error pages.
 http://web2py.com/books/**default/chapter/29/04#Routes-**on-errorhttp://web2py.com/books/default/chapter/29/04#Routes-on-error

 Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha
 scritto:

 Hi,

 clicking ticket link each time becomes frustrating (time wasting)
 [SOLVED] :)

 I looked arround and tried example from http://www.dev-explorer.**c**
 om/articles/full-page-iframehttp://www.dev-explorer.com/articles/full-page-iframe
 you only need to escape % for sizing.
 my routes.py: 
 http://pastebin.**com**/bfKYEhethttp://pastebin.com/bfKYEhet



 ps.: could error message be customized per app?
 then I could include in my demo (skeleton) app for students - as my
 students work through web interface (and I don't want to bother them too
 much with other issues)...

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/Qg1O99ojkdo/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt




 --
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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: Lazy_LOAD (with trigger binding)?

2013-05-19 Thread Jurgis Pralgauskis
one more nice thing would be to be able to 
reload divs with components (as if you were reloadin (i)frame)

the url could be stored in data attribute of the div..
and then just reload(target) :)

2013 m. balandis 15 d., pirmadienis 11:57:06 UTC+3, Niphlod rašė:

 it's not done yet but its on the roadmap: a more powerful web2py.js with 
 hookable events.

 On Monday, April 15, 2013 9:27:30 AM UTC+2, Jurgis Pralgauskis wrote:

 Hi, 

 in some cases it would be nice to have ajax LOAD on trigger/event instead 
 of onload...
 just adding some trigger_init_js  parameter/code ... which binds 
 web2py_component calling to the event.

 before doing it myselft, wanted to ask, maybe it is already done 

 -- 
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt 



-- 

--- 
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: REF: Displaying a Virtual Field in SQLFORM.grid throws an exception....

2013-05-08 Thread Jurgis Pralgauskis
By the way, 

I found 
http://www.web2py.com/book/default/chapter/06#before-and-after-callbacks

which can help in some cases, where I thought to use virtual fields

as with callbacks you can update needed info from foreign tables (or 
computed fields might also be enough in some cases)

2012 m. gruodis 18 d., antradienis 09:03:05 UTC+2, software.ted rašė:

 Does SQLFORM.grid support adding and display of a virtual field...am 
 getting an exception...my code:

 db.file_subject_issue.file_name = Field.Virtual(lambda row: 
 get_file_name(row.file_subject_issue.file_id))
 fields = [db.file_subject_issue.file_id, 
 db.file_subject_issue.date_created, db.file_subject_issue.file_name]
 query =

 form = SQLFORM.grid(query,fields=fields,...)

 I am getting the error

 type 'exceptions.AttributeError' 'FieldVirtual' object has no attribute 
 '_tablename'

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

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted

 exec ccode in environment
   File 
 /home/www-data/web2py/applications/intranet/controllers/administration.py 
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
  line 176, in module

   File /home/www-data/web2py/gluon/globals.py, line 188, in lambda

 self._caller = lambda f: f()

   File 
 /home/www-data/web2py/applications/intranet/controllers/administration.py 
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
  line 71, in file_track

 selectable=False,csv=False , paginate=20, user_signature=False)

   File /home/www-data/web2py/gluon/sqlhtml.py, line 1796, in grid

 if field._tablename in tablenames]
 AttributeError: 'FieldVirtual' object has no attribute '_tablename'




 -- 

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is 
 all - Thomas Carlyle 1795-1881

 /~
  

-- 

--- 
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] _after_delete callback - how to access info of deleted Set?

2013-05-08 Thread Jurgis Pralgauskis
Hi, 

I look at example:
http://www.web2py.com/book/default/chapter/06#before-and-after-callbacks

how can I find out what is the value of person.id from the set without 
select?
(Set (person.id = 1),)

as I tried:
s.select(..)[0]   # it worked for update
but got 

Traceback (most recent call last):
  File /home/nijole/Downloads/EasyVet/web2py/gluon/restricted.py, line 212, 
in restricted
exec ccode in environment
  File 
/home/nijole/Downloads/EasyVet/web2py/applications/apskaitele/controllers/appadmin.py
 http://localhost:8000/admin/default/edit/apskaitele/controllers/appadmin.py, 
line 569, in module
  File /home/nijole/Downloads/EasyVet/web2py/gluon/globals.py, line 194, in 
lambda
self._caller = lambda f: f()
  File 
/home/nijole/Downloads/EasyVet/web2py/applications/apskaitele/controllers/appadmin.py
 http://localhost:8000/admin/default/edit/apskaitele/controllers/appadmin.py, 
line 304, in update
if form.accepts(request.vars, session):
  File /home/nijole/Downloads/EasyVet/web2py/gluon/sqlhtml.py, line 1398, in 
accepts
self.table._db(qry).delete()
  File /home/nijole/Downloads/EasyVet/web2py/gluon/dal.py, line 9821, in 
delete
ret and [f(self) for f in table._after_delete]
  File 
/home/nijole/Downloads/EasyVet/web2py/applications/apskaitele/models/db.py 
http://localhost:8000/admin/default/edit/apskaitele/models/db.py, line 329, 
in lambda
db.Pardavimai._after_delete.append( lambda s: 
update_SandelioProduktai_likutis_from_Pardavimai(s.select(db.Pardavimai.sandelio_produktas)[0])
 )
  File /home/nijole/Downloads/EasyVet/web2py/gluon/dal.py, line 10075, in 
__getitem__
row = self.records[i]
IndexError: list index out of range



-- 

--- 
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] Re: _after_delete callback - how to access info of deleted Set?

2013-05-08 Thread Jurgis Pralgauskis
Thanks,

hm, ok, my usecase is more problematic,


db.define_table('Product',
Field('name',),
Field('price', 'decimal(10,2)'),
Field('quantity', 'integer'),
Field('*quantity_sold*', 'integer'), # this could be virtual - but then
it does not play with queries...
)

I want to refresh *quantity_sold* after each Purchase (insert/update/delete)
but after delete I'd like to still access which product it has been?
if I do it before delete, the purchace is still there - and my aggregate
function sums it (though I need it gone) ...

db.define_table('Purchase',
Field('product', db.Product),
Field('quantity', 'integer'),
)

def update_Product_quantity_from_Purchase( purchase ):
q_sum = db.Purchase.quantity.sum()
quantity_sold =
db(db.Purchase.product== purchase.product ).select(q_sum).first()[q_sum] or
0
   db.Product[purchase.product].update_record( *quantity_sold*
=quantity_sold )


db.Pardavimai._after_insert.append( lambda
f,id: update_Product_quantity_from_Purchase(f) )
db.Pardavimai._after_update.append( lambda
s,f: update_Product_quantity_from_Purchase(s.select()[0]) )
db.Pardavimai._after_delete.append( lambda
s: update_Product_quantity_from_Purchase(s.select()[0]) ) #ERR

***
Ha, while writing I came up with workaround -  _before_delete
I add extra parameter to my update_Product... function, which tells that
purchase stuff should be subtracted in advance (as it will be detelted)

def update_Product_quantity_from_Purchase( purchase, deleting=False ):
   ...
   if deleting:
quantity_sold -= purchace.quantity
   db.Product[purchase.product].update_record( *quantity_sold*=quantity_sold
 )

db.Pardavimai._before_delete.append( lambda
s: update_Product_quantity_from_Purchase(s.select()[0], True) ) #OK

***
ps.: Maybe similar functionality could be extended for compute'd field?
If it knew what foreign tablesfields it depends on, the triggers/callbacks
could be added automatically?




On Thu, May 9, 2013 at 2:06 AM, Anthony abasta...@gmail.com wrote:

 If the query only has that one condition, then you can do:

 s.query.second

 A Set object has a query attribute, which is a Query object, and a Query
 object has op, first, and second attributes. So, s.query gets the
 Query object of the Set, and s.query.second gets the second operand of the
 == operator. If instead you have multiple conditions in the query, keep
 in mind that the operands of the  operator are themselves Query objects.
 So, if you have:

 set = db((db.person.id  10)  (db.person.name.startswith('A')))

 you can extract the 10 from the first part of the query via:

 set.query.first.second

 In that case, set.query.first itself returns a Query (i.e., db.person.id 
 10), so set.query.first.second gives you the 10.

 Keep in mind that these properties of Set and Query are internal and not
 part of the API, so this isn't guaranteed to remain backward compatible.

 Another option is to pass the Set to the str() function, which generates a
 string that contains the SQL produced by the query. You could then do some
 parsing of that string to get what you want. For example, in this case you
 get:

  str(db(db.person.id == 1))
 'Set (person.id = 1)'

 You can use a regex to get the 1 from that string.

 Anthony


 On Wednesday, May 8, 2013 6:10:05 PM UTC-4, Jurgis Pralgauskis wrote:

 Hi,

 I look at example:
 http://www.web2py.com/book/**default/chapter/06#before-and-**
 after-callbackshttp://www.web2py.com/book/default/chapter/06#before-and-after-callbacks

 how can I find out what is the value of person.id from the set without
 select?
 (Set (person.id = 1),)

 as I tried:
 s.select(..)[0]   # it worked for update
 but got

 Traceback (most recent call last):
   File /home/nijole/Downloads/**EasyVet/web2py/gluon/**restricted.py, line 
 212, in restricted
 exec ccode in environment
   File 
 /home/nijole/Downloads/**EasyVet/web2py/applications/**apskaitele/controllers/**appadmin.py
  
 http://localhost:8000/admin/default/edit/apskaitele/controllers/appadmin.py,
  line 569, in module
   File /home/nijole/Downloads/**EasyVet/web2py/gluon/globals.**py, line 
 194, in lambda
 self._caller = lambda f: f()
   File 
 /home/nijole/Downloads/**EasyVet/web2py/applications/**apskaitele/controllers/**appadmin.py
  
 http://localhost:8000/admin/default/edit/apskaitele/controllers/appadmin.py,
  line 304, in update
 if form.accepts(request.vars, session):
   File /home/nijole/Downloads/**EasyVet/web2py/gluon/sqlhtml.**py, line 
 1398, in accepts
 self.table._db(qry).delete()
   File /home/nijole/Downloads/**EasyVet/web2py/gluon/dal.py, line 9821, in 
 delete
 ret and [f(self) for f in table._after_delete]
   File 
 /home/nijole/Downloads/**EasyVet/web2py/applications/**apskaitele/models/db.py
  http://localhost:8000/admin/default/edit/apskaitele/models/db.py, line 
 329, in lambda
 db.Pardavimai._after_delete.ap**pend( lambda s: 
 update_SandelioProduktai_**likutis_from_Pardavimai(s.sele**ct

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-05-02 Thread Jurgis Pralgauskis
try
pdf.write_html(font face='DejaVu'%s/font % html )


On Thu, May 2, 2013 at 9:34 AM, Martin Weissenboeck mweis...@gmail.comwrote:

 Hi,
 I have tried again to generate a pdf file from an htlm file with someunicode 
 characters.
 There is my test program. It's a simplified version, in the original
 program there is a lot of additional test lines.

 def pp():
 from gluon.contrib.pyfpdf import FPDF, HTMLMixin

 class MyFPDF(FPDF, HTMLMixin):
 def header(self): pass
 def footer(self): pass

 # create a small table with some data:
 rows = [THEAD(TR(TH(Key,_width=70%), TH(Value,_width=30%))),
 TBODY(TR(TD(Hello),TD(60)),
   TR(TD(World äöü éè €),TD(40)))]
 table = TABLE(*rows, _border=0, _align=center, _width=50%)

 pdf=MyFPDF()

 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf',  uni=True)
 pdf.add_page()
 pdf.set_font('DejaVu','',10) # set font method 1
 # table =TAG.font(table, _face=DejaVu)  # set font method 2
 html = str(XML(table, sanitize=False))
 pdf.write_html(html)
 response.headers['Content-Type'] = application/pdf
 return pdf.output(dest='S')

 I am sure that the font file is loaded, but it seems that the font is not
 used.
 I have tried two methods to change the font, but the results are the same.
 It doesn't look like Sanserif and every Unicode-Character is printed with
 every single utf-8 byte. Maybe it's only a small error, but I could not
 find it.


 Regards, Martin[image: Inline-Bild 3]


 2013/4/30 Jurgis Pralgauskis jurgis.pralgaus...@gmail.com

  Which font do you want to include?

 DejaVu - I guess it covers western languages.. (could be withouth
 bold/italics to save space)
 Another one could be for eastern chars (buy I don't know anything about
 them...)

  I gave you contributor access

 Thanks  :)


 On Wed, May 1, 2013 at 12:22 AM, Mariano Reingart reing...@gmail.comwrote:

 Which font do you want to include?

 The font pack is 15MB, I don't know if it could be included with web2py.
 Also, the problem is that no one is complete (you need several fonts
 to cover west / east languages)

 https://pyfpdf.googlecode.com/files/fpdf_unicode_font_pack.zip

 BTW, thanks for you comments, I gave you contributor access, so you
 can change the docs directly in the wiki if you like so:

 https://code.google.com/p/pyfpdf/w/list

 If you have any patch, also I'll be happy to review and include it ;-)

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Sun, Apr 28, 2013 at 7:40 AM, Jurgis Pralgauskis
 jurgis.pralgaus...@gmail.com wrote:
  by the way -- would it be possible to pack at least one ttf with
 web2py,
  and in normalize_text , when it notices unicode,
  automatically add (and set) default ttf font (if such is not set) to
 render
  ok ?
 
 
 
  On Sun, Apr 28, 2013 at 12:18 PM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
 
  SOLVED - the problem was that I needed to reload web2py -- for changed
  html.py to make effect ;)
 
  one more issue
  that after write_html(..)   it forgets the previously set font
 (should
  be at least mentioned in docs.. :)
  https://code.google.com/p/pyfpdf/issues/detail?id=54#c2
 
 
 
 
  On Sat, Apr 27, 2013 at 9:06 PM, Mariano Reingart reing...@gmail.com
 
  wrote:
 
  Did you add the TTF unicode font with add_font?
  Can you post a complete example (ie a script.py just with the code to
  test), so I can reproduce it easily.
 
  Best regards,
 
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com
 
 
  On Sat, Apr 27, 2013 at 7:30 AM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
   I see 2 lines were changed, the main
  
   - if 'face' in attrs and attrs['face'].lower() in self.font_list:
   +   if 'face' in attrs:
  
   but I still get
  
  
 File
  
 /home/jurgis/web2py/applications/apskaitele/controllers/default.py,
   line 61, in pdftest
  
  
   pdf.write_html(ufont face='DejaVu'Ąžuolas/font
   )
  
  
   File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in
   write_html
  
 File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
  
   self.goahead(0)
 File /usr/local/lib/python2.7/HTMLParser.py, line 152, in
 goahead
  
   if i  j: self.handle_data(rawdata[i:j])
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122,
 in
   handle_data
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822,
 in
   write
  
   txt = self.normalize_text(txt)
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line
 1012, in
   normalize_text
  
   txt = txt.encode('latin1')
  
   UnicodeEncodeError: 'latin-1' codec can't encode characters in
 position
   0-1:
   ordinal not in range(256
   )
  
  
  
   and if I
   pdf.write_html(ufont
 face='DejaVu'Ąžuolas/font.encode('utf8'))
  
   I get Ä„Å3⁄4uolas
  
  
  
  
   On Sat, Apr 27, 2013 at 3:24 AM, Mariano Reingart

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-05-02 Thread Jurgis Pralgauskis
by the way, not sure, if there is need to write
uWorld äöü éè €
or just World äöü éè €

seems, both work


On Thu, May 2, 2013 at 3:00 PM, Martin Weissenboeck mweis...@gmail.comwrote:

 Some hours  later...
 Now I have tried to use the Arial-font:

 pdf.set_font('Arial','',10)

 There is always the same font - set_font seems to do nothing.





 2013/5/2 Martin Weissenboeck mweis...@gmail.com

 Hi,
 I have tried again to generate a pdf file from an htlm file with someunicode 
 characters.
 There is my test program. It's a simplified version, in the original
 program there is a lot of additional test lines.

 def pp():
 from gluon.contrib.pyfpdf import FPDF, HTMLMixin

 class MyFPDF(FPDF, HTMLMixin):
 def header(self): pass
 def footer(self): pass

 # create a small table with some data:
 rows = [THEAD(TR(TH(Key,_width=70%), TH(Value,_width=30%))),
 TBODY(TR(TD(Hello),TD(60)),
   TR(TD(World äöü éè €),TD(40)))]
 table = TABLE(*rows, _border=0, _align=center, _width=50%)

 pdf=MyFPDF()

 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf',  uni=True)
 pdf.add_page()
 pdf.set_font('DejaVu','',10) # set font method 1
 # table =TAG.font(table, _face=DejaVu)  # set font method 2
 html = str(XML(table, sanitize=False))
 pdf.write_html(html)
 response.headers['Content-Type'] = application/pdf
 return pdf.output(dest='S')

 I am sure that the font file is loaded, but it seems that the font is
 not used.
 I have tried two methods to change the font, but the results are the
 same.
 It doesn't look like Sanserif and every Unicode-Character is printed with
 every single utf-8 byte. Maybe it's only a small error, but I could not
 find it.


 Regards, Martin[image: Inline-Bild 3]


 2013/4/30 Jurgis Pralgauskis jurgis.pralgaus...@gmail.com

  Which font do you want to include?

 DejaVu - I guess it covers western languages.. (could be withouth
 bold/italics to save space)
 Another one could be for eastern chars (buy I don't know anything about
 them...)

  I gave you contributor access

 Thanks  :)


 On Wed, May 1, 2013 at 12:22 AM, Mariano Reingart reing...@gmail.comwrote:

 Which font do you want to include?

 The font pack is 15MB, I don't know if it could be included with web2py.
 Also, the problem is that no one is complete (you need several fonts
 to cover west / east languages)

 https://pyfpdf.googlecode.com/files/fpdf_unicode_font_pack.zip

 BTW, thanks for you comments, I gave you contributor access, so you
 can change the docs directly in the wiki if you like so:

 https://code.google.com/p/pyfpdf/w/list

 If you have any patch, also I'll be happy to review and include it ;-)

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Sun, Apr 28, 2013 at 7:40 AM, Jurgis Pralgauskis
 jurgis.pralgaus...@gmail.com wrote:
  by the way -- would it be possible to pack at least one ttf with
 web2py,
  and in normalize_text , when it notices unicode,
  automatically add (and set) default ttf font (if such is not set) to
 render
  ok ?
 
 
 
  On Sun, Apr 28, 2013 at 12:18 PM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
 
  SOLVED - the problem was that I needed to reload web2py -- for
 changed
  html.py to make effect ;)
 
  one more issue
  that after write_html(..)   it forgets the previously set font
 (should
  be at least mentioned in docs.. :)
  https://code.google.com/p/pyfpdf/issues/detail?id=54#c2
 
 
 
 
  On Sat, Apr 27, 2013 at 9:06 PM, Mariano Reingart 
 reing...@gmail.com
  wrote:
 
  Did you add the TTF unicode font with add_font?
  Can you post a complete example (ie a script.py just with the code
 to
  test), so I can reproduce it easily.
 
  Best regards,
 
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com
 
 
  On Sat, Apr 27, 2013 at 7:30 AM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
   I see 2 lines were changed, the main
  
   - if 'face' in attrs and attrs['face'].lower() in self.font_list:
   +   if 'face' in attrs:
  
   but I still get
  
  
 File
  
 /home/jurgis/web2py/applications/apskaitele/controllers/default.py,
   line 61, in pdftest
  
  
   pdf.write_html(ufont face='DejaVu'Ąžuolas/font
   )
  
  
   File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397,
 in
   write_html
  
 File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
  
   self.goahead(0)
 File /usr/local/lib/python2.7/HTMLParser.py, line 152, in
 goahead
  
   if i  j: self.handle_data(rawdata[i:j])
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line
 122, in
   handle_data
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line
 822, in
   write
  
   txt = self.normalize_text(txt)
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line
 1012, in
   normalize_text
  
   txt = txt.encode('latin1')
  
   UnicodeEncodeError

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-04-30 Thread Jurgis Pralgauskis
 Which font do you want to include?

DejaVu - I guess it covers western languages.. (could be withouth
bold/italics to save space)
Another one could be for eastern chars (buy I don't know anything about
them...)

 I gave you contributor access

Thanks  :)


On Wed, May 1, 2013 at 12:22 AM, Mariano Reingart reing...@gmail.comwrote:

 Which font do you want to include?

 The font pack is 15MB, I don't know if it could be included with web2py.
 Also, the problem is that no one is complete (you need several fonts
 to cover west / east languages)

 https://pyfpdf.googlecode.com/files/fpdf_unicode_font_pack.zip

 BTW, thanks for you comments, I gave you contributor access, so you
 can change the docs directly in the wiki if you like so:

 https://code.google.com/p/pyfpdf/w/list

 If you have any patch, also I'll be happy to review and include it ;-)

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Sun, Apr 28, 2013 at 7:40 AM, Jurgis Pralgauskis
 jurgis.pralgaus...@gmail.com wrote:
  by the way -- would it be possible to pack at least one ttf with web2py,
  and in normalize_text , when it notices unicode,
  automatically add (and set) default ttf font (if such is not set) to
 render
  ok ?
 
 
 
  On Sun, Apr 28, 2013 at 12:18 PM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
 
  SOLVED - the problem was that I needed to reload web2py -- for changed
  html.py to make effect ;)
 
  one more issue
  that after write_html(..)   it forgets the previously set font (should
  be at least mentioned in docs.. :)
  https://code.google.com/p/pyfpdf/issues/detail?id=54#c2
 
 
 
 
  On Sat, Apr 27, 2013 at 9:06 PM, Mariano Reingart reing...@gmail.com
  wrote:
 
  Did you add the TTF unicode font with add_font?
  Can you post a complete example (ie a script.py just with the code to
  test), so I can reproduce it easily.
 
  Best regards,
 
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com
 
 
  On Sat, Apr 27, 2013 at 7:30 AM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
   I see 2 lines were changed, the main
  
   - if 'face' in attrs and attrs['face'].lower() in self.font_list:
   +   if 'face' in attrs:
  
   but I still get
  
  
 File
   /home/jurgis/web2py/applications/apskaitele/controllers/default.py,
   line 61, in pdftest
  
  
   pdf.write_html(ufont face='DejaVu'Ąžuolas/font
   )
  
  
   File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in
   write_html
  
 File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
  
   self.goahead(0)
 File /usr/local/lib/python2.7/HTMLParser.py, line 152, in goahead
  
   if i  j: self.handle_data(rawdata[i:j])
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122, in
   handle_data
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822, in
   write
  
   txt = self.normalize_text(txt)
  
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 1012,
 in
   normalize_text
  
   txt = txt.encode('latin1')
  
   UnicodeEncodeError: 'latin-1' codec can't encode characters in
 position
   0-1:
   ordinal not in range(256
   )
  
  
  
   and if I
   pdf.write_html(ufont face='DejaVu'Ąžuolas/font.encode('utf8'))
  
   I get Ä„Å3⁄4uolas
  
  
  
  
   On Sat, Apr 27, 2013 at 3:24 AM, Mariano Reingart 
 reing...@gmail.com
   wrote:
  
   Sorry, I misread the email.
  
   Unicode fonts were not supported in html2pdf.
  
   I've made a change to allow them, please update html.py:
  
   https://pyfpdf.googlecode.com/hg/fpdf/html.py
  
   Then, you need to load a ttf unicode font, and then pass it in
 font
   face attribute:
  
   pdf=MyFPDF()
   # add utf8 font
   pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
   # first page:
   pdf.add_page()
   pdf.write_html(ufont face='DejaVu'Ąžuolas/font)
  
   For more info and complete code, see:
  
   https://code.google.com/p/pyfpdf/wiki/Web2Py
  
   Let me know if that works so I can update the docs and web2py
 contrib
   version
  
   Best regards
   Mariano Reingart
   http://www.sistemasagiles.com.ar
   http://reingart.blogspot.com
  
  
   On Fri, Apr 26, 2013 at 11:45 PM, Mariano Reingart
   reing...@gmail.com
   wrote:
On Fri, Apr 26, 2013 at 11:42 PM, Mariano Reingart
reing...@gmail.com
wrote:
On Fri, Apr 26, 2013 at 6:34 PM, Jonathan Lundell
jlund...@pobox.com
wrote:
On 26 Apr 2013, at 1:17 PM, Jurgis Pralgauskis
jurgis.pralgaus...@gmail.com wrote:
   
ok, SOLVED ttf issue for  unicode example
http://code.google.com/p/pyfpdf/wiki/Unicode
just needed to create directorygluon  contrib  fpdf  font
and place needed ttf files insited it :)
then pdf.write(8, uĄžuolas)  works fine
   
   
The fpdf logic uses utf8 for fonts it sees as UTF-based,
 otherwise
latin-1.
It looks to me as though either it isn't recognizing your fonts
 as
UTF, or
there's some

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-04-28 Thread Jurgis Pralgauskis
SOLVED - the problem was that I needed to reload web2py -- for changed
html.py to make effect ;)

one more issue
that after write_html(..)   it forgets the previously set font (should be
at least mentioned in docs.. :)
https://code.google.com/p/pyfpdf/issues/detail?id=54#c2




On Sat, Apr 27, 2013 at 9:06 PM, Mariano Reingart reing...@gmail.comwrote:

 Did you add the TTF unicode font with add_font?
 Can you post a complete example (ie a script.py just with the code to
 test), so I can reproduce it easily.

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Sat, Apr 27, 2013 at 7:30 AM, Jurgis Pralgauskis
 jurgis.pralgaus...@gmail.com wrote:
  I see 2 lines were changed, the main
 
  - if 'face' in attrs and attrs['face'].lower() in self.font_list:
  +   if 'face' in attrs:
 
  but I still get
 
 
File
 /home/jurgis/web2py/applications/apskaitele/controllers/default.py,
  line 61, in pdftest
 
 
  pdf.write_html(ufont face='DejaVu'Ąžuolas/font
  )
 
 
  File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in
  write_html
 
File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
 
  self.goahead(0)
File /usr/local/lib/python2.7/HTMLParser.py, line 152, in goahead
 
  if i  j: self.handle_data(rawdata[i:j])
 
File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122, in
  handle_data
 
File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822, in
 write
 
  txt = self.normalize_text(txt)
 
File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 1012, in
  normalize_text
 
  txt = txt.encode('latin1')
 
  UnicodeEncodeError: 'latin-1' codec can't encode characters in position
 0-1:
  ordinal not in range(256
  )
 
 
 
  and if I
  pdf.write_html(ufont face='DejaVu'Ąžuolas/font.encode('utf8'))
 
  I get Ä„Å3⁄4uolas
 
 
 
 
  On Sat, Apr 27, 2013 at 3:24 AM, Mariano Reingart reing...@gmail.com
  wrote:
 
  Sorry, I misread the email.
 
  Unicode fonts were not supported in html2pdf.
 
  I've made a change to allow them, please update html.py:
 
  https://pyfpdf.googlecode.com/hg/fpdf/html.py
 
  Then, you need to load a ttf unicode font, and then pass it in font
  face attribute:
 
  pdf=MyFPDF()
  # add utf8 font
  pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
  # first page:
  pdf.add_page()
  pdf.write_html(ufont face='DejaVu'Ąžuolas/font)
 
  For more info and complete code, see:
 
  https://code.google.com/p/pyfpdf/wiki/Web2Py
 
  Let me know if that works so I can update the docs and web2py contrib
  version
 
  Best regards
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com
 
 
  On Fri, Apr 26, 2013 at 11:45 PM, Mariano Reingart reing...@gmail.com
  wrote:
   On Fri, Apr 26, 2013 at 11:42 PM, Mariano Reingart 
 reing...@gmail.com
   wrote:
   On Fri, Apr 26, 2013 at 6:34 PM, Jonathan Lundell 
 jlund...@pobox.com
   wrote:
   On 26 Apr 2013, at 1:17 PM, Jurgis Pralgauskis
   jurgis.pralgaus...@gmail.com wrote:
  
   ok, SOLVED ttf issue for  unicode example
   http://code.google.com/p/pyfpdf/wiki/Unicode
   just needed to create directorygluon  contrib  fpdf  font
   and place needed ttf files insited it :)
   then pdf.write(8, uĄžuolas)  works fine
  
  
   The fpdf logic uses utf8 for fonts it sees as UTF-based, otherwise
   latin-1.
   It looks to me as though either it isn't recognizing your fonts as
   UTF, or
   there's some overlooked case that it's making a mistake with. Have a
   look at
   FPDF.set_font:
  
   self.unifontsubset = (self.fonts[fontkey]['type'] == 'TTF')
  
   ...and make sure it's getting set.
  
  
   Yes, as Jhonatan saids, FPDF (and the PDF standard, BTW) only support
   latin1 characters for standard font.
  
   If you need utf8 characters, you need to embeed a T
  
   You need to embed a UTF8 TTF font, for example:
  
   # Add a DejaVu Unicode font (uses UTF-8)
   # Supports more than 200 languages. For a coverage status see:
   #
  
 http://dejavu.svn.sourceforge.net/viewvc/dejavu/trunk/dejavu-fonts/langcover.txt
   pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
  
   (sorry, the previous message was sent incomplete)
  
   I'll try to enhance the docs about this, thank for reporting the issue
  
   Best regards
  
   Mariano Reingart
   http://www.sistemasagiles.com.ar
   http://reingart.blogspot.com
 
  --
 
  ---
  You received this message because you are subscribed to a topic in the
  Google Groups web2py-users group.
  To unsubscribe from this topic, visit
  https://groups.google.com/d/topic/web2py/KJDeQoLKw-M/unsubscribe?hl=en.
  To unsubscribe from this group and all its topics, send an email to
  web2py+unsubscr...@googlegroups.com.
 
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
 
  --
  Jurgis Pralgauskis
  tel: 8-616 77613;
  Don't worry, be happy and make things better ;)
  http://galvosukykla.lt
 
  --
 
  ---
  You received

Re: [web2py] pyfPDF templates and unicode element values?

2013-04-28 Thread Jurgis Pralgauskis
I used template.py invoice example,
but in invoice.csv I tried to change all 'Arial' -- 'DejaVu'

f.parse_csv(infile=_invoice.csv, delimiter=;, decimal_sep=,)
f.pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
f.pdf.add_font('DejaVu', 'B', 'DejaVuSans-Bold.ttf', uni=True)


and the problem was caused by '\xba'
'document_number';'T';115.30;27.80;125.30;33.30;'DejaVu';14.00;1;0;0;0;0;'I';'N\xba:
';2

***

another issue is in class Template
def __setitem__(self, name, value):
...
if isinstance(value,unicode):
value = value.encode(latin1,ignore)

so   uSample ĄČĘĖŠŲ product   will show onlySample  product '
but  Sample ĄČĘĖŠŲ product   will show   Sample ĄČĘĖŠŲ  product '  ... :)


***
ps.: in template.py there was also
if font == 'arial black':
font = 'arial'

which could be generalized (for DejaVu or other)
if font.lower().endswith( black):
font=font[:-len( black)].strip()





On Sat, Apr 27, 2013 at 9:12 PM, Mariano Reingart reing...@gmail.comwrote:

 Please, can you attach a minimal script to reproduce this?

 You should pass unicodes when using utf8, do not pass strings with
 .encode('utf8')
 (using utf8 fonts you can avoid the if isinstance(text, unicode):
 block completely)

 Yes unicode python support is hard to master, luckily in py3k it is a bit
 easier

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Sat, Apr 27, 2013 at 12:37 AM, Jurgis Pralgauskis
 jurgis.pralgaus...@gmail.com wrote:
  Hi,
 
  I tried to combine ideas from
 http://code.google.com/p/pyfpdf/wiki/Templates
  and http://code.google.com/p/pyfpdf/wiki/Unicode
 
  but not much luck... encodings were always hard for me...
 
  I can insert unicode via direct write ok,
 
  but if I try to insert it via cell/multicell, I get stuck ...
 
  I changed file encoding of template.py
  and also replaced
  if isinstance(text, unicode):
  #~ text = text.encode(latin1,ignore)
  text = text.encode('utf8')
 
  and explicitly changed all set_font to:
  #~ pdf.set_font(font,style,size)
  pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf',
 uni=True)
  pdf.set_font('DejaVu','',size)
 
  but then I get:
 
  Traceback (most recent call last):
File unicode_template.py, line 321, in module
  f.render(./invoice.pdf)
File unicode_template.py, line 135, in render
  self.handlers[element['type'].upper()](pdf, **element)
File unicode_template.py, line 172, in text
  pdf.cell(w=x2-x1,h=y2-y1,txt=text,border=0,ln=0,align=align)
File /home/nijole/Downloads/pyfpdf/fpdf/fpdf.py, line 632, in cell
  txt = self.normalize_text(txt)
File /home/nijole/Downloads/pyfpdf/fpdf/fpdf.py, line 1043, in
  normalize_text
  txt = txt.decode('utf8')
File /usr/lib/python2.7/encodings/utf_8.py, line 16, in decode
  return codecs.utf_8_decode(input, errors, True)
  UnicodeDecodeError: 'utf8' codec can't decode byte 0xba in position 1:
  invalid start byte
 
  --
 
  ---
  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.
 
 

 --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/iAkD3YFuDWg/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Solved -- Problems with special characters and pyfpdf

2013-04-28 Thread Jurgis Pralgauskis
by the way -- would it be possible to pack at least one ttf with web2py,
and in normalize_text , when it notices unicode,
automatically add (and set) default ttf font (if such is not set) to render
ok ?



On Sun, Apr 28, 2013 at 12:18 PM, Jurgis Pralgauskis 
jurgis.pralgaus...@gmail.com wrote:

 SOLVED - the problem was that I needed to reload web2py -- for changed
 html.py to make effect ;)

 one more issue
 that after write_html(..)   it forgets the previously set font (should
 be at least mentioned in docs.. :)
 https://code.google.com/p/pyfpdf/issues/detail?id=54#c2




 On Sat, Apr 27, 2013 at 9:06 PM, Mariano Reingart reing...@gmail.comwrote:

 Did you add the TTF unicode font with add_font?
 Can you post a complete example (ie a script.py just with the code to
 test), so I can reproduce it easily.

 Best regards,

 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Sat, Apr 27, 2013 at 7:30 AM, Jurgis Pralgauskis
 jurgis.pralgaus...@gmail.com wrote:
  I see 2 lines were changed, the main
 
  - if 'face' in attrs and attrs['face'].lower() in self.font_list:
  +   if 'face' in attrs:
 
  but I still get
 
 
File
 /home/jurgis/web2py/applications/apskaitele/controllers/default.py,
  line 61, in pdftest
 
 
  pdf.write_html(ufont face='DejaVu'Ąžuolas/font
  )
 
 
  File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in
  write_html
 
File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
 
  self.goahead(0)
File /usr/local/lib/python2.7/HTMLParser.py, line 152, in goahead
 
  if i  j: self.handle_data(rawdata[i:j])
 
File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122, in
  handle_data
 
File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822, in
 write
 
  txt = self.normalize_text(txt)
 
File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 1012, in
  normalize_text
 
  txt = txt.encode('latin1')
 
  UnicodeEncodeError: 'latin-1' codec can't encode characters in position
 0-1:
  ordinal not in range(256
  )
 
 
 
  and if I
  pdf.write_html(ufont face='DejaVu'Ąžuolas/font.encode('utf8'))
 
  I get Ä„Å3⁄4uolas
 
 
 
 
  On Sat, Apr 27, 2013 at 3:24 AM, Mariano Reingart reing...@gmail.com
  wrote:
 
  Sorry, I misread the email.
 
  Unicode fonts were not supported in html2pdf.
 
  I've made a change to allow them, please update html.py:
 
  https://pyfpdf.googlecode.com/hg/fpdf/html.py
 
  Then, you need to load a ttf unicode font, and then pass it in font
  face attribute:
 
  pdf=MyFPDF()
  # add utf8 font
  pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
  # first page:
  pdf.add_page()
  pdf.write_html(ufont face='DejaVu'Ąžuolas/font)
 
  For more info and complete code, see:
 
  https://code.google.com/p/pyfpdf/wiki/Web2Py
 
  Let me know if that works so I can update the docs and web2py contrib
  version
 
  Best regards
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com
 
 
  On Fri, Apr 26, 2013 at 11:45 PM, Mariano Reingart reing...@gmail.com
 
  wrote:
   On Fri, Apr 26, 2013 at 11:42 PM, Mariano Reingart 
 reing...@gmail.com
   wrote:
   On Fri, Apr 26, 2013 at 6:34 PM, Jonathan Lundell 
 jlund...@pobox.com
   wrote:
   On 26 Apr 2013, at 1:17 PM, Jurgis Pralgauskis
   jurgis.pralgaus...@gmail.com wrote:
  
   ok, SOLVED ttf issue for  unicode example
   http://code.google.com/p/pyfpdf/wiki/Unicode
   just needed to create directorygluon  contrib  fpdf  font
   and place needed ttf files insited it :)
   then pdf.write(8, uĄžuolas)  works fine
  
  
   The fpdf logic uses utf8 for fonts it sees as UTF-based, otherwise
   latin-1.
   It looks to me as though either it isn't recognizing your fonts as
   UTF, or
   there's some overlooked case that it's making a mistake with. Have
 a
   look at
   FPDF.set_font:
  
   self.unifontsubset = (self.fonts[fontkey]['type'] == 'TTF')
  
   ...and make sure it's getting set.
  
  
   Yes, as Jhonatan saids, FPDF (and the PDF standard, BTW) only
 support
   latin1 characters for standard font.
  
   If you need utf8 characters, you need to embeed a T
  
   You need to embed a UTF8 TTF font, for example:
  
   # Add a DejaVu Unicode font (uses UTF-8)
   # Supports more than 200 languages. For a coverage status see:
   #
  
 http://dejavu.svn.sourceforge.net/viewvc/dejavu/trunk/dejavu-fonts/langcover.txt
   pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
  
   (sorry, the previous message was sent incomplete)
  
   I'll try to enhance the docs about this, thank for reporting the
 issue
  
   Best regards
  
   Mariano Reingart
   http://www.sistemasagiles.com.ar
   http://reingart.blogspot.com
 
  --
 
  ---
  You received this message because you are subscribed to a topic in the
  Google Groups web2py-users group.
  To unsubscribe from this topic, visit
  https://groups.google.com/d/topic/web2py/KJDeQoLKw-M/unsubscribe?hl=en
 .
  To unsubscribe from

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-04-27 Thread Jurgis Pralgauskis
I see 2 lines were changed, the main

- if 'face' in attrs and attrs['face'].lower() in self.font_list:
+   if 'face' in attrs:

but I still get


  File /home/jurgis/web2py/applications/apskaitele/controllers/default.py
https://jurgis.pythonanywhere.com/admin/default/edit/apskaitele/controllers/default.py,
line 61, in pdftest
pdf.write_html(ufont face='DejaVu'Ąžuolas/font)
  File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in write_html
  File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
self.goahead(0)
  File /usr/local/lib/python2.7/HTMLParser.py, line 152, in goahead
if i  j: self.handle_data(rawdata[i:j])
  File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122, in
handle_data
  File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822, in write
txt = self.normalize_text(txt)
  File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 1012, in
normalize_text
txt = txt.encode('latin1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in
position 0-1: ordinal not in range(256)


and if I
pdf.write_html(ufont face='DejaVu'Ąžuolas/font.encode('utf8'))

I get Ä„Å3⁄4uolas




On Sat, Apr 27, 2013 at 3:24 AM, Mariano Reingart reing...@gmail.comwrote:

 Sorry, I misread the email.

 Unicode fonts were not supported in html2pdf.

 I've made a change to allow them, please update html.py:

 https://pyfpdf.googlecode.com/hg/fpdf/html.py

 Then, you need to load a ttf unicode font, and then pass it in font
 face attribute:

 pdf=MyFPDF()
 # add utf8 font
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
 # first page:
 pdf.add_page()
 pdf.write_html(ufont face='DejaVu'Ąžuolas/font)

 For more info and complete code, see:

 https://code.google.com/p/pyfpdf/wiki/Web2Py

 Let me know if that works so I can update the docs and web2py contrib
 version

 Best regards
 Mariano Reingart
 http://www.sistemasagiles.com.ar
 http://reingart.blogspot.com


 On Fri, Apr 26, 2013 at 11:45 PM, Mariano Reingart reing...@gmail.com
 wrote:
  On Fri, Apr 26, 2013 at 11:42 PM, Mariano Reingart reing...@gmail.com
 wrote:
  On Fri, Apr 26, 2013 at 6:34 PM, Jonathan Lundell jlund...@pobox.com
 wrote:
  On 26 Apr 2013, at 1:17 PM, Jurgis Pralgauskis
  jurgis.pralgaus...@gmail.com wrote:
 
  ok, SOLVED ttf issue for  unicode example
  http://code.google.com/p/pyfpdf/wiki/Unicode
  just needed to create directorygluon  contrib  fpdf  font
  and place needed ttf files insited it :)
  then pdf.write(8, uĄžuolas)  works fine
 
 
  The fpdf logic uses utf8 for fonts it sees as UTF-based, otherwise
 latin-1.
  It looks to me as though either it isn't recognizing your fonts as
 UTF, or
  there's some overlooked case that it's making a mistake with. Have a
 look at
  FPDF.set_font:
 
  self.unifontsubset = (self.fonts[fontkey]['type'] == 'TTF')
 
  ...and make sure it's getting set.
 
 
  Yes, as Jhonatan saids, FPDF (and the PDF standard, BTW) only support
  latin1 characters for standard font.
 
  If you need utf8 characters, you need to embeed a T
 
  You need to embed a UTF8 TTF font, for example:
 
  # Add a DejaVu Unicode font (uses UTF-8)
  # Supports more than 200 languages. For a coverage status see:
  #
 http://dejavu.svn.sourceforge.net/viewvc/dejavu/trunk/dejavu-fonts/langcover.txt
  pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
 
  (sorry, the previous message was sent incomplete)
 
  I'll try to enhance the docs about this, thank for reporting the issue
 
  Best regards
 
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com

 --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/KJDeQoLKw-M/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Fwd: Solved -- Problems with special characters and pyfpdf

2013-04-26 Thread Jurgis Pralgauskis
Hi, 

but this seems to work not for all unicode characters
like if I have Ąžuolas

uĄžuolas.encode('iso-8859-1')   gives error :/

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: 
ordinal not in range(256)


2011 m. balandis 29 d., penktadienis 06:35:40 UTC+3, Alexandre Andrade rašė:

 The same can be converted to a function, to make it easier:

 def lt(str):
 return unicode(str,'utf-8').encode('iso-8859-1')


 so just 

 pdf.cell(50,20,lt('Helló Wórld'), 0,2,'L') 

 2011/4/29 Christopher Steel chris...@gmail.com javascript:


 This solution works well. You will need to make a minor correction and
 remove the single quotes around 'txt' in the second line. The edited
 version looks like this:

txt = 'Hélló wórld'
utxt = unicode(txt, 'utf-8')
stxt = utxt.encode('iso-8859-1')
pdf.cell(50,20, stxt, 0, 2, 'L')


 Thanks for the hint Bernardo!

 C.


 -- Forwarded message --
 From: Bernardo estem...@gmail.com
 Date: Sep 25 2010, 7:35 am
 Subject: Solved -- Problems with special characters and pyfpdf
 To: web2py-users


 Hi all,

 When usingpyfpdfwhich comes with web2py framework, there are some
 issues withspecialcharacterssuch as accentedcharacters(á, é,
 í, ...). After some research, I found out thatpyfpdfjust understands
 'iso-8859-1', and web2py gives him the strings in 'utf-8' format.

 So, as a solution, in your python code you just have to convert the
 string before passing it topyfpdf, like this:

 txt = 'Hélló wórld'
 utxt = unicode('txt', 'utf-8')
 stxt = utxt.encode('iso-8859-1')
 pdf.cell(50,20, stxt, 0, 2, 'L')

 If anyone has any doubts, just ask. I hope this can help someone...

 kind regards,
 Bernardo




 -- 
 Atenciosamente


 Alexandre Andrade
 Hipercenter.com Classificados Gratuitos
  

-- 

--- 
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] Fwd: Solved -- Problems with special characters and pyfpdf

2013-04-26 Thread Jurgis Pralgauskis
ok, SOLVED ttf issue for  unicode example 
http://code.google.com/p/pyfpdf/wiki/Unicode
just needed to create directorygluon  contrib  fpdf  font
and place needed ttf files insited it :)
then pdf.write(8, uĄžuolas)  works fine 

BUT - how to make it work with write_html(...) ?

write_html( str(P( uĄžuolas ))  #  produces Ąžuolas  

pdf.write_html( u'Ąžuolas'.encode('utf8') )  # also  Ąžuolas  

pdf.write_html( u'Ąžuolas' )   gives error

File 
/home/jurgis/web2py/applications/apskaitele/controllers/default.pyhttps://jurgis.pythonanywhere.com/admin/default/edit/apskaitele/controllers/default.py,
 
line 59, in pdftest
pdf.write_html( u'Ąžuolas' )
File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in 
write_html
h2p.feed(text)
File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
self.goahead(0)
File /usr/local/lib/python2.7/HTMLParser.py, line 152, in goahead
if i  j: self.handle_data(rawdata[i:j])
File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122, in 
handle_data
self.pdf.write(self.h,txt)
File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822, in write
txt = self.normalize_text(txt)
File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 1012, in 
normalize_text
txt = txt.encode('latin1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: 
ordinal not in range(256)

pdf.write_html( u'Ąžuolas'.decode('utf8') )

2013 m. balandis 26 d., penktadienis 22:03:41 UTC+3, Jurgis Pralgauskis 
rašė:

 Hi, 

 but this seems to work not for all unicode characters
 like if I have Ąžuolas

 uĄžuolas.encode('iso-8859-1')   gives error :/

 UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: 
 ordinal not in range(256)


 I also posted on hosting forum looking for TTF solution
  https://www.pythonanywhere.com/forums/topic/602/#id_post_4362

 2011 m. balandis 29 d., penktadienis 06:35:40 UTC+3, Alexandre Andrade 
 rašė:

 The same can be converted to a function, to make it easier:

 def lt(str):
 return unicode(str,'utf-8').encode('iso-8859-1')


 so just 

 pdf.cell(50,20,lt('Helló Wórld'), 0,2,'L') 

 2011/4/29 Christopher Steel chris...@gmail.com


 This solution works well. You will need to make a minor correction and
 remove the single quotes around 'txt' in the second line. The edited
 version looks like this:

txt = 'Hélló wórld'
utxt = unicode(txt, 'utf-8')
stxt = utxt.encode('iso-8859-1')
pdf.cell(50,20, stxt, 0, 2, 'L')


 Thanks for the hint Bernardo!

 C.


 -- Forwarded message --
 From: Bernardo estem...@gmail.com
 Date: Sep 25 2010, 7:35 am
 Subject: Solved -- Problems with special characters and pyfpdf
 To: web2py-users


 Hi all,

 When usingpyfpdfwhich comes with web2py framework, there are some
 issues withspecialcharacterssuch as accentedcharacters(á, é,
 í, ...). After some research, I found out thatpyfpdfjust understands
 'iso-8859-1', and web2py gives him the strings in 'utf-8' format.

 So, as a solution, in your python code you just have to convert the
 string before passing it topyfpdf, like this:

 txt = 'Hélló wórld'
 utxt = unicode('txt', 'utf-8')
 stxt = utxt.encode('iso-8859-1')
 pdf.cell(50,20, stxt, 0, 2, 'L')

 If anyone has any doubts, just ask. I hope this can help someone...

 kind regards,
 Bernardo




 -- 
 Atenciosamente


 Alexandre Andrade
 Hipercenter.com Classificados Gratuitos
  


-- 

--- 
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] Fwd: Solved -- Problems with special characters and pyfpdf

2013-04-26 Thread Jurgis Pralgauskis
also posted issue on pyfpdf site 
http://code.google.com/p/pyfpdf/issues/detail?id=54thanks=54ts=1367007819

2013 m. balandis 26 d., penktadienis 23:17:41 UTC+3, Jurgis Pralgauskis 
rašė:

 ok, SOLVED ttf issue for  unicode example 
 http://code.google.com/p/pyfpdf/wiki/Unicode
 just needed to create directorygluon  contrib  fpdf  font
 and place needed ttf files insited it :)
 then pdf.write(8, uĄžuolas)  works fine 

 BUT - how to make it work with write_html(...) ?

 write_html( str(P( uĄžuolas ))  #  produces Ąžuolas  

 pdf.write_html( u'Ąžuolas'.encode('utf8') )  # also  Ąžuolas  

 pdf.write_html( u'Ąžuolas' )   gives error

 File 
 /home/jurgis/web2py/applications/apskaitele/controllers/default.pyhttps://jurgis.pythonanywhere.com/admin/default/edit/apskaitele/controllers/default.py,
  
 line 59, in pdftest
 pdf.write_html( u'Ąžuolas' )
 File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 397, in 
 write_html
 h2p.feed(text)
 File /usr/local/lib/python2.7/HTMLParser.py, line 114, in feed
 self.goahead(0)
 File /usr/local/lib/python2.7/HTMLParser.py, line 152, in goahead
 if i  j: self.handle_data(rawdata[i:j])
 File /home/jurgis/web2py/gluon/contrib/fpdf/html.py, line 122, in 
 handle_data
 self.pdf.write(self.h,txt)
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 822, in write
 txt = self.normalize_text(txt)
 File /home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py, line 1012, in 
 normalize_text
 txt = txt.encode('latin1')
 UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-
 1: ordinal not in range(256)

 pdf.write_html( u'Ąžuolas'.decode('utf8') )

 2013 m. balandis 26 d., penktadienis 22:03:41 UTC+3, Jurgis Pralgauskis 
 rašė:

 Hi, 

 but this seems to work not for all unicode characters
 like if I have Ąžuolas

 uĄžuolas.encode('iso-8859-1')   gives error :/

 UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: 
 ordinal not in range(256)


 I also posted on hosting forum looking for TTF solution
  https://www.pythonanywhere.com/forums/topic/602/#id_post_4362

 2011 m. balandis 29 d., penktadienis 06:35:40 UTC+3, Alexandre Andrade 
 rašė:

 The same can be converted to a function, to make it easier:

 def lt(str):
 return unicode(str,'utf-8').encode('iso-8859-1')


 so just 

 pdf.cell(50,20,lt('Helló Wórld'), 0,2,'L') 

 2011/4/29 Christopher Steel chris...@gmail.com


 This solution works well. You will need to make a minor correction and
 remove the single quotes around 'txt' in the second line. The edited
 version looks like this:

txt = 'Hélló wórld'
utxt = unicode(txt, 'utf-8')
stxt = utxt.encode('iso-8859-1')
pdf.cell(50,20, stxt, 0, 2, 'L')


 Thanks for the hint Bernardo!

 C.


 -- Forwarded message --
 From: Bernardo estem...@gmail.com
 Date: Sep 25 2010, 7:35 am
 Subject: Solved -- Problems with special characters and pyfpdf
 To: web2py-users


 Hi all,

 When usingpyfpdfwhich comes with web2py framework, there are some
 issues withspecialcharacterssuch as accentedcharacters(á, é,
 í, ...). After some research, I found out thatpyfpdfjust understands
 'iso-8859-1', and web2py gives him the strings in 'utf-8' format.

 So, as a solution, in your python code you just have to convert the
 string before passing it topyfpdf, like this:

 txt = 'Hélló wórld'
 utxt = unicode('txt', 'utf-8')
 stxt = utxt.encode('iso-8859-1')
 pdf.cell(50,20, stxt, 0, 2, 'L')

 If anyone has any doubts, just ask. I hope this can help someone...

 kind regards,
 Bernardo




 -- 
 Atenciosamente


 Alexandre Andrade
 Hipercenter.com Classificados Gratuitos
  


-- 

--- 
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: pyfpdf_from_html doesn't work (leaves html)?

2013-04-26 Thread Jurgis Pralgauskis
the problem seems to be with view

as from controller directly it generates OK

def pdftest2():
tags = content()
if request.extension==pdf:
from gluon.contrib.generics import pyfpdf_from_html
return pyfpdf_from_html(tags )
return tags

def pdftest3():
return  content()  # this should use generic.pdf when called with .pdf 
extension


{{ # generic.pdf
from gluon.contrib.generics import pyfpdf_from_html
=pyfpdf_from_html(response 
https://jurgis.pythonanywhere.com/examples/global/vars/response._vars)
}}


any ideas?
 

2013 m. balandis 25 d., ketvirtadienis 01:48:28 UTC+3, Jurgis Pralgauskis 
rašė:

 Hi 


 the code from pypdf wiki examples works  
 http://code.google.com/p/pyfpdf/wiki/Web2Py
 (downloaded via http://pyfpdf.googlecode.com/files/web2py.app.fpdf.w2p )

 pdf=MyFPDF()
 pdf.add_page()
 pdf.write_html(str(XML(table, sanitize=False)))
 response.headers['Content-Type']='application/pdf'
 return pdf.output(dest='S')


 but pyfpdf_from_html(...) gives just html code (with .pdf extension) -- no 
 conversion to pdf?? - why could it be...

 https://github.com/globaleaks/web2py/blob/master/gluon/contrib/generics.py#L56

 pdf=MyFPDF()
 pdf.add_page()
 html = sanitize(html, escape=False)   should have better list of 
 allowed tags
 pdf.write_html(html,image_map=image_map)
 return XML(pdf.output(dest='S'))


 I don't see where it defines 
 response.headers['Content-Type']='application/pdf'

 and I suspect theres no need to return as XML(..)?
 return XML(pdf.output(dest='S'))


 tested on pythonanywhere  and localy...
 ps.: in generic.pdf  I set explicitly pyfpdf_from_html  instead 
 of pdf_from_html


-- 

--- 
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] pyfPDF templates and unicode element values?

2013-04-26 Thread Jurgis Pralgauskis
Hi, 

I tried to combine ideas from http://code.google.com/p/pyfpdf/wiki/Templates
and http://code.google.com/p/pyfpdf/wiki/Unicode

but not much luck... encodings were always hard for me...

I can insert unicode via direct write ok, 

but if I try to insert it via cell/multicell, I get stuck ...

I changed file encoding of template.py
and also replaced  
if isinstance(text, unicode):
#~ text = text.encode(latin1,ignore)
text = text.encode('utf8')

and explicitly changed all set_font to:
#~ pdf.set_font(font,style,size)
pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
pdf.set_font('DejaVu','',size)

but then I get:

Traceback (most recent call last):
  File unicode_template.py, line 321, in module
f.render(./invoice.pdf)
  File unicode_template.py, line 135, in render
self.handlers[element['type'].upper()](pdf, **element)
  File unicode_template.py, line 172, in text
pdf.cell(w=x2-x1,h=y2-y1,txt=text,border=0,ln=0,align=align)
  File /home/nijole/Downloads/pyfpdf/fpdf/fpdf.py, line 632, in cell
txt = self.normalize_text(txt)
  File /home/nijole/Downloads/pyfpdf/fpdf/fpdf.py, line 1043, in 
normalize_text
txt = txt.decode('utf8')
  File /usr/lib/python2.7/encodings/utf_8.py, line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xba in position 1: 
invalid start byte

-- 

--- 
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] pyfpdf_from_html doesn't work (leaves html)?

2013-04-24 Thread Jurgis Pralgauskis
Hi 


the code from pypdf wiki examples works  
http://code.google.com/p/pyfpdf/wiki/Web2Py
(downloaded via http://pyfpdf.googlecode.com/files/web2py.app.fpdf.w2p )

pdf=MyFPDF()
pdf.add_page()
pdf.write_html(str(XML(table, sanitize=False)))
response.headers['Content-Type']='application/pdf'
return pdf.output(dest='S')


but pyfpdf_from_html(...) gives just html code (with .pdf extension) -- no 
conversion to pdf?? - why could it be...
https://github.com/globaleaks/web2py/blob/master/gluon/contrib/generics.py#L56

pdf=MyFPDF()
pdf.add_page()
html = sanitize(html, escape=False)   should have better list of 
allowed tags
pdf.write_html(html,image_map=image_map)
return XML(pdf.output(dest='S'))


I don't see where it defines 
response.headers['Content-Type']='application/pdf'

and I suspect theres no need to return as XML(..)?
return XML(pdf.output(dest='S'))


tested on pythonanywhere  and localy...
ps.: in generic.pdf  I set explicitly pyfpdf_from_html  instead 
of pdf_from_html

-- 

--- 
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] controller function with paramerers -- invalid function ?

2013-04-23 Thread Jurgis Pralgauskis
Hi, 

if I define controller with parameters, 

def stuff(id=None):
id = id or int(request.args(0))
return dict(info=db.stuff(id).info)

I get this message on page: 
invalid function (default/stuff)

though it would be possible (and convenient for me) to call it either:
a)  directly 
b) via URL/LOAD...

Now I have to always LOAD it...

By the way, I could even do:
def stuff(id=int(request.args(0))):
return dict(info=db.stuff(id).info) 

or maybe there could be some decorator shortcut, which could turn any 
function with parameters to consume request.arguments (and become possible 
controller)?
as writing  int(request.args(0)) each time is somewhat too repetitive :)

-- 

--- 
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] Re: REF: Displaying a Virtual Field in SQLFORM.grid throws an exception....

2013-04-21 Thread Jurgis Pralgauskis
Hi, probably, virtual fields can be injected somewhere in:

https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L1931

https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2242

https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2322

ps.: For virtual fields, one should know which other fields of table it 
depends on -  to .select(..) them for calculations.
that might need some changes when defining VirtualField ?
and but these other fields might not need be shown in grid..., so should be 
apart from fields=... argument.

ps.: VirutalFields doesn't have .tablename property - not implemented yet, 
or other reasons?


2013 m. balandis 6 d., šeštadienis 19:33:01 UTC+3, Massimo Di Pierro rašė:

 I will be fixed asap. I cannot give you a deadline. 

 On Friday, 5 April 2013 19:42:04 UTC-5, Richard wrote:

 I fall on this exact problem, I don't see anything about taht in the 
 change log of 2.4.4. Is this will be fix soon? I mean SQLFORM.grid support 
 for virtual field

 THanks

 Richard


 On Tue, Dec 18, 2012 at 10:32 AM, Massimo Di Pierro 
 massimo@gmail.com wrote:

 Right now grid does not work with virtual fields. There is a pending 
 proposal for enhancement to support them.


 On Tuesday, 18 December 2012 01:03:05 UTC-6, software.ted wrote:

 Does SQLFORM.grid support adding and display of a virtual field...am 
 getting an exception...my code:

 db.file_subject_issue.file_**name = Field.Virtual(lambda row: 
 get_file_name(row.file_**subject_issue.file_id))
 fields = [db.file_subject_issue.file_**id, db.file_subject_issue.date_*
 *created, db.file_subject_issue.file_**name]
 query =

 form = SQLFORM.grid(query,fields=**fields,...)
  
 I am getting the error

 type 'exceptions.AttributeError' 'FieldVirtual' object has no 
 attribute '_tablename'

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

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/**restricted.py, line 212, in 
 restricted


 exec ccode in environment
   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 176, in module


   File /home/www-data/web2py/gluon/**globals.py, line 188, in lambda


 self._caller = lambda f: f()


   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 71, in file_track


 selectable=False,csv=False , paginate=20, user_signature=False)


   File /home/www-data/web2py/gluon/**sqlhtml.py, line 1796, in grid


 if field._tablename in tablenames]

 AttributeError: 'FieldVirtual' object has no attribute '_tablename'







 -- 
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he 
 is all - Thomas Carlyle 1795-1881

 /~
  
  -- 
  
  
  




-- 

--- 
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] Re: REF: Displaying a Virtual Field in SQLFORM.grid throws an exception....

2013-04-21 Thread Jurgis Pralgauskis
for now the workaround might be manipulating generated html table 
like https://groups.google.com/d/msg/web2py/BmbIlkWYZVo/hccT2JQCUp0J

you need to know id of records - so you could get info for calculating 
virtual field, 

so instead :
fields=[db.product.name, db.product.cost, db.product.quantity, 
db.product.virtual_total]

give 
fields=[db.product.name, db.product.cost, db.product.quantity, 
db.product.id]

and then replace/calculate the 4th column contents:

grid = SQLFORM.grid(query or table, fields=fields)
trs = grid.element(table).elements(tr)
for tr in grid.element(tbody).elements(tr):
id = int(tr[3][0]) 
tr[3][0] =  str(   db.product(id).virtual_total ) 



ps.: for easier manipulation could use dict notation:
db.product['virtual_total']
db.product(id)['virtual_total']

2013 m. balandis 21 d., sekmadienis 21:49:36 UTC+3, Jurgis Pralgauskis rašė:

 Hi, probably, virtual fields can be injected somewhere in:

 https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L1931

 https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2242

 https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2322

 ps.: For virtual fields, one should know which other fields of table it 
 depends on -  to .select(..) them for calculations.
 that might need some changes when defining VirtualField ?
 and but these other fields might not need be shown in grid..., so should 
 be apart from fields=... argument.

 ps.: VirutalFields doesn't have .tablename property - not implemented yet, 
 or other reasons?


 2013 m. balandis 6 d., šeštadienis 19:33:01 UTC+3, Massimo Di Pierro rašė:

 I will be fixed asap. I cannot give you a deadline. 

 On Friday, 5 April 2013 19:42:04 UTC-5, Richard wrote:

 I fall on this exact problem, I don't see anything about taht in the 
 change log of 2.4.4. Is this will be fix soon? I mean SQLFORM.grid support 
 for virtual field

 THanks

 Richard


 On Tue, Dec 18, 2012 at 10:32 AM, Massimo Di Pierro 
 massimo@gmail.com wrote:

 Right now grid does not work with virtual fields. There is a pending 
 proposal for enhancement to support them.


 On Tuesday, 18 December 2012 01:03:05 UTC-6, software.ted wrote:

 Does SQLFORM.grid support adding and display of a virtual field...am 
 getting an exception...my code:

 db.file_subject_issue.file_**name = Field.Virtual(lambda row: 
 get_file_name(row.file_**subject_issue.file_id))
 fields = [db.file_subject_issue.file_**id, db.file_subject_issue.date_
 **created, db.file_subject_issue.file_**name]
 query =

 form = SQLFORM.grid(query,fields=**fields,...)
  
 I am getting the error

 type 'exceptions.AttributeError' 'FieldVirtual' object has no 
 attribute '_tablename'

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

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/**restricted.py, line 212, in 
 restricted


 exec ccode in environment
   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 176, in module


   File /home/www-data/web2py/gluon/**globals.py, line 188, in lambda


 self._caller = lambda f: f()


   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 71, in file_track


 selectable=False,csv=False , paginate=20, user_signature=False)


   File /home/www-data/web2py/gluon/**sqlhtml.py, line 1796, in grid


 if field._tablename in tablenames]

 AttributeError: 'FieldVirtual' object has no attribute '_tablename'







 -- 
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he 
 is all - Thomas Carlyle 1795-1881

 /~
  
  -- 
  
  
  




-- 

--- 
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] could web editor highlight py syntax in templates (not just html)?

2013-04-17 Thread Jurgis Pralgauskis
Hi, 

I thought w2p templates are very similar to PHP idea.

and that was one of the reasons, why php became so popular -- starting to 
develop was very simple -- everything in one file.

in this supposition, I thought - I can give it for (very) introductory web 
dev.

and *if the web editor would do py syntax highliting alongside with html, 
it would be very nice :) *
I imagine it's possible to regexp these py-islands in template and do the 
highliting... maybe there are issues I should know before I try..

or vice verse -- in controller -- try to highlight any string (or ) 
syntax as html

-- 

--- 
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] Lazy_LOAD (with trigger binding)?

2013-04-15 Thread Jurgis Pralgauskis
Hi,

in some cases it would be nice to have ajax LOAD on trigger/event instead
of onload...
just adding some trigger_init_js  parameter/code ... which binds
web2py_component calling to the event.

before doing it myselft, wanted to ask, maybe it is already done

-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Re: can't submit form: when LOAD'ed(...., ajax=False, ajax_trap=True)

2013-04-15 Thread Jurgis Pralgauskis
The forms are nested in the source code (presumably your LOAD is inserted
 within the body of the main form). Looks like jQuery UI moves the inner
 form to a different part of the DOM, but notice that the re-located form
 DOM no longer includes a form element. Because of that, the
 web2py_trap_form() doesn't have any form to trap and submit.


yes the LOAD is called in another form (as this is special widget behaviour)
http://www.web2pyslices.com/slice/show/1616/widget-select-or-add-option-ng

how could I workaound this keeping functionality of widget?


 googel Chrome inspector shows, that dialog is after/outside div class=
 container.../**div
 while Product form is inside main container.


 I think the problem might be that you have one form nested inside the
 other -- try moving the new category form outside of the create product
 form DOM.


 you can check the issue here

 https://jurgis.pythonanywhere.com/apskaitele/default/create_
 product/https://jurgis.pythonanywhere.com/apskaitele/default/create_product/
 press the *+* alongside Category Id, which should show a dialog,
 which was loaded directly but with ajax_trap

 Submit does not react anyhow... - where's the rub?



-- 

--- 
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] Re: can't submit form: when LOAD'ed(...., ajax=False, ajax_trap=True)

2013-04-15 Thread Jurgis Pralgauskis
 The forms are nested in the source code (presumably your LOAD is inserted
 within the body of the main form). Looks like jQuery UI moves the inner
 form to a different part of the DOM, but notice that the re-located form
 DOM no longer includes a form element. Because of that, the
 web2py_trap_form() doesn't have any form to trap and submit.


 yes the LOAD is called in another form (as this is special widget
 behaviour)
 http://www.web2pyslices.com/**slice/show/1616/widget-select-**
 or-add-option-nghttp://www.web2pyslices.com/slice/show/1616/widget-select-or-add-option-ng

 how could I workaound this keeping functionality of widget?


 That slices uses an Ajax component (i.e., LOAD(..., ajax=True)) -- why not
 just do it that way?


with ajax=True   I mentioned other issues,
if I have forms with 2 levels of parent (with this widget) ,

after I open 3rd form (2nd dialog), the 1st dialog messes up (somehow gets
contents of the main page???)
https://jurgis.pythonanywhere.com/apskaitele/default/create_product_ajaxTrue

But would be enough to solve this if possible...

ps.:  ajax=False
https://jurgis.pythonanywhere.com/apskaitele/default/create_product

-- 

--- 
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] Re: can't submit form: when LOAD'ed(...., ajax=False, ajax_trap=True)

2013-04-15 Thread Jurgis Pralgauskis
the other (or maybe connected) issue with ajax=True
is that it loads 3rd level subforms twice:
1) for the div of 2nd form while it is not loaded
2) for the loaded form of 2nd level...


this migh be solved with Lazy LOAD
https://groups.google.com/forum/?fromgroups=#!topic/web2py/35vyANapSfM

and I also think of making nested form pattern using ideas from
http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables


On Mon, Apr 15, 2013 at 10:09 PM, Anthony abasta...@gmail.com wrote:

 with ajax=True   I mentioned other issues,

 if I have forms with 2 levels of parent (with this widget) ,

 after I open 3rd form (2nd dialog), the 1st dialog messes up (somehow
 gets contents of the main page???)
 https://jurgis.pythonanywhere.**com/apskaitele/default/create_**
 product_ajaxTruehttps://jurgis.pythonanywhere.com/apskaitele/default/create_product_ajaxTrue


 Not sure why that is happening. An alternative might be to abandon the
 idea of putting everything in the form widget. Instead, manually create the
 other two forms elsewhere on the page (i.e., so they're not nested).

 Anthony

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/js8yZubo_cQ/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Re: Nested table-queries

2013-04-15 Thread Jurgis Pralgauskis
I think you can have the same without lambda

def ext_info (row):
   return [A(op, _href=URL(edit, args=op_id, user_signature=True)) +  
for op, op_id in get_extended_info_for_case(row.cases.id)]


On Mon, Apr 15, 2013 at 12:20 PM, D. s54012...@gmail.com wrote:

 I figured it out myself :-)

 I just needed an inline-loop in my lambda-function:

 ext_info = lambda row: [A(op, _href=URL(edit, args=op_id, user_signature
 =True)) +for op, op_id in get_extended_info_for_case(row.cases.id)]



 I find this very ugly though (lambdas and inline-loops in general) and it
 does not look pythonic. Is there any way to make it prettier?

 --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/o6_wQZ_HBgM/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
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] Re: can't submit form: when LOAD'ed(...., ajax=False, ajax_trap=True)

2013-04-15 Thread Jurgis Pralgauskis


 The problem may be related to the interaction between jQuery UI .dialog() 
 and the web2py component (I don't know enough about jQuery UI dialog to 
 track it down, though).


seems not the case, 
I made more experiments

You can customize the parameters *ajax* and *jqueryUIdialog*
lets say: *ajax*=True, *jqueryUIdialog*=False still messes stuff.  (I even 
tried commenting out query-ui.js)
https://jurgis.pythonanywhere.com/apskaitele/default/create_product?ajax=1jqueryUIdialog=0
*
*

whats more interesting - loading without ajax also gives similar mess
https://jurgis.pythonanywhere.com/apskaitele/default/create_product?ajax=0jqueryUIdialog=0

***
but whats most interesting that in  UI dialog 3rd level Submit works!! :)
https://jurgis.pythonanywhere.com/apskaitele/default/create_product?ajax=0jqueryUIdialog=1
 

probably, because 2nd component is moved to independent div (and does not 
have form), 
the 3rd can have the form of its own ;)  might be workaround..?


(my yesterdays experiments were a bit not precise (had bug), and I didn't 
notice it)

-- 

--- 
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] Multiple/Nested tables in SQLFORM.factory (with same fieldnames)?

2013-04-15 Thread Jurgis Pralgauskis
book has exapmple One form for multiple tables

http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables

But also states: This only works when the tables don't have field names in 
common.

Can this be overcome with easy hooks? 

-- 

--- 
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: Multiple/Nested tables in SQLFORM.factory (with same fieldnames)?

2013-04-15 Thread Jurgis Pralgauskis
The id's in form have table names as well... 

maybe some proxy, which would prepend table names to field _name, 
and on submit, group fields by tables 
and strip table names, before processing each table individually?


2013 m. balandis 16 d., antradienis 03:02:42 UTC+3, Jurgis Pralgauskis rašė:

 book has exapmple One form for multiple tables

 http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables

 But also states: This only works when the tables don't have field names 
 in common.

 Can this be overcome with easy hooks? 


-- 

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




  1   2   >