[web2py] Small trick to debug vue applications with py4web

2019-12-30 Thread José Luis Redrejo
Just a quick note to myself, and others who could face this same problem:
When using Vue inside py4web, as it's done in the todo application included
with the code, using the vue devtools tab in the browser does not work out
of the box.
This is the message the extension shows:

[image: image.png]
To solve it, adding

Vue.config.devtools = true;

to the beginning of the file static/js/utils.js allows you to use the vue
devtools to debug the vue app. It's a good idea to remove this line when
the app is sent to production.

-- 
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/CAHpm-q045V8savvd85KpKNrUWsKcz8h%3DQy31ErLG2sJFfSX6VA%40mail.gmail.com.


Re: [web2py] Web3Py equivalent of SQLFORM.grid

2019-05-16 Thread José Luis Redrejo
I can't show you all the code because the property belongs to the person
who asked me to do it,
This is the part that takes the dataables json requests, fetch the records
and format them to be understood by datatables. I am skipping the
sorting/filtering part , that builds the  *query_filter* and *orderby*
variables
I have also changed the table name by MY_TABLE and remove one field name.

Also, beware in this case the total number of records uses count(), you
will have to replace it if your table has many records.

Hope it helps you.
José L.

@service.jsondef logs_table():
query_filter = None

if request.vars.start is not None:
iDisplayStart = int(request.vars.start)
else:
iDisplayStart = 0

if request.vars.length is not None:
iDisplayLength = int(request.vars.length)
else:
iDisplayLength = 10

if request.vars.draw is not None:
sEcho = int(request.vars.draw)
else:
sEcho = 1





query = db(query_filter).select(db.MY_TABLE.ALL,
limitby=(iDisplayStart, iDisplayStart + iDisplayLength),
orderby=orderby)

iTotalRecords = db(query_filter).count()

# iTotalRecords = 100
aaData = []

for row in query:
datarow = {}
for col in row:
if row[col] is not None:
if col == 'MY_TABLE' or '_record' in col:
# internal dal col names
continue
elif col == 'name of field that is a datetime':
datarow[col] = row[col].strftime('%Y-%m-%d %H:%M:%S')
else:
datarow[col] = row[col]
else:
datarow[col] = ''

aaData.append(datarow)
return dict(draw=sEcho, recordsTotal=iTotalRecords,
recordsFiltered=iTotalRecords, data=aaData)


El jue., 16 may. 2019 a las 12:51, John Bannister ()
escribió:

> Hey Jose,
>
> Thanks for the quick response. Much appreciated. Do you happen to have a
> small working example of Datatables setup in server mode that I could take
> a look at to hopefully save some time? I last looked at it a few years ago
> as mentioned and any pointers would be great.
>
> Thanks in advance
> John
>
> On Thursday, 16 May 2019 12:42:17 UTC+2, José L. wrote:
>>
>> Hey John,
>>
>> I have used datatables with web2py in some projects and it was faster
>> than smartgrid when used in server mode.
>> Whenever I had performance problems was because the code used .count() to
>> show the total number of records. In my case the tables have several
>> millions of records and that was way too slow.
>> That's a common problem in many databases engines, not a datatables
>> problem.
>>
>> When using an aprox. number instead of executing the sql count() command,
>> the datatable works fine showing hundred of rows from a table.
>>
>> You have to make your own code for the server side, to support filter or
>> sort if you need them, but it's quite straightforward.
>>
>> José L.
>>
>> El jue., 16 may. 2019 a las 11:42, John Bannister ()
>> escribió:
>>
>>> Hi All,
>>>
>>> I have a number of web2py applications that use the grid/smartgrid
>>> functionality pretty heavily. The majority of the applications are working
>>> with large data sets (some tables have > 20M records) and everything runs
>>> fine.
>>>
>>> With the coming of Web3Py (which looks great) my question is what would
>>> be a viable equivalent to web2py's grid/smartgrid?
>>>
>>> I looked at Datatables some time back which worked great on smaller
>>> datasets but anything over 50K (on my testbed) starts to become unusable. I
>>> also implemented some server side processing for Datatables but never quite
>>> managed to get a usable solution or at least nothing that could handle big
>>> data sets as efficiently as web2py.
>>>
>>> So basically looking for something that can handle large datasets that
>>> will plug into web3py if anyone has any recommendations they would be much
>>> appreciated or if anyone has managed to get Datatables working well with
>>> large data sets some guidance would be great.
>>>
>>> Thanks in advance
>>>
>>> --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/8e109e58-f4ac-4272-a835-d86e5101c7fe%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> Resources:
> - http://web2py.com
> - 

Re: [web2py] Web3Py equivalent of SQLFORM.grid

2019-05-16 Thread José Luis Redrejo
Hey John,

I have used datatables with web2py in some projects and it was faster than
smartgrid when used in server mode.
Whenever I had performance problems was because the code used .count() to
show the total number of records. In my case the tables have several
millions of records and that was way too slow.
That's a common problem in many databases engines, not a datatables problem.

When using an aprox. number instead of executing the sql count() command,
the datatable works fine showing hundred of rows from a table.

You have to make your own code for the server side, to support filter or
sort if you need them, but it's quite straightforward.

José L.

El jue., 16 may. 2019 a las 11:42, John Bannister ()
escribió:

> Hi All,
>
> I have a number of web2py applications that use the grid/smartgrid
> functionality pretty heavily. The majority of the applications are working
> with large data sets (some tables have > 20M records) and everything runs
> fine.
>
> With the coming of Web3Py (which looks great) my question is what would be
> a viable equivalent to web2py's grid/smartgrid?
>
> I looked at Datatables some time back which worked great on smaller
> datasets but anything over 50K (on my testbed) starts to become unusable. I
> also implemented some server side processing for Datatables but never quite
> managed to get a usable solution or at least nothing that could handle big
> data sets as efficiently as web2py.
>
> So basically looking for something that can handle large datasets that
> will plug into web3py if anyone has any recommendations they would be much
> appreciated or if anyone has managed to get Datatables working well with
> large data sets some guidance would be great.
>
> Thanks in advance
>
> --
> 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/8e109e58-f4ac-4272-a835-d86e5101c7fe%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAHpm-q2R19-kd7VqSMmEQbFL7ggKG3d_2UHMz_uF3E7WkMPQjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Web3py

2019-04-19 Thread José Luis Redrejo
I think one of the reasons web2py is so productive and has an easy learn
curve is due to the fact of using DAL instead of an ORM.
I don't see any problem in using sqlalchemy with web2py if an ORM is
needed.  I would probably use it in some big projects for some of the
models.

But for the sake of the easy learning/productivity/quick development time I
would prefer to keep pydal as the default, at least for the features web2py
provides (auth, security, etc.)
Just my 20 cents.
José L.

El vie., 19 abr. 2019 a las 16:54, Carlos Cesar Caballero Díaz (<
carlos.caball...@cfg.jovenclub.cu>) escribió:

> As almost everything in our world ORMs has advantages and disadvantages.
> The main criticism about ORMs is that they are leaky abstractions, that
> means they leaks details that it is supposed to abstract away, because
> there are times when you just need to use, for example, SQL directly or
> work with raw rows when making complex queries or improving performance
> because that is one of the ORMs disadvantages, they include an extra
> logical layer that, depending on the implementation can affect performance
> more or less.
>
> But there are lot of people out there using ORMs and this is because they
> have advantages, compared with PyDAL, mostly when you are using big models,
> for example, compare this PyDAL model:
>
> def _get_somethig_plus_age(row, extra):
> return row.person.age + extra
>
> db.define_table('person',
> Field('name')
> Field('age', 'integer')
> Field.Method('get_somethig_plus_age', _get_somethig_plus_age)
> )
>
> against this ORM-style model:
>
> class Person(Model):
> name = Field()
> age = Field('integer')
>
> def get_somethig_plus_age(self, extra):
> return self.age + extra
>
> In an ORM, a model class represents a table, and when you query the DB,
> you get the class instance objects representing rows. Using this approach
> you can directly benefit from the advantages of the OOP and the code
> readability and organization improves a lot, mostly when models starts grow
> big.
>
> Greetings.
>
>
> El 19/4/19 a las 2:44 a.m., Dave S escribió:
>
> On Thursday, April 18, 2019 at 3:48:09 PM UTC-7, Carlos Cesar Caballero
> wrote:
>>
>> Hi Massimo, here is it: https://github.com/cccaballero/pydal-orm. I
>> think including something like this with pydal will be a really good
>> improvement.
>>
>> Greetings.
>>
>>
> As someone who had some SQL training (but not proficiency) before  using
> Web2Py,
> and who has rarely had an issue with using the DAL (but then, I don't have
> complicated projects, either),
> I could use some info on what makes an ORM great.
>
> I know that Massimo has said in the past that it was a deliberate choice
> to do the DAL instead of an ORM
> (is the DAL a DAO?),
> and I see the contributors to Wikipedia have listed some concerns
> along with the advantages
> (client code gets to stick with working with objects ++
>  high level of abstraction obscures what is happening --
>  heavy reliance on ORM cited as major factor in poorly designed DBs --)
>
> The third approach appears to be OODBMS where the store actually is built
> around objects via ODMs
> rather than translating tables.  This gets into NoSQL territory, it seems.
>
> So, educate me!
>
> /dps
>
> El 12/4/19 a las 4:33 p.m., Massimo Di Pierro escribió:
>> > Can you make it a module on pypi? Or should we include it in pydal?
>> >
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: web3py again....

2019-03-29 Thread José Luis Redrejo
El vie., 29 mar. 2019 a las 5:12, Massimo Di Pierro (<
massimo.dipie...@gmail.com>) escribió:

> My thought exactly.
>
>
I also fully agree.
Very excited with the new features.

Also, I see the problems I reported yesterday have been solved in the git
repository. Now we can begin to really play with it.
José L.




> On Thursday, 28 March 2019 18:46:47 UTC-7, Joe Barnhart wrote:
>>
>> I agree that back porting web2py code should be straightforward (after
>> all, it's not rocket science :-D).  But maybe we should revisit those
>> modules and pare them down to minimalist proportions.  I really need Auth,
>> complete with user roles and groups, but there's probably a better way to
>> minimize/abstract and provide a growth path.
>>
>> Plus, with py3 and web2py in hand, its not like there's a fire that needs
>> putting out.
>>
>> -- Joe
>>
>>
>> On Thursday, March 28, 2019 at 2:16:15 AM UTC-7, Massimo Di Pierro wrote:
>>>
>>> I know this comes up once in a while but ...
>>>
>>> https://github.com/web2py/web3py
>>>
>>> what do you think?
>>>
>>> It is very preliminary but I will have an admin soon.
>>> Backporting SQLFORM, grid and Auth, should not be that complicated,
>>> although I think we can do better.
>>>
>>> Massimo
>>>
>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] web3py again....

2019-03-28 Thread José Luis Redrejo
Just tested, some considerations:

1. Tested with Python 3.6, followig strictly the provided instructions,
several things don't work:
a) static folder is not working properly. I get a 404 error for all the
requests
127.0.0.1 - - [28/Mar/2019 10:45:10] "GET /todo/index HTTP/1.1" 200 828
127.0.0.1 - - [28/Mar/2019 10:45:10] "GET /todo/static/js/sugar.min.js
HTTP/1.1" 404 774
127.0.0.1 - - [28/Mar/2019 10:45:10] "GET /todo/static/js/axios.min.js
HTTP/1.1" 404 774
127.0.0.1 - - [28/Mar/2019 10:45:10] "GET /todo/static/js/vue.min.js
HTTP/1.1" 404 770
127.0.0.1 - - [28/Mar/2019 10:45:10] "GET /todo/static/js/todo.js HTTP/1.1"
404 764

b) favicon requests also produce a python error:
27.0.0.1 - - [28/Mar/2019 10:44:47] "GET /favicon.ico HTTP/1.1" 404 742
Traceback (most recent call last):
  File "/opt/src/web3py/web3py.py", line 149, in load
self.data = jwt.decode(enc_data, self.secret,
algorithms=[self.algorithm])
  File "/opt/src/web3py/venv/lib/python3.6/site-packages/jwt/api_jwt.py",
line 84, in decode
payload, _, _, _ = self._load(jwt)
  File "/opt/src/web3py/venv/lib/python3.6/site-packages/jwt/api_jws.py",
line 177, in _load
binary_type))
jwt.exceptions.DecodeError: Invalid token type. Token must be a 


2. About your questions:

   - sqlform and grid are one of the key points for web2py. It's one of the
   main reasons to use it instead of other frameworks as development is really
   quick. However I think nowadays a backport from web2py is not a good idea.
   We should provide something optional based only on vue.js. As you say, we
   can do it better.
   - auth is not as important in my experience. It has never been the
   reason to pick web2py and there are other ways to do it.


3. about the new ideas:

   - I love the use of jwt and vue.js
   - I love it does not use custom import or eval. That will make testing
   much, much easier and logical.
   - I would like to have a kind of automatic integration between the
   backend and webpack, for modern development. It should be optional
   obviously, but something like django-webpack-loader should be added (or
   have web3py-webpack-loader as an external library that can be installed if
   required)


If you have a roadmap where others could lend a hand, please, tell it.
Maybe creating some github issues that could be assigned to volunteers. I'd
be glad to help.
José L.



El jue., 28 mar. 2019 a las 10:16, Massimo Di Pierro (<
massimo.dipie...@gmail.com>) escribió:

> I know this comes up once in a while but ...
>
> https://github.com/web2py/web3py
>
> what do you think?
>
> It is very preliminary but I will have an admin soon.
> Backporting SQLFORM, grid and Auth, should not be that complicated,
> although I think we can do better.
>
> Massimo
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Web2Py + VueJS SPA (Webpack)

2017-11-27 Thread José Luis Redrejo
I have begun to work on an easy setup, integrated with the way web2py
works. I have little free time to work on it, so it's not finished yet, but
I hope to have it ready soon.
It's based on manual implementations I have done in production
applications, but done in a more general and easy to use way.
I will share with you the git repo as soon as I finish it, just in case
anybody wants to use or improve it.
Regards.

2017-11-28 1:06 GMT+01:00 Massimo Di Pierro <massimo.dipie...@gmail.com>:

> I agree. I wish there was a way (and may be there is but I do not know) to
> to what webpack does from inside the browser of the developer so that the
> developer does not have to install node. If that were possible we could
> distribute vue components with web2py and not worry about users installing
> the node stack.
>
> Massimo
>
>
> On Monday, 27 November 2017 14:13:27 UTC-6, José L. wrote:
>>
>> Massimo, I am sure most of the people in this group agree with you,
>> having the same preference. Coming from the python world we feel more
>> comfortable using that kind of js interaction.
>> I am one of them, and I chose web2py for my personal work some  years ago
>> because of its simplicity against other frameworks complexity.
>> However, working as you mentioned force you to miss most of the rich
>> environment available using node modules.
>>
>> Unfortunately, nowadays to build a modern web site you need to be fluent
>> in 5 "languages" at least (python, JavaScript, html, css & sql) plus some
>> frameworks (web2py, bootstrap, vue/react, not to mention other things like
>> sqlalchemy in some cases). I agree it's not comfortable at all, but
>> currently I see only two solutions for it:
>>
>> 1. If you can work exclusively for chrome/firefox you will be able to
>> work with node-modules in the browser, without the cli , using an elegant
>> solution as https://medium.com/@oleg.agapov/basic-single-page-applicatio
>> n-using-vue-js-and-firebase-part-1-9e4c0c11a228
>>
>> 2. In the medium term we might have webcomponents
>>
>> 3. Paid solutions like Anvil, https://anvil.works/,  allowing you to do
>> everything in Python
>>
>> However, now, needing to support old versions of Firefox and Chrome, or
>> IE, Safari, Edge, etc. I don't see alternatives to the nightmare of webpack
>> and node cli if you want to do a modern application.
>> I think the approach you mention in your email would be similar to be
>> copying python files inside our application directories instead of using
>> pip install to install complete packages. So, my opinion is that we should
>> work on having a polished approach for future versions of web2py, similar
>> to what PHP Laravel community did with vue.
>>
>>
>> José L.
>>
>> 2017-11-26 21:21 GMT+01:00 Massimo Di Pierro <massimo.dipie...@gmail.com>
>> :
>>
>>> It seems that using the cli is becoming standard these days but I still
>>> like the original simplicity of being able to write js without need for
>>> nodejs.
>>>
>>> I tend to program in this way:
>>>
>>>
>>> #... in index.html
>>>
>>> 
>>>
>>>   
>>>   next
>>>
>>>
>>>   
>>>   next
>>>
>>>
>>>   
>>>   start again
>>>
>>> 
>>> 
>>> 
>>> 
>>>
>>> # in js/main.js
>>> var app = {};
>>> // make a component for each page or each reusable widget with a lazily
>>> loaded html
>>> Vue.component('mypage', function (resolve, reject) {
>>> axios.get('components/vue.mypage.html').then(function(res) {
>>> resolve(common_forms(res.data)); });
>>> });
>>> app.vue = new Vue({el:'#app data:{page:'mypage1'},
>>> methods:{goto:function(page){app.vue.page=page;}}, filters:{},
>>> components: {}});
>>>
>>>
>>> # then I define the html for each component in its own lazily-loaded
>>> html file, for example
>>> # in components/vue.mypage.html
>>> 
>>>I am the template for the mypage component.
>>> 
>>>
>>>
>>>
>>> On Wednesday, 15 November 2017 09:33:28 UTC-6, Carlos A. Armenta Castro
>>> wrote:
>>>
>>>> Hi José,
>>>>
>>>> I'm not in a hurry, but I will appreciate so much your help.
>>>>
>>>> Thank you!
>>>>
>>>> P.S. Your recipe with the Webpack proxyTable is working like 

Re: [web2py] Web2Py + VueJS SPA (Webpack)

2017-11-27 Thread José Luis Redrejo
Massimo, I am sure most of the people in this group agree with you, having
the same preference. Coming from the python world we feel more comfortable
using that kind of js interaction.
I am one of them, and I chose web2py for my personal work some  years ago
because of its simplicity against other frameworks complexity.
However, working as you mentioned force you to miss most of the rich
environment available using node modules.

Unfortunately, nowadays to build a modern web site you need to be fluent in
5 "languages" at least (python, JavaScript, html, css & sql) plus some
frameworks (web2py, bootstrap, vue/react, not to mention other things like
sqlalchemy in some cases). I agree it's not comfortable at all, but
currently I see only two solutions for it:

1. If you can work exclusively for chrome/firefox you will be able to work
with node-modules in the browser, without the cli , using an elegant
solution as
https://medium.com/@oleg.agapov/basic-single-page-application-using-vue-js-and-firebase-part-1-9e4c0c11a228

2. In the medium term we might have webcomponents

3. Paid solutions like Anvil, https://anvil.works/,  allowing you to do
everything in Python

However, now, needing to support old versions of Firefox and Chrome, or IE,
Safari, Edge, etc. I don't see alternatives to the nightmare of webpack and
node cli if you want to do a modern application.
I think the approach you mention in your email would be similar to be
copying python files inside our application directories instead of using
pip install to install complete packages. So, my opinion is that we should
work on having a polished approach for future versions of web2py, similar
to what PHP Laravel community did with vue.


José L.

2017-11-26 21:21 GMT+01:00 Massimo Di Pierro <massimo.dipie...@gmail.com>:

> It seems that using the cli is becoming standard these days but I still
> like the original simplicity of being able to write js without need for
> nodejs.
>
> I tend to program in this way:
>
>
> #... in index.html
>
> 
>
>   
>   next
>
>
>   
>   next
>
>
>   
>   start again
>
> 
> 
> 
> 
>
> # in js/main.js
> var app = {};
> // make a component for each page or each reusable widget with a lazily
> loaded html
> Vue.component('mypage', function (resolve, reject) {
> axios.get('components/vue.mypage.html').then(function(res) {
> resolve(common_forms(res.data)); });
> });
> app.vue = new Vue({el:'#app data:{page:'mypage1'},
> methods:{goto:function(page){app.vue.page=page;}}, filters:{},
> components: {}});
>
>
> # then I define the html for each component in its own lazily-loaded html
> file, for example
> # in components/vue.mypage.html
> 
>I am the template for the mypage component.
> 
>
>
>
> On Wednesday, 15 November 2017 09:33:28 UTC-6, Carlos A. Armenta Castro
> wrote:
>
>> Hi José,
>>
>> I'm not in a hurry, but I will appreciate so much your help.
>>
>> Thank you!
>>
>> P.S. Your recipe with the Webpack proxyTable is working like a charm in
>> my dev server. 
>>
>>> lso, in webpack.config.babel.js configuration file ,  if you add
>>>
>>>
>>>   devServer: {
>>> host: '127.0.0.1',
>>> port: 8001,
>>> historyApiFallback: false,
>>> noInfo: true,
>>> proxy: {
>>>   '/yourapp/api/*': {
>>> target: 'http://127.0.0.1:8080',
>>> secure: false
>>> // changeOrigin: true,
>>> // pathRewrite: { '^/api': '' }
>>>   }
>>> },
>>>   },
>>>
>>
>> On Tue, Nov 14, 2017 at 12:58 PM, José Luis Redrejo <jredr...@gmail.com>
>> wrote:
>>
>>> Carlos, by the way, if you are not in a hurry I can prepare a proof of
>>> concept this weekend. I just can tell it really works because I am using it
>>> in a system in production.
>>>
>>> Of course, that's the develop setup, once develop is done in production
>>> we use nginx-uwsgi only, but in that case there's no cors problem as
>>> everything runs in the same server.
>>>
>>>
>>> The only thing I miss in web2py (waving Massimo ;) ) is having something
>>> like http://pyramid-webpack.readthedocs.io/en/latest/
>>>
>>> It would allow us to write in the view  controller/function.html
>>> something like
>>>
>>> 
>>>
>>> 

Re: [web2py] Web2Py + VueJS SPA (Webpack)

2017-11-14 Thread José Luis Redrejo
I will do it this weekend, by the way crud is not simple at all. In fact
it's one of the most complex things ;)


2017-11-15 3:04 GMT+01:00 黄祥 :

> i'm interest too, could you give some simple example (crud) to learn how
> it works?
>
> thanks and best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Web2Py + VueJS SPA (Webpack)

2017-11-14 Thread José Luis Redrejo
Carlos, by the way, if you are not in a hurry I can prepare a proof of
concept this weekend. I just can tell it really works because I am using it
in a system in production.

Of course, that's the develop setup, once develop is done in production we
use nginx-uwsgi only, but in that case there's no cors problem as
everything runs in the same server.


The only thing I miss in web2py (waving Massimo ;) ) is having something
like http://pyramid-webpack.readthedocs.io/en/latest/

It would allow us to write in the view  controller/function.html something
like






It would fetch the built files using the dist/webpack-manifest.json
automatically instead of having to write them manually. Now if I use js or
css versioning I have to change the routes in the view whenever I execute
webpack

Regards
José L.

2017-11-14 20:37 GMT+01:00 José Luis Redrejo <jredr...@gmail.com>:

> Hi Carlos
> I would recommend you to use this webpack helper:
> https://github.com/Plortinus/vue-multiple-pages
>
> Doing "vue init Plortinus/vue-multiple-pages new-project" you get the
> structure to work, just add the div for app to the class and import the
> page js per each page.
>
> Also, in webpack.config.babel.js configuration file ,  if you add
>
>
>   devServer: {
> host: '127.0.0.1',
> port: 8001,
> historyApiFallback: false,
> noInfo: true,
> proxy: {
>   '/yourapp/api/*': {
> target: 'http://127.0.0.1:8080',
> secure: false
> // changeOrigin: true,
> // pathRewrite: { '^/api': '' }
>   }
> },
>   },
>
>
> You can start web2py server, then webpack dev server and it will do
> queries to web2py without any cors problem.
>
> i.e
> http://localhost:8001/api/whatever will automatically be fetched from
> http://localhost:8080/yourapp/api/whatever
>
> That's how I set it up for web2py to be the backend, and webpack dev
> server to run the frontend.
>
>
> Hope it helps
> José L.
>
> 2017-11-14 17:48 GMT+01:00 Carlos A. Armenta Castro <
> carlos.armen...@gmail.com>:
>
>> I have using Web2Py for too many years for commercial websites and for
>> Intranets in México, I want to say that Web2Py is an AMAZING Framework!!!
>> For my new project I need to use an SPA VueJs + Webpack for the FrontEnd
>> ( http://quasar-framework.org/ ) and a Web2Py as my BackEnd API Server.
>> I'm curious about to integrate his two web frameworks using web2py routes
>> to serve this two apps in the same port but different URL.
>>
>> Example:
>> http://127.0.1.1/welcome/api ---> My Web2py API Controller
>> http://127.0.1.1/welcome   ---> My VueJS APP with webpack  (
>> http://quasar-framework.org/ ) <-- Pointing to index.html in *dist/ *
>> and permit to use all the static files deposited in the same path
>> *dist/**
>>
>> *VueJS + Webpack APP Structure*
>>
>> ├── *dist/ * *# Compiled APP (Serve this files as the 
>> static SPA)*
>> │   *└── index.html
>> │   ├── fonts/
>> │   │   └── ...
>> │   ├── static/
>> │   │   └── ...
>> │   ├── js/
>> │   │   └── ...*
>> ├── config/
>> │   ├── index.js# main project config
>> │   └── ...
>> ├── src/
>> │   ├── main.js # app entry file
>> │   ├── App.vue # main app component
>> │   ├── components/ # ui components
>> │   │   └── ...
>> │   └── assets/ # module assets (processed by webpack)
>> │   └── ...
>> ├── static/ # pure static assets (directly copied)
>> ├── test/
>> ...
>>
>> Actually I am doing this work in my NginX Server but I Will be happy if I 
>> can do the same thing easily using pure web2py
>>
>> Why using the same port?  Because the CORS issues, this is the best and easy 
>> way to deal with CORS. I know I can use sub-domains in the same port, I know 
>> I can use ALLOW ORIGIN headers in W2P side but that are not options for me 
>> in this case.
>>
>> NginX config working:
>>
>> location / {
>> index index.html index.htm;
>> root /home/www-data/vue/applications/simott;
>> try_files $uri $uri/ /index.html;
>> }
>>
>> location /api {
>> uwsgi_pass  unix:///tmp/web2py.socket;
>> include uwsgi_params;
>> uwsgi_param UWSGI_SCHEME $scheme;
>> uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
>>
>>}
>>
>> Any recommendations? Thanks in advance!
>>

Re: [web2py] Web2Py + VueJS SPA (Webpack)

2017-11-14 Thread José Luis Redrejo
Hi Carlos
I would recommend you to use this webpack helper:
https://github.com/Plortinus/vue-multiple-pages

Doing "vue init Plortinus/vue-multiple-pages new-project" you get the
structure to work, just add the div for app to the class and import the
page js per each page.

Also, in webpack.config.babel.js configuration file ,  if you add


  devServer: {
host: '127.0.0.1',
port: 8001,
historyApiFallback: false,
noInfo: true,
proxy: {
  '/yourapp/api/*': {
target: 'http://127.0.0.1:8080',
secure: false
// changeOrigin: true,
// pathRewrite: { '^/api': '' }
  }
},
  },


You can start web2py server, then webpack dev server and it will do queries
to web2py without any cors problem.

i.e
http://localhost:8001/api/whatever will automatically be fetched from
http://localhost:8080/yourapp/api/whatever

That's how I set it up for web2py to be the backend, and webpack dev server
to run the frontend.


Hope it helps
José L.

2017-11-14 17:48 GMT+01:00 Carlos A. Armenta Castro <
carlos.armen...@gmail.com>:

> I have using Web2Py for too many years for commercial websites and for
> Intranets in México, I want to say that Web2Py is an AMAZING Framework!!!
> For my new project I need to use an SPA VueJs + Webpack for the FrontEnd
> ( http://quasar-framework.org/ ) and a Web2Py as my BackEnd API Server.
> I'm curious about to integrate his two web frameworks using web2py routes
> to serve this two apps in the same port but different URL.
>
> Example:
> http://127.0.1.1/welcome/api ---> My Web2py API Controller
> http://127.0.1.1/welcome   ---> My VueJS APP with webpack  (
> http://quasar-framework.org/ ) <-- Pointing to index.html in *dist/ * and
> permit to use all the static files deposited in the same path *dist/**
>
> *VueJS + Webpack APP Structure*
>
> ├── *dist/ * *# Compiled APP (Serve this files as the 
> static SPA)*
> │   *└── index.html
> │   ├── fonts/
> │   │   └── ...
> │   ├── static/
> │   │   └── ...
> │   ├── js/
> │   │   └── ...*
> ├── config/
> │   ├── index.js# main project config
> │   └── ...
> ├── src/
> │   ├── main.js # app entry file
> │   ├── App.vue # main app component
> │   ├── components/ # ui components
> │   │   └── ...
> │   └── assets/ # module assets (processed by webpack)
> │   └── ...
> ├── static/ # pure static assets (directly copied)
> ├── test/
> ...
>
> Actually I am doing this work in my NginX Server but I Will be happy if I can 
> do the same thing easily using pure web2py
>
> Why using the same port?  Because the CORS issues, this is the best and easy 
> way to deal with CORS. I know I can use sub-domains in the same port, I know 
> I can use ALLOW ORIGIN headers in W2P side but that are not options for me in 
> this case.
>
> NginX config working:
>
> location / {
> index index.html index.htm;
> root /home/www-data/vue/applications/simott;
> try_files $uri $uri/ /index.html;
> }
>
> location /api {
> uwsgi_pass  unix:///tmp/web2py.socket;
> include uwsgi_params;
> uwsgi_param UWSGI_SCHEME $scheme;
> uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
>
>}
>
> Any recommendations? Thanks in advance!
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] unit testing newbiew ... and error...

2017-08-17 Thread José Luis Redrejo
Antonio, I would not recommend you usint unittest classes, if you read any
modern Python testing book or article, they all recommend using pytest.
I used it in this project
https://github.com/jredrejo/bancal/tree/master/web2py/applications/bancal
just in case it can help you.

Regards
José L.

2017-08-17 13:11 GMT+02:00 António Ramos :

> Hello i´m trying to test my web2py app
> Never used any testing before, so be patient..
>
> after reading this
>
> http://www.web2py.com/AlterEgo/default/show/260
>
> and this
> http://www.web2py.com/AlterEgo/default/show/213
>
>
> i tried the code but got this error
>
> [image: Imagem inline 1]
>
> i opened globals.py and saw init gets 2 params
> def __init__(self, env):
>
> and the code
> self.request=Request() is missing 1 param..
>
> any help?
>
> regards
> António
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Datatables Query String Parsing

2017-07-28 Thread José Luis Redrejo
I have used it several times, I thought of doing a reusable class for it,
but did't have time to do it yet.
For a query with only one table involved this is one code example.
I use the same code, with a small modifications in the way field values are
requested,  for queries with joined tables. That's why there are some
variables here that might not make sense when only one table is used
(table_order, table_search, etc.)
It includes searching for several field types:
For this example the table used is called api_logs:

In the view

var table = $('#lstable').DataTable({
sPaginationType: "full_numbers",
order: [[0, "desc"]],
processing: true,
serverSide: true,
autoWidth: true,
searching: true,
ajax: {
"url":"{{ =URL('api','logs_table.json') }}",
"type": "POST"
},


In the controller:


@service.json
def logs_table():
query_filter = None

if request.vars.start is not None:
iDisplayStart = int(request.vars.start)
else:
iDisplayStart = 0

if request.vars.length is not None:
iDisplayLength = int(request.vars.length)
else:
iDisplayLength = 10

if request.vars.draw is not None:
sEcho = int(request.vars.draw)
else:
sEcho = 1

def field_names(index):
name = request.vars['columns[%s][data]' % index]
return ('', name)

def field_names_join(index):
name = request.vars['columns[%s][data]' % index]
table = name.split("_")[0]
field = "_".join(name.split('_')[1:])
return (table, field)

if 'order[0][column]' in request.vars:
order_column = request.vars['order[0][column]']
else:
order_column = '0'

_, field_order = field_names(order_column)
table_order = 'api_logs'
orderby = db[table_order][field_order]
if 'order[0][dir]' in request.vars:
if request.vars['order[0][dir]'] == 'desc':
orderby = ~orderby

filtered_vars = dict(filter(lambda (a, b): b != '' and
'[search][value]' in a, request.vars.items())).keys()
for var_name in filtered_vars:
col = var_name.replace('columns[', '').replace('][search][value]',
'')
_, field_search = field_names(col)
table_search = 'api_logs'
field_type = db[table_search][field_search].type
if field_type == 'datetime':
dates = request.vars[var_name].split(' - ')
if len(dates) > 1:
fmt = '%d/%m/%Y'
start_date = datetime.strptime(dates[0], fmt)
end_date = datetime.strptime(dates[1], fmt) +
timedelta(days=1)
new_filter = (db[table_search][field_search] >= start_date)
& (db[table_search][field_search] < end_date)
elif field_type == 'boolean':
new_filter = db[table_search][field_search] == ('tr' in
request.vars[var_name].lower() or
'ye' in request.vars[var_name].lower())
elif field_type in ('string', 'text'):
string_filter = request.vars[var_name]
new_filter = db[table_search][field_search].ilike('%s%%' %
string_filter)
else:
new_filter = None
if new_filter:
if query_filter:
query_filter = query_filter & new_filter
else:
query_filter = new_filter
if query_filter is None:
query_filter = db.api_logs.id > 0
query = db(query_filter).select(db.api_logs.ALL,
limitby=(iDisplayStart, iDisplayStart + iDisplayLength),
orderby=orderby)

iTotalRecords = db(query_filter).count()


aaData = []

for row in query:
datarow = {}
for col in row:
if row[col] is not None:
if col == 'api_logs' or '_record' in col:
# internal dal col names
continue
elif col == 'added':  # datetime column , to be formatted
datarow[col] = row[col].strftime('%Y-%m-%d %H:%M:%S')
else:
datarow[col] = row[col]
else:
datarow[col] = ''

aaData.append(datarow)
return dict(draw=sEcho, recordsTotal=iTotalRecords,
recordsFiltered=iTotalRecords, data=aaData)



I hope it helps
Regards
José L.

2017-07-28 14:59 GMT+02:00 Richard Vézina :

> Here they talk about data structure and list seems possible :
> https://datatables.net/manual/server-side#Example-data
>
> Richard
>
> On Fri, Jul 28, 2017 at 8:52 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello Villas,
>>
>> The subject interrest me, as I use DTs, but not the server-side
>> feature... But, I am not sure what you want to achieve... I gonna read a
>> bit about DTs server-side, waiting for precision from you and maybe will
>> 

Re: [web2py] Web2py Docker

2017-07-22 Thread José Luis Redrejo
I have been using this in production for more than one year
https://hub.docker.com/r/jredrejo/web2py/

2017-07-22 3:43 GMT+02:00 :

> I've searched through the discussion archive before posting this question.
> There were few threads here and there but nothing definitive.
>
> Please share your experience with using the web2py docker image. Can you
> recommend a docker image(s) that you've been using in production?
>
> Thanks,
> CD
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: btw: great job

2017-04-26 Thread José Luis Redrejo
I recognize all what Massimo has done, of course, and to all the
contributors. Web2py is always my first option whenever I need to choose a
web framework.
However, I also think we have to thank to people like Anthony, Niphlod or
in the past Bruno Rocha or Jonathan Lundell who have been providing support
to all the community, specially to the newbies for years.

José L.

2017-04-25 17:54 GMT+02:00 Richard Vézina :

> +1
>
> I am eager to see what Massimo's future web2py spin off framework will
> offer... I was insecur about web2py future recently as Massimo didn't seems
> as active as before, but I guess he focus his efforts over the future
> framework which is a great news.
>
> Richard
>
> On Mon, Apr 24, 2017 at 5:02 PM, Carlos Kitu 
> wrote:
>
>> Yeah!
>> Awesome product and support. So good that I seldom need to make questions
>> in this forum.
>> Thank you and best regards.
>>
>>
>> El domingo, 23 de abril de 2017, 5:35:29 (UTC+2), lucas escribió:
>>>
>>> hey everyone,
>>>
>>> I think we should recognize and congratulate Massimo and the developers
>>> of web2py.  its been nearly a year since the last production update and the
>>> whole platform is just excellent.
>>>
>>> it is the most stable platform I've ever coded in.  I can literally
>>> dream it and code it like whisping magic off my fingers.  its like
>>> programming on a cloud.  I've been programming in web2py since 2009 and it
>>> really has been wonderful.  my end users love it too, not in the same way I
>>> do though.
>>>
>>> so lets tip our hats to web2py and appreciate its greatness, its
>>> stability, its power, and scalability.
>>>
>>> sincerely, lucas
>>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: web2py & react

2017-02-16 Thread José Luis Redrejo
Sorry, bad link in my previous email.
The article that inspired me was https://hackernoon.com/
reconciling-djangos-mvc-templates-with-react-components-3aa986cf510a#.
5605vfe3r

José L.

2017-02-16 19:04 GMT+01:00 José Luis Redrejo <jredr...@gmail.com>:

> Inspired by https://medium.com/react-redux/introducci%C3%B3n-a-redux-
> js-8bdf4fe0751e#.iqodqn8cc
> I have created a small project, using web2py instead of Django:
> https://github.com/jredrejo/web2pyreactpoc
>
>
> As usual, it's much easier ;)
>
> I've created three different pages, with different degrees of
> integration/difficulty
>
> I plan to add one more page using redux and a form, but that will take me
> longer and I don't have much free time.
>
> Just in case it helps anyone
>
> Regards
> José L.
>
>
> P.S. If someone can do the same using vue.js it would be great. I've never
> worked with this library but I've only heard good things, so it would be a
> nice way to compare them.
>
>
>

-- 
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 & react

2017-02-16 Thread José Luis Redrejo
Inspired by
https://medium.com/react-redux/introducci%C3%B3n-a-redux-js-8bdf4fe0751e#.iqodqn8cc
I have created a small project, using web2py instead of Django:
https://github.com/jredrejo/web2pyreactpoc


As usual, it's much easier ;)

I've created three different pages, with different degrees of
integration/difficulty

I plan to add one more page using redux and a form, but that will take me
longer and I don't have much free time.

Just in case it helps anyone

Regards
José L.


P.S. If someone can do the same using vue.js it would be great. I've never
worked with this library but I've only heard good things, so it would be a
nice way to compare them.

-- 
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] Changing the default PDF dowload filename (fpdf)

2017-02-12 Thread José Luis Redrejo
HI, this is how I do it:

response.headers['Content-Disposition'] = 'attachment; filename=as_you_wish.pdf'

regards
José L.

2017-02-13 1:04 GMT+01:00 Paul Ellis :

> When want to save a PDF made with FPDF and web2py. The filename is always
> the controller function name (pdf_view) in this case.
>
> I would like to make the filename take a value from the database. Customer
> name or Business name for example.
>
> I have tried adding a name in the output() but it doesn't help:
> response.headers['Content-Type'] = 'application/pdf'
> return pdf.output(name=bname, dest='S')
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: Scheduler and Serial Port Problems

2016-12-06 Thread José Luis Redrejo
Hi Richard, maybe I'm wrong, but I think this is  not related to web2py at
all.
Arduino boards are build to make a reset whenever the port is open/reopen
so they change to "programming" state.
This is made on purpose, but it's trivial to avoid it. If using an Arduino
UNO board, just connecting a 10μF capacitor between RESET and GND will
avoid those resets. Just remember to remove the capacitor if you need to
re-program your board.

Hope this was the issue.
José L.

2016-11-26 16:58 GMT+01:00 Richard Brown :

> I've now had chance to do some more investigation and research since my
> last posting and found the following. The reason that saving files in
> Web2py causes RTS to be asserted and makes my application work is that my
> file 'control.py', which contains all my serial functions, includes the
> lines:
>
> import serial
>
> ser=serial.Serial('/dev/ttyUSB0', 57600, timeout=1, xonxoff=0, rtscts=0)
>
>
> If I remove/comment out the line 'ser=serial.Serial... ' then the file
> save has no effect. Presumably Wb2py must be executing this line somehow as
> part of it's parsing process, and saving my other file 'utilities.py' has
> the same effect because it contains 'import * from control.py'.
>
> I have also been playing with the Pyserial functions ser.setRTS() and
> ser.rts, which should force the state of RTS. I have been running these
> from Python scripts in my user account and found that if reboot the
> Pi, save one of the files in Web2py to force RTS low, then execute ser.rts
> or ser.setRTS using my scripts, I can set RTS high or low and that state
> persists. However, if I reboot the Pi and run my script *without* saving
> the files in Web2py then run my scripts it only cause RTS to pulse low
> momentarily, presumably while the script is running. I've tried including a
> similar script within the Web2py 'modules' area, I've tried including the
> set.rts commands within my serial functions, I've tried a separate function
> just to include that command but nothing has done anything other than pulse
> RTS until the script/function ends. I haven't tried running a routine once
> at startup yet, but I'm not sure how this will be different from running
> scripts 'by hand', except as far as I am aware I cannot run scripts as
> the 'www-data' user as there is no login/password for that account, and I
> have a strange feeling that there must be some sort of ownership issue
> here. I have written/hacked scripts to run at startup to start the Web2py
> Scheduler and GPIOSever but this is all a bit close to the limits of my
> knowledge and ability!
>
> In summary, I am further forward in the sense that I understand why, if
> not how, Web2py file saves make my application work, although not why
> RTS gets set permanently low by this mechanism and not when the serial port
> is opened at any other time, and more information on what is happening here
> would be useful. I also know that there is a mechanism for changing the
> state of RTS, which it must be possible to do somehow, but have no real
> idea how to do it. I also now believe that keeping the port permanently
> open is not necessary, provided RTS can be forced low.
>
> So, any clues as to how I might be able to set RTS at startup will be
> gratefully received!
>
> Richard
>
>
>
>
>
> Richard
>
> On Friday, November 25, 2016 at 11:10:26 PM UTC, Dave S wrote:
>
>>
>>
>> On Friday, November 25, 2016 at 4:50:34 AM UTC-8, Richard Brown wrote:
>>>
>>> An update to this - I have done some more investigation and discovered
>>> that in the 'Not Working' scenario the RTS output is mostly high but goes
>>> low whilst the port is open, and in the 'Working' scenario the RTS output
>>> has somehow been forced low and so stays low when the port is opened.
>>> The Dongle gets reset by a high-to-low transition of RTS, so no falling
>>> edge, no Reset and everything works. For reference my Dongle uses an FTDI
>>> device (FT230X) and hence the FTDI driver supplied with the latest Raspbian
>>> (Jessie) release.
>>>
>>> The question now, therefore, is how Web2py forces RTS low - either by
>>> the saving of a file or when I access the index page of my Site, and How I
>>> can replicate this in the Scheduler code! Using 'touch' to update the file
>>> does not work, it has to be saved from within Web2py.
>>>
>>> Richard
>>>
>>
>> I can't imagine how saving the file causes RTS to go low.  Web2py should
>> not have any reason to do anything to the serial port on its own, and
>> probably doesn't even know the serial port exists (it's only concerned with
>> the console). (I haven't done any serial port handling under Ubuntu, nor on
>> the RaspberryPi, so I can't tell you about any special tricks such ports
>> need.)
>>
>> You may want to investigate having a separate program that gets started
>> on system startup, runs forever, and holds the serial port open all the
>> time.  It can check for a file existing, write the current value to the
>> file, and snooze again.  

Re: [web2py] Re: web2py react-python

2016-11-21 Thread José Luis Redrejo
Yes, thanks for the use case. I had not thought of that possibility.
Nowadays it's weird to think of someone using a non-javascript ready
browser.
José L.

2016-11-21 12:59 GMT+01:00 Mark Graves :

> Way better use case Leonel, thanks =)
>
> On Mon, Nov 21, 2016 at 3:44 AM, Leonel Câmara 
> wrote:
>
>> José a use case may be for graceful degradation when clients don't have
>> javascript.
>>
>> --
>> 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/GwaHrT4Dqxg/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 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] web2py react-python

2016-11-20 Thread José Luis Redrejo
I must confess my ignorance: Having read and played with react, and being a
long time web2py user, I don't get the point of rendering react in the
server from python, connected with a node application. I have made react
applications running in the view and using json to communicate with the
python controller, but react was always in the view and python in the
controller.
Can anybody tell me one use case or explain when could this pyhon-react
setup make sense?

Thanks
José L.

2016-11-20 10:25 GMT+01:00 Mark Graves :

> Hey everyone,
>
> I recently stumbled across this:
>
> https://github.com/markfinger/python-react/issues/70#
> issuecomment-254396083
>
> Just thought I'd share for anyone who was looking for something similar
>
> -Mark
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Some ideas for automatic field values

2016-07-30 Thread José Luis Redrejo
Have you tried update_naive when using the after_update trigger? It should
avoid the infinite loop

El 30/7/2016 8:06, "Carlos Cesar Caballero" 
escribió:

> Hi everyone, I am almost finishing a plugin for building automatic slug
> fields, but I want to build editable slugs.
>
> I can right now when the user creates a new record in the database, fill a
> field with the slug, but I need the ability to update it too.
> If the field is created for the very first time, I have an algoritm to
> create the slug (simply using the IS_SLUG validator), but if the field is
> edited, I need to use a different one, the problem is that the calculated
> field feature not specify whether the field is created or edited (or at
> least I don't find it), and I can't use the after_update trigger because it
> falls in an infinite loop when I update the field.
>
> How can I do that?
>
> Greetings.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Highcharts in web2py

2016-05-12 Thread José Luis Redrejo
I've played with highcharts and it's pretty simple if you use the json
decorator in web2py.
On the other hand, if you want a really free library I'd recommend you to
use d3js. The examples in its site are really good and you only need to
replace d3.tsv by d3.json(... calling the controller and format your
data in the controller to return the data in the same format that the tsv
file from the example to make them work.
Highcharts is a bit easier than d3js, but it's less flexible and you have
to pay a license to use it in a commercial application, while d3js is
totally free.

My 20 cents.
José L.

2016-05-11 15:52 GMT+02:00 Carlos Cesar Caballero Díaz <
desarro...@spicm.cfg.sld.cu>:

> Hi, is really easy integrate technologies like Highcharts in a web2py site
> using JSON, XML or CSV, here you can find how fill a chart from JSON, XML
> or CSV (http://www.highcharts.com/docs/working-with-data/data-intro) and
> you can look at the web2py book for JSON, XML or CSV data rendering (
> http://www.web2py.com/books/default/chapter/29/10/services#HTML-XML-and-JSON
> and http://www.web2py.com/books/default/chapter/29/10/services#CSV).
>
> Greetings.
>
> El 11/05/16 a las 09:15, kecajkecaj...@gmail.com escribió:
>
> Hi Guys,
>
> I was able to create simple graph by using highcharts.js  (
> http://www.highcharts.com/)  However since it's javascript it's really
> hard to add some data from controller. I found python module for highcharts:
>
>
> http://nbviewer.jupyter.org/github/arnoutaertgeerts/python-highcharts/blob/master/Tutorial.ipynb
>
>
> Anybody has an experience or idea how to create chart using it and how to
> display it in the view?
>
> Cheers.
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 create pdf report in web2py???

2016-05-10 Thread José Luis Redrejo
Latest fpdf code is in the contrib section of gluon libraries, and works
correctly. If your report is not too complicated I'd recommend you this
way. The demo from the above link is easy to follow.

2016-05-10 20:26 GMT+02:00 Dave S :

> On Tuesday, May 10, 2016 at 9:59:47 AM UTC-7, prashant joshi wrote:
>>
>> how to create pdf report in web2py?  i saw video on vimeo but this plugin
>> not found..
>>
>
>
> There are multiple ways to do it, but one way (which is briefly mentioned
> in the web2py book, and the pieces are in contrib)
> is shown at
> 
>
>  The fpdf link shown in the book appears to be out of date; try
> 
> (Mariano has additional credits in contrib)
>
> /dps
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] please help with new widgets

2016-03-14 Thread José Luis Redrejo
Massimo, I'm missing all the time a grid (sqlgrid) widget in these
examples. Aren't you considering it, or it's just it's not needed as the
style will apply and look good in the three cases?
Sqlgrid is one of the most powerful objects in web2py forms and I think
most of us could not live without it ;)

2016-03-14 7:34 GMT+01:00 joseph simpson :

> Should be:
>
> http://mdipierro.github.io/stupid.css/widgets/materialize.html
>
> On Sun, Mar 13, 2016 at 11:32 PM, joseph simpson 
> wrote:
>
>> I get a 404 on the:
>>
>> http://mdipierro.github.io/stupid.css/widgets/metarialize.html
>>
>> page..
>>
>> Take care and have fun..
>>
>> Joe
>>
>> On Sun, Mar 13, 2016 at 5:06 PM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> can somebody help me with this little project?
>>>
>>> http://mdipierro.github.io/stupid.css/widgets/index.html
>>> http://mdipierro.github.io/stupid.css/widgets/bootstrap.html
>>> http://mdipierro.github.io/stupid.css/widgets/metarialize.html
>>>
>>> Specifically, can you read the instructions? Do they make sense? can you
>>> help extend them? Does everything work for you?
>>> I am planning to release a new library for web2py called form.py that
>>> will replace SQLFORM and use the new widgets.
>>>
>>> Massimo
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Joe Simpson
>> “Reasonable people adapt themselves to the world. Unreasonable people
>> attempt to adapt the world to themselves. All progress, therefore,
>> depends on unreasonable people.”
>> George Bernard Shaw
>>
>
>
>
> --
> Joe Simpson
> “Reasonable people adapt themselves to the world. Unreasonable people
> attempt to adapt the world to themselves. All progress, therefore,
> depends on unreasonable people.”
> George Bernard Shaw
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: pdf utf-8 problem

2016-03-02 Thread José Luis Redrejo
If you're using fpdf, this will do the trick:

   reload(sys)
   sys.setdefaultencoding("latin-1")



2016-03-02 8:47 GMT+01:00 xmarx :

> i haven't find solution yet but i found rigth source to explore.
> http://pyfpdf.readthedocs.org/en/latest/Web2Py/index.html
>
> if i find, i will post here.
>
> 1 Mart 2016 Salı 21:04:44 UTC+2 tarihinde xmarx yazdı:
>
>> i have a page in charset utf-8.
>>
>> say testpdf.html
>>
>> when i type testpdf.pdf, some of non-ascii characters have been lost.
>> what can i do?
>>
>> second question, have can i specify styles of paragaphs, titles etc? it
>> doesn't recognize some of css styles.
>>
>> thank you.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Sublime Text? Plugins?

2016-02-27 Thread José Luis Redrejo
HI Dave, I think this is what you're looking for:
https://bitbucket.org/kfog/w2p


2016-02-26 23:50 GMT+01:00 Dave :

> I am not sure if any of you are using Sublime Text to write you code it,
> but I absolutely love it.  With the right plugins, it really makes writing
> code a joy.  Far more useful than any IDE I have ever used (even xcode and
> eclipse).  Anyway, I was installing a few new plugins this week and
> discovered there are a couple plugins out there for template language and
> code generation for Django.  I was wondering if any of you have created
> anything for web2py?  Of course, since web2py uses python as a template
> language there shouldn't be much to do except making the editor recognize
> {{ / }} and pass statements to end blocks.
>
> Anybody have anything they would like to share?  Perhaps I will see what
> functionality is there for some of the other python based frameworks and
> see what it would take to duplicate some of the automation in a web2py
> friendly way.  I just don't want to have to recreate the wheel if someone
> else has already done some of this work.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: web2py as a frontend for monitoring serial ports

2016-02-09 Thread José Luis Redrejo
Oliver: I use to do what you need to communicate with Arduino in different
projects. I think it's better if you get rid of the scheduler: you may
loose data if the serial port buffer is full while the scheduler is not
working.
What I use is:

   - write a script in an infinite loop like any usual pyserial script that
   reads from the serial port. The script must have a function that will begin
   the communication with the serial port after being open, def main() could
   be fine.
   - Put the script in the controllers directory of your web application,
   and use dal instructions to put the data in the database you prefer when
   receiving it from arduino. Sqlite is nice if the project won't have too
   many concurrent users.
   - Run the script from the web2py directory using: python web2py.py -M -S
   application_name/script_name/function_name, example  web2py.py -M -S
   scada/arduino/main
   - As you use in the script the same model from your application you can
   use all the data you have received in the db

This method is pretty easy and transparent.


Regards

José L.

2016-02-09 8:25 GMT+01:00 Oliver Holmes :

> Thanks to you both. I should clear up a slight misunderstanding. I have
> written the part, where the serial port is read (using pyserial). I am now
> trying to figure out, how to  connect this to web2py, so that it can serve
> the data nicely. It was my understanding, Massimo, that the scheduler was
> supposed to provide a way to not block the webservice with potentially
> blocking tasks - hence my question. My idea was to fill the SQLite tables I
> created in the web2py model with that scheduled task. Now you have
> discouraged me a bit. Could you please elaborate a bit on how you feel I
> should go about this task?
>
> And thanks, Marcelo, about an hour after my post, I realized that I could
> just download the latest source and use that... I am a little slow ;)
>
> Regards,
> Oliver
>
> Am Montag, 8. Februar 2016 10:23:54 UTC+1 schrieb Oliver Holmes:
>>
>> Hi,
>>
>> I'm new to web2py and quite frankly to python as well, so please bear
>> with me ;)
>> I would like to use web2py to serve data, that it has gathered and
>> processed from the serial port. There is new data available once a second.
>> Obviously I'll have to use the scheduler, to accomplish reading and
>> processing the serial port repeatedly. My question is this: How would I go
>> about setting up that worker task in the scheduler? And by the way, since
>> I'll be doing this on a RaspberryPi, how can I get a newer version than
>> "Version 1.99.7 (2012-03-04 22:12:08)" apt-get will not deliver anything
>> newer for my Raspian...
>>
>> Regards,
>> Oliver
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: web2py as a frontend for monitoring serial ports

2016-02-09 Thread José Luis Redrejo
2016-02-09 15:17 GMT+01:00 Oliver Holmes :

> José Luis,
>
> now that sounds promising! So, what I'd do is put my serial port reading
> procedure together with SQL inserts in an endless loop (while True) and
> just let it roll.
>

Right, but you can use DAL, not pure sql if you put the script in the
controllers directory.



> Later on though, I'd like to have it all wrapped up in a service to start,
> whenever the Raspberry booted. I'm guessing, that could be achieved after
> reading one or two how-to articles, so I'm not worried. I'll give this a go
> and let you all know about how it went.
>
>

just add it to /etc/rc.local, it should be as easy as that.




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

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


Re: [web2py] Re: Is there a Debian/Ubuntu PPA for web2py?

2016-01-31 Thread José Luis Redrejo
Hi,
https://packages.debian.org/sid/python-web2py

Debian package is on version 2.12.3
As usual, Ubuntu will pick that package for the next release they do.

2016-01-30 20:25 GMT+01:00 :

> Anthony  wrote:
> > >
> > > I run xubuntu on my home server, the current 15.10 version.
> > >
> > > The web2py available from the main Ubuntu repository is version 1.99
> > > which is rather out of date.
> > >
> > > I know I *could* install web2py by downloading the source tarball but
> > > then I'd have to remember to update it all the time.  Is there not a
> > > 'proper' web2py repository somewhere that holds the latest stable
> > > build as a .deb file so my system can keep itself up to date
> > > automatically?
> > >
> >
> > You probably don't want to update web2py automatically anyway -- you
> should
> > always test a new release before committing to it.
> >
> > Anthony
>
> OK, I wondered it that might be the answer I get!  :-)
>
> However, this is just a home server with (what may be) a few
> applications of my own for my use.  The family might use them too but
> that's all.
>
> Keeping up to date is, in a way, more important than knowing that
> everything will work all the time.
>
> The only other (major) webapp that I run that *isn't* automatically
> updated is Dokuwiki and that tells me when a new version is available
> whenever I (as an admin user) use its pages.
>
> Is there any way that web2py can at least *tell* me that there's a new
> version available?
>
> --
> Chris Green
> ·
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: web3py

2016-01-15 Thread José Luis Redrejo
Of course, option 2. It's the most logical path for all of us.

2016-01-14 23:43 GMT+01:00 Ovidio Marinho :

> 2
>
>
>
> Sent with MailTrack
> 
>
>
>
>
>
>[image: http://itjp.net.br] 
>  http://itjp.net.b r
>   *Ovidio Marinho Falcao Neto*
>  ovidio...@gmail.com
> Brasil
>
>
> 2016-01-14 20:14 GMT-02:00 Pbop :
>
>> Sounds like you have a good approach with option 2. That is my vote! You
>> can't get around that once a decision is made the community will react with
>> some degrees of enthusiasm and pushback.
>>
>> I am curious if the increase in performance is based on a more efficient
>> algorithm, Python3 is doing things faster or both?
>>
>> Keep up the good work.
>>
>>
>>
>> On Thursday, January 14, 2016 at 12:35:36 AM UTC-5, Massimo Di Pierro
>> wrote:
>>>
>>> It is another experiment.
>>>
>>> It is a rewrite of some of the web2py modules and supports 90% of the
>>> current web2py syntax at 2.5x the speed. It works. It it cleaner and should
>>> be easier to port to python 3 than current web2py.
>>>
>>> We are debating on web2py developers what to do:
>>> 1) backport some of the new modules to web2py (specifically the new Form
>>> class instead of SQLFORM)
>>> 2) try to reach a 99.9% compatibility and release it as new major
>>> version with guidelines for porting legacy apps
>>> 3) make some drastic changes in backward compatibility and release as a
>>> different framework (but change what? we like web2py as it is)
>>>
>>> For now I am working on 2 to see how far I can push the backward
>>> compatibility. But there are some functionalities I want remove or move in
>>> an optional module (from legacy_web2py import *).
>>>
>>> Feel free to share your opinion on web2py developers.
>>>
>>> Massimo
>>>
>>>
>>> On Wed, Jan 13, 2016 at 11:04 PM, kelson _ 
>>> wrote:
>>>
 I was looking at your recent web3py commits and hoped you could provide
 the web3py vision/intent (or point me towards it if I missed the
 discussion).

 Thanks,
 kelson

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

-- 
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] new redis_tools, new redis-backed scheduler

2016-01-04 Thread José Luis Redrejo
This is really interesting, specially the scheduler and the possibility of
sharing the redis connection.
Is there any ETA to have it in stable?

Thanks Niphlod

2016-01-03 0:44 GMT+01:00 Niphlod :

> Once PR1158 gets merged
> web2py will have a preferred way to use redis. It's through the new
> gluon.contrib.redis_utils "RConn".
> Some redis libraries are coming along and redis-py, while maintaining a
> solid "#1 position" among them, could be one day in #2.
> Moreover, connection parameters passed to redis have been added and it's
> been almost impossible to keep web2py's modules that use redis in sync.
> It'd have meant to lock a particular release of redis-py to a particular
> release of web2py's contrib redis_* modules.
> Seen that and issue#958 , a
> refactor was needed. Better late than ever, the refactor is here.
>
> This bring BREAKING changes for the next version of web2py. Anyone using
> gluon.contrib.redis_cache and/or gluon.contrib.redis_session will need to
> alter app's code to match the new behaviour.
> Basically now every module in web2py that uses redis needs (and should,
> for new modules you may want to contrib) to have a redis_conn parameter
> that takes a redis instance. That redis instance can be provided out of the
> box - tuned for the unique environment of web2py - with
>
> from gluon.contrib.redis_utils import RConn
> rconn = RConn()
>
> now, RConn takes ALL parameters and passes them unchanged down the pipe
> directory to redis.StrictRedis .
>
> This means that any parameter that was used to connect to redis for those
> modules isn't there anymore.
> Specifically, if you had a redis instance available at 10.0.0.10 on port
> , your instantiation of RedisCache was similar to
>
> from gluon.contrib.redis_cache import RedisCache
> cache.redis = RedisCache('10.0.0.10:',debug=True)
>
> from here on, it'll be instead
>
> from gluon.contrib.redis_utils import RConn
> from gluon.contrib.redis_cache import RedisCache
> rconn = RConn(host='10.0.0.10', port=)
> cache.redis = RedisCache(redis_conn=rconn,debug=True)
>
> want to connect to redis through ssl (previously unavailable)? pass the
> relevant ssl, ssl_keyfile, etc etc etc to RConn.
>
> You can also reuse the rconn object as if it was a redis.StrictRedis
> instance in your app's code. Everything will work fine. Just use a sane key
> prefix (all modules use "w2p") in order to avoid conflicts. redis_cache,
> redis_session and redis_scheduler (and your app) can use a single RConn
> instance without issues.
>
> Was this only a refactor ? Nope!
> There is also a new (not so shiny, 'cause - guilty as charged - I'm using
> it for 10 months in production now) redis-backed scheduler.
> Of course it's experimental (as everything in contrib) but it's not
> untested (all w2p_scheduler_tests
>  passed).
> This is one of the first modules completely coded on Windows (sigh). Linux
> has been tested too through w2p_scheduler_tests (still waiting for someone
> to come up with unittests that will run on our CI) but the production
> environment kicking for 10 months is WS2012R2 with redis 3.0 .
> RScheduler is a slip-in of the factory scheduler, with the - usual -
> redis_conn parameter.
>
> from gluon.contrib.redis_utils import RConn
> from gluon.contrib.redis_scheduler import RScheduler
> rconn = RConn()
> mysched = RScheduler(db, ..., redis_conn=rconn)
>
> This first release basically moves everything happening in the
> scheduler_worker table to redis, to alleviate locking and contention where
> it happens the most.
> It'll probably enable usage patterns for who had problems in production
> with a high number of workers. It's also a lot snappier because with redis
> tasks gets from QUEUED to RUNNING without passing from ASSIGNED. Use it,
> test it, break it, fix it (or report bugs). Read the source code, improve
> it, move ideas around just crunch tasks...do whatever you want with it.
> Hope you'll find it as useful as I am.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

Re: [web2py] markmin, pyfpdf, qr and utf-8-code

2015-06-05 Thread José Luis Redrejo
I don't think you can mix markmin with fpdf  (using the html to pdf
functions).
You will have to build your pdf in the controller picking up the text from
the html.

2015-06-04 23:27 GMT+02:00 Martin Weissenboeck mweis...@gmail.com:

 What I want to do:


- I want to write some pages using markmin.
- Headlines should be centered and the date should be aligned right.
- These pages contain non-ASCII-characters, therefore I need utf-8.
- There should be a qr-code on the first page.
- At the end I want to get these pages as HTML-code and as pdf.


 I have found:

- right-aligned text: I have written something like
​t=markmin(``text``:right, extra=dict(right=lambda t: P(t,
_align=right)))
- pyfpdf needs pdf.add_font(..., uni=True), but pdf.write_html does
not understand this font.
I have to use pdf.write_html(font face='DejaVu'%s/font % t)
- ​A qr in markmin creates a nice qr-picture, but the pyfpdf command
write_html does not accept it.​



 All these steps are a little bit complicated. ​It seems that it is not
 possible to combine all these requests in a simple way. Or has anybody a
 better solution?​

 Regards., Martin

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


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


Re: [web2py] Re: IMPORTANT - WEB2PY CONSULTING

2015-03-05 Thread José Luis Redrejo
2015-03-04 22:26 GMT+01:00 Manuele Pesenti manuele.pese...@gmail.com:

 Il 04/03/15 17:40, Chris ha scritto:
  I do web2py consulting work on the side but I'm an individual. Can I
  include just an email address, and not a webpage?
 me too... in Italy.



And me too, in Spain...




 M.

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


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


Re: [web2py] PDF view - set printing page size

2015-02-25 Thread José Luis Redrejo
2015-02-24 14:36 GMT+01:00 Pavel pavel@gmail.com:

 Really thanks José,
 your labels app help me with understanding fpdf. My apps is working now.



You're welcome

 Little problem is unicode characters. I tried examples from fpdf wiki
 pages, but without success.
 Fortunately all dynamic fields on our ID cars is numbers and characters
 without accent.


Yes, all of us who don't live in english spoken countries share the same
problem.
There are two solutions for this issue, depending on the charset you need.

The easy one is executing:

import sys
reload(sys)
sys.setdefaultencoding(latin-1)

In the function you are generating the pdf. This works for me with accents
or spanish ñ.


But, if there are some chars not available in latin-1 encoding (like the
european currency €) the second solution is loading a true type font:

As an example:
import sys

reload(sys)
sys.setdefaultencoding(utf-8)

pdf.add_font('DejaVu', '',os.path.join(request.folder,'static',
'DejaVuSansCondensed.ttf'), uni=True)

This should work like a charm (if you leave the file
DejaVuSansCondensed.ttf  in the static folder of your application)


Regards
José L.




 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.


-- 
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] PDF view - set printing page size

2015-02-23 Thread José Luis Redrejo
I think this could be useful for you:
https://github.com/jredrejo/Labels-for-pyfpdf

2015-02-22 9:50 GMT+01:00 Pavel pavel@gmail.com:


 Hallo,
 I am making simple app for registrations and printing ID cards. I have
 simple pdf view. For instance:

 {{
 import os
 from gluon.contrib.generics import pdf_from_html
 html = 'Today is: ' + str(request.now)
 =pdf_from_html(html)
 }}


 How to specify PDF page size for instance like credit card size?

 Thank you very much for any advice.

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


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


Re: [web2py] Ubuntu: python-web2py 1.99.7-1

2015-01-20 Thread José Luis Redrejo
Ubuntu takes this package from Debian. I will update the package in Debian
soon, with version 2.9.12  (or maybe .13 if some problems from this list
are confirmed).
Then, you can ask Ubuntu to pull it from Debian.
Regards.

2015-01-19 14:23 GMT+01:00 Y yannick.hagm...@gmail.com:

 Hello

 There only seems to be available a very old version of web2py in the
 Ubuntu Software-Center. Could you update it?

 Kind regards

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


-- 
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 python.org layout

2014-03-23 Thread José Luis Redrejo
2014-03-22 23:21 GMT+01:00 Mariano Reingart reing...@gmail.com:
 Great news:

 We are now listed in https://www.python.org/

 Congrats and thanks to the maintainers added it and that closed the ticket!




I wouldn't close it so quickly. It's only on the frontpage, but no
mention at https://www.python.org/about/apps where any interested
person would browse just after see the frontpage.







 Best regards

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


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

-- 
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] Font size and FPDF Report

2013-12-22 Thread José Luis Redrejo
Hello Alfonso
you can not use css with fpdf. It doesn't understand most of it, you
have to use html.
To change font size, I use, as an example:
pdf.write_html('font size=10' + tabla.xml().decode('utf-8') + '/font')

where tabla is a html table I've previously built using web2py html
helpers  (TR, TH,TBODY,TD,TABLE,THEAD , etc.)

Hope this helps.
Regards.


2013/12/20 Alfonso Pastor Sierra alfonso.pas...@gmail.com:
 Hi, I have the code for a PDF Report:

 def export_pdf():

 title = Informe de impresiones

 head = THEAD(TR(TH(Fecha/Hora,_width=16%),
 TH(Impresora,_width=17%),
 TH(Host,_width=10%),
 TH(Usuario,_width=10%),
 TH(Trabajo,_width=33%),
 TH(Pag,_width=4%),
 TH(Cop,_width=4%),
 TH(Total,_width=6%),
 _bgcolor=#A0A0A0))


 rowsTable = []
 i=0;

 rows=consultaInforme()

 for r in rows:

 col = i % 2 and #F0F0F0 or #FF

 documento=r[6].encode(latin_1,replace)[:50]

 rowsTable.append(TR(TD(r[1], _align=left),
TD(r[2], _align=left),
TD(r[5], _align=left),
TD(r[4], _align=left),
TD(documento, _align=left),
TD(r[7], _align=center),
TD(r[8], _align=center),
TD(r[9], _align=center),
_bgcolor=col))

 i+=1

 body = TBODY(*rowsTable)
 table = TABLE(*[head, body], _border=1, _align=center,
 _width=100%)

 class MyFPDF(FPDF, HTMLMixin):

 def __init__(self):
 FPDF.__init__(self,'L')

 def header(self):
 self.set_font('Arial','B',15)
 self.cell(0,10, title ,1,0,'C')

 def footer(self):
 self.set_y(-15)
 self.set_font('Arial','I',8)
 self.cell(0,10,IES,0,0,'L')
 txt = 'Pag. %s de %s' % (self.page_no(), self.alias_nb_pages())
 self.cell(0,10,txt,0,0,'R')

 pdf=MyFPDF()
 pdf.add_page()

 pdf.write_html(str(XML(table, sanitize=False)))

 response.headers['Content-Type']='application/pdf; charset=utf-8'
 doc=pdf.output(dest='S')
 doc64=embed64(data=doc,extension='application/pdf')
 return 'window.open(%s);' % doc64

 def consultaInforme():

 blah..blah.blah
 .


 consulta=cdb.executesql(sql)

 return consulta


 And I want to change the font-size of the text inside the table, but I
 can't.
 I have tried without success:


   rowsTable.append(TR(TD(r[1], _align=left),
TD(r[2], _align=left),
TD(r[5], _align=left),
TD(r[4], _align=left),
TD(documento, _align=left),
TD(r[7], _align=center),
TD(r[8], _align=center),
TD(r[9], _align=center),
_bgcolor=col, _style=font-size: 8px;))



 and

 pdf=MyFPDF()
 pdf.add_page()
 pdf.set_font('Arial','',10)
 pdf.write_html(str(XML(table, sanitize=False)))



 But never changes the font size in pdf.

 Can you help me?





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

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


Re: [web2py] Re: Javascript event onchange with Calendar

2013-11-06 Thread José Luis Redrejo
Derek, thank you for the info. I could not guess it was so
complicated. I don't like to modify files that are part of the
framework as they will change with future updates.
Don't you think this is a bug that should be fixed in web2py?

2013/11/6 Derek sp1d...@gmail.com:
 You can't do that, because of recent changes in web2py.js source code by
 niphlod. The 'calendar' js does have a method that would work after the date
 was changed.
 https://github.com/web2py/web2py/commit/cd30382c0ebefeeef1149214acb36e5fd6c93469#diff-51450f2685f2ecf74b1835b4fc2bc16cR182
 (see line 182 - he specifically sets the 'onChange' of the input.datetime)

 To do that, you need to modify the web2py.js file, line 188 which sets up
 the calendar - you have to add your callback. In the setup you need to
 define what 'onUpdate' does.
 See the documentation to the calendar widget used here:
 https://wiki.umn.edu/pub/TWiki/JSCalendarContrib/doc/html/reference.html


 On Tuesday, November 5, 2013 10:51:53 AM UTC-7, José L. wrote:

 Hi,
 I'm having problems with the Calendar used for date fields in an SQLFORM.
 In the web page, the javascript onchange does never happen (tested
 with Firefox and Google chrome). Other events like click or focusout
 works correctly, and other fields with other text input widgets work
 correctly too.

 Is there any way to handle when the user  changes the date after
 clicking on a calendar day?

 Thanks
 José L.

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

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


[web2py] Javascript event onchange with Calendar

2013-11-05 Thread José Luis Redrejo
Hi,
I'm having problems with the Calendar used for date fields in an SQLFORM.
In the web page, the javascript onchange does never happen (tested
with Firefox and Google chrome). Other events like click or focusout
works correctly, and other fields with other text input widgets work
correctly too.

Is there any way to handle when the user  changes the date after
clicking on a calendar day?

Thanks
José L.

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


Re: [web2py] Javascript event onchange with Calendar

2013-11-05 Thread José Luis Redrejo
2013/11/5 Diogo Munaro diogo.mvie...@gmail.com:
 Hi josé, you tried handle onchange with jquery on function? Phehaps some js
 after declared is changing you handle. So, try:

 $(item).on(change, function(){});



Yes, and it doesn't work. In fact this is part of my code:

   jQuery(#CabeceraEntrada_Fecha).change(function() {
set_parametros('fecha',jQuery(this));
   });

   jQuery(#CabeceraEntrada_tipoProcedencia).change(function() {
set_parametros('procedencia',jQuery(this));
   });

jQuery('#CabeceraEntrada_Codigo').change(function(){
  set_parametros('codigo',jQuery(this));
});

#CabeceraEntrada_Codigo is a normal text input (integer datafield),
#CabeceraEntrada_tipoProcedencia is a select (IS_IN_SET datafield
requirement) and #CabeceraEntrada_Fecha is a text input with calendar
(date datafield).
With the same code, they all execute set_parametros function,
excepting #CabeceraEntrada_Fecha






 Em 05/11/2013 15:52, José Luis Redrejo jredr...@gmail.com escreveu:

 Hi,
 I'm having problems with the Calendar used for date fields in an SQLFORM.
 In the web page, the javascript onchange does never happen (tested
 with Firefox and Google chrome). Other events like click or focusout
 works correctly, and other fields with other text input widgets work
 correctly too.

 Is there any way to handle when the user  changes the date after
 clicking on a calendar day?

 Thanks
 José L.

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

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

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


Re: [web2py] Javascript event onchange with Calendar

2013-11-05 Thread José Luis Redrejo
2013/11/6 Diogo Munaro diogo.mvie...@gmail.com:
 No jose, try use .on instead of .change as the example


I tried it too, without success.


 Em 05/11/2013 16:19, José Luis Redrejo jredr...@gmail.com escreveu:

 2013/11/5 Diogo Munaro diogo.mvie...@gmail.com:
  Hi josé, you tried handle onchange with jquery on function? Phehaps some
  js
  after declared is changing you handle. So, try:
 
  $(item).on(change, function(){});
 


 Yes, and it doesn't work. In fact this is part of my code:

jQuery(#CabeceraEntrada_Fecha).change(function() {
 set_parametros('fecha',jQuery(this));
});

jQuery(#CabeceraEntrada_tipoProcedencia).change(function() {
 set_parametros('procedencia',jQuery(this));
});

 jQuery('#CabeceraEntrada_Codigo').change(function(){
   set_parametros('codigo',jQuery(this));
 });

 #CabeceraEntrada_Codigo is a normal text input (integer datafield),
 #CabeceraEntrada_tipoProcedencia is a select (IS_IN_SET datafield
 requirement) and #CabeceraEntrada_Fecha is a text input with calendar
 (date datafield).
 With the same code, they all execute set_parametros function,
 excepting #CabeceraEntrada_Fecha






  Em 05/11/2013 15:52, José Luis Redrejo jredr...@gmail.com escreveu:
 
  Hi,
  I'm having problems with the Calendar used for date fields in an
  SQLFORM.
  In the web page, the javascript onchange does never happen (tested
  with Firefox and Google chrome). Other events like click or focusout
  works correctly, and other fields with other text input widgets work
  correctly too.
 
  Is there any way to handle when the user  changes the date after
  clicking on a calendar day?
 
  Thanks
  José L.
 
  --
  Resources:
  - http://web2py.com
  - http://web2py.com/book (Documentation)
  - http://github.com/web2py/web2py (Source code)
  - https://code.google.com/p/web2py/issues/list (Report Issues)
  ---
  You received this message because you are subscribed to the Google
  Groups
  web2py-users group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to web2py+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
  --
  Resources:
  - http://web2py.com
  - http://web2py.com/book (Documentation)
  - http://github.com/web2py/web2py (Source code)
  - https://code.google.com/p/web2py/issues/list (Report Issues)
  ---
  You received this message because you are subscribed to the Google
  Groups
  web2py-users group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to web2py+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

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

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

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


Re: [web2py] Re: Load with ajax doesn't work since upgrade 1.6

2013-10-11 Thread José Luis Redrejo
Movuca app from Bruno, available at Github has this behaviour.
El 11/10/2013 21:05, Niphlod niph...@gmail.com escribió:

 can you pack a minimal app to reproduce the behaviour please ? I can't
 reproduce the issue you're seeing

 On Friday, October 11, 2013 8:55:19 AM UTC+2, Michael Helbling wrote:


 yes, jquery.js and web2py.js are configured in web2py_ajax.html and
 jquery.js is preceding web2py.js:
 {{
 response.files.insert(0,URL('**static','js/jquery.js'))
 response.files.insert(1,URL('**static','css/calendar.css'))
 response.files.insert(2,URL('**static','js/calendar.js'))
 response.files.insert(3,URL('**static','js/web2py.js'))
 response.files.insert(4,URL('**static','js/jquery.blockUI.js'**))
 response.include_meta()
 response.include_files()
 }}


 The workaround from José works. After replacing the compileapp.py through
 the old one, every load is working again. I'll take a closer look at the
 file in the afternoon.


 Am Donnerstag, 10. Oktober 2013 21:15:40 UTC+2 schrieb Niphlod:

 is jquery.js preceding web2py.js in your layout.html ?

 On Thursday, October 10, 2013 8:27:04 AM UTC+2, Michael Helbling wrote:


 Yes, i already copied the web2py.js, appadmin controller and views from
 the latest welcome app to all my apps.
 Without copying the web2py.js, no load worked. But even with the latest
 web2py.js, not all loads are working. that's my problem and i don't know
 why some load doesn't work. In version 2.5.1 with the old web2py.js all
 loads worked and in version 2.7.1 with the new web2py.js ~30% of the loads
 in our app don't work anymore.

 as described, i don't know what to try anymore. May you can give me a
 hint what i could try additionally?


 Am Mittwoch, 9. Oktober 2013 18:53:02 UTC+2 schrieb Massimo Di Pierro:

 You need to copy web2py.js from the latest welcome app into your old
 app.


 On Wednesday, 9 October 2013 04:57:20 UTC-5, Michael Helbling wrote:

 First of all to avoid this question: Yes I copied the appadmin and
 javascript file from the welcome app to my own app ;-)




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


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


Re: [web2py] Re: Load with ajax doesn't work since upgrade 1.6

2013-10-11 Thread José Luis Redrejo
El 11/10/2013 21:52, Niphlod niph...@gmail.com escribió:

 talking about minimal app, heh anyway, better than nothing.

I know, but I am answering from my phone, without a PC available ;)

 taken movuca, setupped, doesn't work (as advertised in web2py's
changelog).
 Take web2py.js from welcome and overwrite web2py.js in
/static/bootstrap/js/web2py.js
 Next issue, movuca ships jquery 1.7.1 (november 2011).
 web2py.js requires something jquery having $.parseHTML ... update jquery
too and you'll only receive a problem about bootstrap-transition.js, that
is trying to do something with the (now unsupported) $.browser.
 Update bootstrap-transition.js and movuca works like a charm.


I will check it again, maybe I made some mistake copying those files, but I
knew this has to be done.

Thanks

 tl;dr : movuca just needs a few upgrades to work.


 On Friday, October 11, 2013 9:19:01 PM UTC+2, José L. wrote:

 Movuca app from Bruno, available at Github has this behaviour.

 El 11/10/2013 21:05, Niphlod nip...@gmail.com escribió:

 can you pack a minimal app to reproduce the behaviour please ? I can't
reproduce the issue you're seeing

 On Friday, October 11, 2013 8:55:19 AM UTC+2, Michael Helbling wrote:


 yes, jquery.js and web2py.js are configured in web2py_ajax.html and
jquery.js is preceding web2py.js:
 {{
 response.files.insert(0,URL('static','js/jquery.js'))
 response.files.insert(1,URL('static','css/calendar.css'))
 response.files.insert(2,URL('static','js/calendar.js'))
 response.files.insert(3,URL('static','js/web2py.js'))
 response.files.insert(4,URL('static','js/jquery.blockUI.js'))
 response.include_meta()
 response.include_files()
 }}


 The workaround from José works. After replacing the compileapp.py
through the old one, every load is working again. I'll take a closer look
at the file in the afternoon.


 Am Donnerstag, 10. Oktober 2013 21:15:40 UTC+2 schrieb Niphlod:

 is jquery.js preceding web2py.js in your layout.html ?

 On Thursday, October 10, 2013 8:27:04 AM UTC+2, Michael Helbling
wrote:


 Yes, i already copied the web2py.js, appadmin controller and views
from the latest welcome app to all my apps.
 Without copying the web2py.js, no load worked. But even with the
latest web2py.js, not all loads are working. that's my problem and i don't
know why some load doesn't work. In version 2.5.1 with the old web2py.js
all loads worked and in version 2.7.1 with the new web2py.js ~30% of the
loads in our app don't work anymore.

 as described, i don't know what to try anymore. May you can give me
a hint what i could try additionally?


 Am Mittwoch, 9. Oktober 2013 18:53:02 UTC+2 schrieb Massimo Di
Pierro:

 You need to copy web2py.js from the latest welcome app into your
old app.


 On Wednesday, 9 October 2013 04:57:20 UTC-5, Michael Helbling wrote:

 First of all to avoid this question: Yes I copied the appadmin and
javascript file from the welcome app to my own app ;-)




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

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

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

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


Re: [web2py] Re: Load with ajax doesn't work since upgrade 1.6

2013-10-10 Thread José Luis Redrejo
I have the same problem since 2.6.1 and, also, after copying those
files without sucess I've got it working replacing the file
gluon/compileapp.py with the one from version 2.5.1. You can get that
web2py version from
http://web2py.com/examples/static/2.5.1/web2py_src.zip.
I haven't had time to investigate the changes between both versions
(I've checked the diff is pretty small), but it's a workaround that
saved my day.
Hope this helps.
José L.

2013/10/10 Michael Helbling helbling.mich...@gmail.com:

 Yes, i already copied the web2py.js, appadmin controller and views from the
 latest welcome app to all my apps.
 Without copying the web2py.js, no load worked. But even with the latest
 web2py.js, not all loads are working. that's my problem and i don't know why
 some load doesn't work. In version 2.5.1 with the old web2py.js all loads
 worked and in version 2.7.1 with the new web2py.js ~30% of the loads in our
 app don't work anymore.

 as described, i don't know what to try anymore. May you can give me a hint
 what i could try additionally?


 Am Mittwoch, 9. Oktober 2013 18:53:02 UTC+2 schrieb Massimo Di Pierro:

 You need to copy web2py.js from the latest welcome app into your old app.


 On Wednesday, 9 October 2013 04:57:20 UTC-5, Michael Helbling wrote:

 First of all to avoid this question: Yes I copied the appadmin and
 javascript file from the welcome app to my own app ;-)




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

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


Re: [web2py] how to use google.directions 0.3

2013-06-03 Thread José Luis Redrejo
It seems the library author has included references to another lib made by
him, and forgotten to add it.
According to your error, google.directions needs
http://d9t.de/open-source/python/d9t.json .


2013/6/3 Nam Soo In sheldon.sooin@gmail.com

 I am trying to use lib
 google.directions 0.3
 I downloaded lib from https://pypi.python.org/pypi/google.directions
 and installed it python setup.py install
 moved gdapy.py under modules
 try to run example code on web2py
 It returns an error that
 No module named d9t.json.parser

 Any solution for that?

 Thanks in advance

 --

 ---
 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 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] web2py 2.4.3 is OUT

2013-03-11 Thread José Luis Redrejo
2013/3/11 Massimo Di Pierro massimo.dipie...@gmail.com:
 Fixes many bugs reported by users.

 The web page has a new look. I hope you like it.

 http://web2py.com


I like the new look, but the link to the interactive demo under the
Web-Based IDE does not work.

-- 

--- 
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: Debugging with the scheduler

2013-02-27 Thread José Luis Redrejo
2013/2/26 Niphlod niph...@gmail.com:
 never done it, but debugging a multiprocessing spawned process needs
 additional tuning http://pydev.org/manual_adv_remote_debugger.html

 PS: can I ask what is not working ? if it's a focused problem maybe I can
 come up with an answer .

I've fixed it , it was a problem with a locked file when using shelve.
I've used a workaround but I don't feel happy with the solution (it
works but's terribly ugly). Any idea to exchange a big Python list
with data between the main web2py application and the long-lasting
backgroud process is welcome.

Regards.




 On Tuesday, February 26, 2013 9:12:23 PM UTC+1, José L. wrote:

 Hello,
 I'm working with async processes using the scheduler (with the
 unvaluable help of the learn by trial application from Niphlod.

 I wonder if there's an easy way to debug the processes that are being
 executed in the background (I'm  having problems with them, they work
 ok when run from web2py directly as a normal process, but not when
 they're executed by the scheduler).
 Pdb would be great, but if not, is there any way to use the ugly but
 useful print vars commands to see the flow of execution of the
 tasks?

 I know of the output field in the scheduler_task table in the
 database, but that's terribly slow

 Regards.
 José L.

 --

 ---
 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 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] Debugging with the scheduler

2013-02-26 Thread José Luis Redrejo
Hello,
I'm working with async processes using the scheduler (with the
unvaluable help of the learn by trial application from Niphlod.

I wonder if there's an easy way to debug the processes that are being
executed in the background (I'm  having problems with them, they work
ok when run from web2py directly as a normal process, but not when
they're executed by the scheduler).
Pdb would be great, but if not, is there any way to use the ugly but
useful print vars commands to see the flow of execution of the
tasks?

I know of the output field in the scheduler_task table in the
database, but that's terribly slow

Regards.
José L.

-- 

--- 
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: Pattern to run async proccess

2013-02-02 Thread José Luis Redrejo Rodríguez
I've been studying the scheduler, but I think it fails in one of the
things I need:
The web page must be updated as the process is being done
i.e. if the scheduler is doiing some background task, I need to update
the web page with the progress of the task, but I don't find how to do
it with the scheduler

2013/2/1 Massimo Di Pierro massimo.dipie...@gmail.com:
 yes. If the worker is not busy it starts the task immediately. You can also
 have more than one worker.


 On Friday, 1 February 2013 11:10:11 UTC-6, José Luis Redrejo Rodríguez
 wrote:

 Thanks for your advice Massimo, but
 does the scheduler start inmediately when no worker has been used before?


 2013/2/1 Massimo Di Pierro massimo@gmail.com:
  All that you ask can be done using the scheduler except that your app
  does
  not start the process, but submits a request to the scheduler. The
  scheduler
  runs the app when a worker is available. This is to prevent spikes in
  resource utilization when multiple processes start. The task can
  communicate
  with the app vid database and/or filesystem (which is ok but not 100%
  satisfactory). Web2py can monitor and kill running scheduler tasks.
 
  This works well for most types of tasks but not for tasks that need a
  lot of
  IO with your application. I do not have a satisfactory solution in that
  case. You want the tasks to have some way to communicate asynchronously
  with
  the client and this present major issues, some related with security.
 
 
  On Friday, 1 February 2013 10:22:35 UTC-6, José Luis Redrejo Rodríguez
  wrote:
 
  Hi, This is a question that has been asked several times in the list,
  and I have also had to implement this kind of app in the past.
  Now I'm also facing to another application where I need to run a
  resource_and_time_consuming process managed from web2py.
 
  The exact problem is:
  - From a web page, a long process must be started
  - The web page must be updated as the process is being done
  - The web page must be able to cancel the process.
 
  In the past I have had to deal with the fact of sessions lockings:
  web2py server doesn't react while the process is being executed. I've
  solved this by using session.forget(response), but this solution
  avoids the use of session variables to update the process in the
  original web page.
 
  I've used background processes, queues, etc, These solutions work when
  time is not an issue, but not when the synchronization between the
  process and the webpage must be fast and accurate
 
  I wonder if someone has a definitive pattern to do this kind of action.
 
  Regards
  José L.
 
  --
 
  ---
  You received this message because you are subscribed to the Google
  Groups
  web2py-users group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to web2py+un...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --

 ---
 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 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: Pattern to run async proccess

2013-02-02 Thread José Luis Redrejo Rodríguez
Niphlod Thanks very much , your learn by trial application has been
gold for me. Catched!!

2013/2/2 Niphlod niph...@gmail.com:
 you must save somewhere in your long_time_consuming_function() the
 progress and let the page show that.

 If you manage that function outside web2py (using the scheduler or not), you
 need something readable by your page and writeable by the external process.
 A record on the db, a file, something. The scheduler has a facility you can
 use for that

 http://web2py.com/books/default/chapter/29/04#Scheduler-%28experimental%29

 under the section reporting percentages .

 if you want to get familiar with the scheduler you can look at this learn
 by trial application

 https://github.com/niphlod/w2p_scheduler_tests

 let me know if you need further assistance on the scheduler's side.

 --

 ---
 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 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] Pattern to run async proccess

2013-02-01 Thread José Luis Redrejo Rodríguez
Hi, This is a question that has been asked several times in the list,
and I have also had to implement this kind of app in the past.
Now I'm also facing to another application where I need to run a
resource_and_time_consuming process managed from web2py.

The exact problem is:
- From a web page, a long process must be started
- The web page must be updated as the process is being done
- The web page must be able to cancel the process.

In the past I have had to deal with the fact of sessions lockings:
web2py server doesn't react while the process is being executed. I've
solved this by using session.forget(response), but this solution
avoids the use of session variables to update the process in the
original web page.

I've used background processes, queues, etc, These solutions work when
time is not an issue, but not when the synchronization between the
process and the webpage must be fast and accurate

I wonder if someone has a definitive pattern to do this kind of action.

Regards
José L.

-- 

--- 
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: Pattern to run async proccess

2013-02-01 Thread José Luis Redrejo Rodríguez
Thanks for your advice Massimo, but
does the scheduler start inmediately when no worker has been used before?


2013/2/1 Massimo Di Pierro massimo.dipie...@gmail.com:
 All that you ask can be done using the scheduler except that your app does
 not start the process, but submits a request to the scheduler. The scheduler
 runs the app when a worker is available. This is to prevent spikes in
 resource utilization when multiple processes start. The task can communicate
 with the app vid database and/or filesystem (which is ok but not 100%
 satisfactory). Web2py can monitor and kill running scheduler tasks.

 This works well for most types of tasks but not for tasks that need a lot of
 IO with your application. I do not have a satisfactory solution in that
 case. You want the tasks to have some way to communicate asynchronously with
 the client and this present major issues, some related with security.


 On Friday, 1 February 2013 10:22:35 UTC-6, José Luis Redrejo Rodríguez
 wrote:

 Hi, This is a question that has been asked several times in the list,
 and I have also had to implement this kind of app in the past.
 Now I'm also facing to another application where I need to run a
 resource_and_time_consuming process managed from web2py.

 The exact problem is:
 - From a web page, a long process must be started
 - The web page must be updated as the process is being done
 - The web page must be able to cancel the process.

 In the past I have had to deal with the fact of sessions lockings:
 web2py server doesn't react while the process is being executed. I've
 solved this by using session.forget(response), but this solution
 avoids the use of session variables to update the process in the
 original web page.

 I've used background processes, queues, etc, These solutions work when
 time is not an issue, but not when the synchronization between the
 process and the webpage must be fast and accurate

 I wonder if someone has a definitive pattern to do this kind of action.

 Regards
 José L.

 --

 ---
 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 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] Having some strange occurence with label printing and FPDF

2013-01-16 Thread José Luis Redrejo
Some time ago, we include PDFLabel too, so you can simplify your code
if you are using an avery-compatible format ( the sys stuff is only
needed if you're using a non-english language):

def label_bikes():
from gluon.contrib.pyfpdf.pdflabels import PDFLabel
import sys
reload(sys)
sys.setdefaultencoding( latin-1 )

pdf = PDFLabel('Apli-01277')
pdf.add_page()
rows = db(db.bike.id.belongs(bikeIds)).select()
# Print labels
for row in rows:
idString = row.destination + str(row.id)
more_text = idString
more_text += Make:   + row.make + \n if row.make else 
more_text += Model:   + row.model + \n if row.model else 
more_text += Size:   + row.size + \n if row.size else 
pdf.add_label(more_text)

response.headers['Content-Type'] = 'application/pdf'
response.headers['Content-Disposition']='attachment.filename = sample.pdf'
return pdf.output(dest='S')


Regards
José L.

2013/1/16 Paul Rykiel ptryk...@gmail.com:
 Hi Mariano,
 thank you for the response. Let me look into the margin issue, maybe you
 have given me enough to figure this out.
 thanks so much for the response. you know, Massimo was my professor last
 term.

 On Wednesday, January 16, 2013 12:39:06 AM UTC-6, Mariano Reingart wrote:

 Hello Paul:

 Could you send a sample without actual data?
 (without the db query, so it can be reproduced)

 fpdf.cell will jump to the next page if no more room available, maybe
 there is a sizing or rounding issue.
 Also, you have to take a look at page margins.

 Best regards,

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


 On Tue, Jan 15, 2013 at 8:02 PM, Paul Rykiel ptry...@gmail.com wrote:
  Greetings this is my code:
 
  def triagePrintTags(bikeIds):
  assert(bikeIds != None)
  assert(isinstance(bikeIds, list) or isinstance(bikeIds, tuple))
  pdf = FPDF('P', 'mm', (66.548, 25.4))
  # get all the r(ows
  rows = db(db.bike.id.belongs(bikeIds)).select()
  for row in rows:
  pdf.add_page()
  pdf.set_font('Times', 'B', 8)
  idString = row.destination + str(row.id)
  pdf.cell(0, 2, idString, 0, 1)
  if row.make != None:
  pdf.cell(0, 2, Make:   + row.make,0,1)
  if row.model != None:
  pdf.cell(0, 2, Model:   + row.model,0,1)
  if row.size != 0:
  sz = Size:   + str(row.size)
  pdf.cell(0, 2, sz,0,1)
  if row.color != None:
  pdf.cell(0, 2, Color:   + row.color,0,1)
  # TODO this should be a true temp file, stored in /tmp with random
  unique filename.
  fileName = request.folder + '/static/temp.pdf'
  pdf.output(name=fileName)
  response.headers['Content-Disposition']='attachment.filename =
  sample.pdf'
  response.headers['Content-Type']='application/pdf'
  return response.stream(open(fileName, 'rb'), chunk_size=4096)
 
  the problem with the above code is:
 
  my dimentions of my page are supposed to simulate a label (no problem)
  my text should all be on the same label, but when the next cell prints,
  it
  jumps to the
  next label. What am I doing incorrectly here?
 
  Or maybe is it is just wrong print with pdf.cell, maybe there is a
  better
  way.
  Please help if you can?
 
  Thank you in advance.
 
 
 
 
 
  --
 
 
 

 --




-- 





Re: [web2py] Having some strange occurence with label printing and FPDF

2013-01-16 Thread José Luis Redrejo
I've just checked pdflabel is not included in fpdf in web2py. I ignore
the reason because I uploaded it to pyfpdf 18 months ago. I thought
web2py automatically included pyfpdf updates. You can download it from
http://code.google.com/p/pyfpdf/source/browse/pdflabels.py and copy it
at gluon/contrib/fpdf directory so you can use:

from gluon.contrib.fpdf.pdflabels import PDFLabel

PDFLabel accepts \n , if you use cell, it doesn't understand \n

Regards.

2013/1/16 Paul Rykiel ptryk...@gmail.com:
 Hi Jose,

 I tried what you suggested, I was getting errors on the line
 from glon.contrib.pyfpdf.pdflabels import PDFLabel ... it does not seem to
 exist, and cannot find how to load this

 so, my other option seems to be to get all of the text inside of one cell,
 so I used your more_text from below, it works ('sort of) ... it lists all
 of the text inside the one cell, but
 the program is ignoring the \n page breaks, if I can get those to work, I
 am almost done

 then I have to figure out how to create the pages side by side, but I want
 to tackle one thing at a time.

 I am sure when I get to my next issue of printing the labels where there are
 3 labels across and 10 down, maybe I will have to figure out
 how to use the PDFLabel, but for right now I just want to get this to work.

 thanks for all of your help!!
 Regards,


 On Wednesday, January 16, 2013 12:46:34 PM UTC-6, José L. wrote:

 Some time ago, we include PDFLabel too, so you can simplify your code
 if you are using an avery-compatible format ( the sys stuff is only
 needed if you're using a non-english language):

 def label_bikes():
 from gluon.contrib.pyfpdf.pdflabels import PDFLabel
 import sys
 reload(sys)
 sys.setdefaultencoding( latin-1 )

 pdf = PDFLabel('Apli-01277')
 pdf.add_page()
 rows = db(db.bike.id.belongs(bikeIds)).select()
 # Print labels
 for row in rows:
 idString = row.destination + str(row.id)
 more_text = idString
 more_text += Make:   + row.make + \n if row.make else 
 more_text += Model:   + row.model + \n if row.model else 
 more_text += Size:   + row.size + \n if row.size else 
 pdf.add_label(more_text)

 response.headers['Content-Type'] = 'application/pdf'
 response.headers['Content-Disposition']='attachment.filename =
 sample.pdf'
 return pdf.output(dest='S')


 Regards
 José L.

 2013/1/16 Paul Rykiel ptry...@gmail.com:
  Hi Mariano,
  thank you for the response. Let me look into the margin issue, maybe you
  have given me enough to figure this out.
  thanks so much for the response. you know, Massimo was my professor last
  term.
 
  On Wednesday, January 16, 2013 12:39:06 AM UTC-6, Mariano Reingart
  wrote:
 
  Hello Paul:
 
  Could you send a sample without actual data?
  (without the db query, so it can be reproduced)
 
  fpdf.cell will jump to the next page if no more room available, maybe
  there is a sizing or rounding issue.
  Also, you have to take a look at page margins.
 
  Best regards,
 
  Mariano Reingart
  http://www.sistemasagiles.com.ar
  http://reingart.blogspot.com
 
 
  On Tue, Jan 15, 2013 at 8:02 PM, Paul Rykiel ptry...@gmail.com wrote:
   Greetings this is my code:
  
   def triagePrintTags(bikeIds):
   assert(bikeIds != None)
   assert(isinstance(bikeIds, list) or isinstance(bikeIds, tuple))
   pdf = FPDF('P', 'mm', (66.548, 25.4))
   # get all the r(ows
   rows = db(db.bike.id.belongs(bikeIds)).select()
   for row in rows:
   pdf.add_page()
   pdf.set_font('Times', 'B', 8)
   idString = row.destination + str(row.id)
   pdf.cell(0, 2, idString, 0, 1)
   if row.make != None:
   pdf.cell(0, 2, Make:   + row.make,0,1)
   if row.model != None:
   pdf.cell(0, 2, Model:   + row.model,0,1)
   if row.size != 0:
   sz = Size:   + str(row.size)
   pdf.cell(0, 2, sz,0,1)
   if row.color != None:
   pdf.cell(0, 2, Color:   + row.color,0,1)
   # TODO this should be a true temp file, stored in /tmp with
   random
   unique filename.
   fileName = request.folder + '/static/temp.pdf'
   pdf.output(name=fileName)
   response.headers['Content-Disposition']='attachment.filename =
   sample.pdf'
   response.headers['Content-Type']='application/pdf'
   return response.stream(open(fileName, 'rb'), chunk_size=4096)
  
   the problem with the above code is:
  
   my dimentions of my page are supposed to simulate a label (no
   problem)
   my text should all be on the same label, but when the next cell
   prints,
   it
   jumps to the
   next label. What am I doing incorrectly here?
  
   Or maybe is it is just wrong print with pdf.cell, maybe there is a
   better
   way.
   Please help if you can?
  
   Thank you in advance.
  
  
  
  
  
   --
  
  
  
 
  --
 
 
 

 --




-- 





Re: [web2py] Fpdf error with python 2.6 and web2py 2.2.1

2012-11-29 Thread José Luis Redrejo Rodríguez
Hi Carlo
I'm using fpdf without any problem, so I guess the reason is in some of the
data you're passing to fpdf.
The code of the controller would be needed to can lend you a hand.

Regards


2012/11/29 carlo syseng...@gmail.com

 No error with web2py 1.9.4.

 With 2.2.1 I got this with Python 2.5 and Python 2.6

 Traceback (most recent call last):
   File C:\Python25\web2py\gluon\restricted.py, line 212, in restricted

 exec ccode in environment
   File C:/Python25/web2py/applications/Hcontrol/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/Hcontrol/controllers/default.py, 
 line 1000, in module

   File C:\Python25\web2py\gluon\globals.py, line 188, in lambda

 self._caller = lambda f: f()

   File C:/Python25/web2py/applications/Hcontrol/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/Hcontrol/controllers/default.py, 
 line 558, in pdf_prev

 pdf.add_page()
   File C:\Python25\web2py\gluon\contrib\fpdf\fpdf.py, line 284, in add_page

 self.header()
   File C:/Python25/web2py/applications/Hcontrol/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/Hcontrol/controllers/default.py, 
 line 540, in header

 self.image(logo,10,8,50)

   File C:\Python25\web2py\gluon\contrib\fpdf\fpdf.py, line 896, in image

 info=self._parsepng(name)

   File C:\Python25\web2py\gluon\contrib\fpdf\fpdf.py, line 1749, in 
 _parsepng

 color += re.sub('(.{3}).',lambda m: m.group(1),line, flags=re.DOTALL)
 TypeError: sub() got an unexpected keyword argument 'flags'

  --





-- 





Re: [web2py] downloading a synthetic csv

2012-10-26 Thread José Luis Redrejo
2012/10/26 Jonathan Lundell jlund...@pobox.com

 I want to build a dataset (list of lists) in response to a user request
 and cause a csv of that dataset to be downloaded.

 I have a working but ugly implementation that uses @service.csv. If I
 access the URL

 http://domain.com/app/default/call/csv/foo

 ...it works OK and downloads a file named 'foo'.

 A couple of questions.

 1. Is there a better way (considering that this is a user request, not
 really a web service per se)?

 2. How do I make the downloaded file, above, be named foo.csv? Maybe set
 request.extension? (I tried call.csv in the URL, which still downloaded
 'foo'.)


Hi Jonathan, to do it you can use:

response.headers['Content-Disposition'] = 'attachment; filename=foo.csv'

before returning your function in the controller

-- 





Re: [web2py] Web2py en paquetes SCORM

2012-08-26 Thread José Luis Redrejo Rodríguez
Hi, Matias, this an English language only mailing list. Anyway, if I were
you I'd take a look to eXe learning.

Regards
 El 22/08/2012 00:03, Matol matiastolosa2...@gmail.com escribió:

 Buenas

 Estoy trabajando con una aplicacion de Web2py y tengo que
 implementarla en un paquete SCORM, para luego implementarlo en una
 plataforma de aprendizaje como objeto de Aprendizaje. Alguien trabajaó con
 este tipo de proyecto o recomienda algun material especifico que me pueda
 ser util?.
Desde ya muchas Gracias!!!

 --





-- 





Re: [web2py] Formulario personalizado

2012-08-26 Thread José Luis Redrejo Rodríguez
Hola Miguel: está lista de correo sólo es en inglés. Sí no hablas este
idioma hay otra lista de web2py en español.

Hi Miguel, this mailing list is only in English, so if you can not use this
language, there is an alternative Spanish web2py mailing list.

Un saludo
El 25/08/2012 17:52, Miguel miguel.mori...@gmail.com escribió:

 Hola,

 Estoy haciendo pruebas con formularios y me ha surgido una duda, quisiera
 crear un formulario de creación (SQLFORM, CRUD.create o similar) de una
 tabla.

 En esa tabla tengo una relación con otra tabla, al crear el formulario de
 la tabla completa me aparece la relación mediante un combo de selección con
 los valores de la otra tabla.

 Mi pregunta es si ese formulario lo puedo restringir para que solo
 aparezcan en el combo de selección determinados valores.

 Gracias
 Miguel

 --





-- 





Re: [web2py] Re: [ANNOUNCE] FPDF for python v1.7: unicode ttf support, png alpha channel and more!

2012-08-15 Thread José Luis Redrejo
You don't need reportlab to use pyfpdf, so as you said, the wording is
not correct in the book.
Regards
José L.

2012/8/15 Andrew awillima...@gmail.com:
 Excellent.  Haven't used it yet but looking forward to it.

 One question
 The book mentions this package in the core section, but in services it says:
 ...web2py can also generate PDF documents, with an additional library called 
 ReportLab...

 Is it either pyfpdf or report lab, or do I need both ?  Suggest we change the 
 wording a bit in the book.

 --




-- 





Re: [web2py] web2py for embedded hardware control

2012-08-14 Thread José Luis Redrejo Rodríguez
I think you're not going to have good results with web2py for this
kind of project.
I'd encourage you to take a look at projects as
http://mblogic.sourceforge.net/ , which using python (and a bit of
javascript) allows you to control, and report or easily showing
animated bars and graphics.
mblogic has a modular design and allows you use things as modbus, but
you don't need to use modbus to build a scada-like web application.
You only will need to add authentication, as mblogic (in its hmiserver
module) doesn't have it implemented.

Hope this helps.

Regards.

2012/8/14 Sam samjenkin...@googlemail.com:
 Hi all,

 I'm fairly new to web2py and python, but I'm trying to build a 'proof of
 concept' system to demonstrate how one of our products might work.

 The system consists of an embedded Linux board and an RS232 serial digital
 compass. The system will read the orientation from the compass and light a
 few LEDs as well as an audible tone to point a user in the right direction.
 The device will also host a small web server running web2py so that people
 can log on and view the real compass outputs - possibly an animated
 graphical display if i get that far...

 So really i just need some advice about the best architecture to get me
 started.

 Should I build everything into web2py - will it handle worker threads for
 reading serial port etc, will it handle the LEDs/tone if no http users are
 connected?
 Should I build a stand-alone python 'service' that handles the hardware
 interface - web2py can then read the results for the web elements? Would
 this use JSON, SOAP etc?

 Any help would be gratefully appreciated.
 Sam

 --




-- 





Re: [web2py] free ssl alternative encryption

2012-07-31 Thread José Luis Redrejo Rodríguez
mmm,  you can use ssl without using a public certificate, if it's your
certificate I think you can trust it.
Secondly, you can use a valid and certified free ssl certificate, take
a look at http://www.startssl.com/

Regards.

2012/7/31 Robin Manoli ramat...@gmail.com:
 Hey,
 I'm looking for an alternative way to encrypt data, a free way rather than
 to pay for an ssl certificate.

 The case is as follows: there are two servers, one local on the office which
 contains a database, and another public web server which needs to
 synchronize data with the local server. Using ssl I could use json or post
 forms from the local server to the web server so the data will be encrypted.

 I thought of another method however, with php I could use mycrypt with a
 secret key known by both servers. Probably this isn't as secure as ssl, but
 in this case I'd rather not pay for the encryption rather than having a very
 secure one.

 Another thought would be to just use ssl without a valid certificate...

 Well, I wonder how you would do this in web2py, if you in any case would
 recommend the encryption method I suggested.

 Thanks!
 - Robin

 --




-- 





[web2py] is there any trick in this PaaS hosting?

2012-07-26 Thread José Luis Redrejo Rodríguez
https://console.appfog.com/pricing
Free up to 2 Gb RAM , it costs more than 50$ per month in most providers ...

I'm still looking for the trick, without success ;)

Regards
José L.

-- 





Re: [web2py] Re: [web2py-dev] Asyncronous Application Sync

2012-07-17 Thread José Luis Redrejo Rodríguez
I had to to do something similar a couple of years ago (between
several waste water plants and the control center) and ended using a
similar approach to what nick name said:
- In the control center I used mysql
- In the waste water plants I used a sqlite database per day
(initializating the database every day at 00:00 and backing up the
previous file in another directory)
- Every record in the plants had a datetime stamp
- The plants just send the sqlite files gzipped (and splitted in small
bits because my connection was really bad) and the control center just
received the bits, joined them, unziped the sqlite files and import
their data into mysql using the plant-datetime as key to avoid
duplicated items.


Regards.
José L.


2012/7/13 nick name i.like.privacy@gmail.com:
 On Wednesday, July 11, 2012 6:26:00 PM UTC-4, Massimo Di Pierro wrote:

 I am planning to improve this functionality but it would help to know if
 it works for you as it is and what problems you encounter with it.


 I originally used the export-to-csv, but a few months ago, I switched to
 just shipping the sqlite files (actually the whole databases directory
 with .table files); That handles everything like types, blobs, fractional
 seconds in the database, etc, without any conversion. It is also faster when
 processing the files at the other end - especially if you have indices and
 have a non-trivial import requirement. It should be opened with
 auto_import=True on the receiving end, of course.

 (you'd still need an export to a new .sqlite database, or use sqlite's
 backup command, to make sure you get the database in a consistent state --
 unless you know that the database is in a fully committed state when you
 send it).

 If the connection is not reliable, the classic solution is a queuing system
 like MSMQ / MQSeries / RabbitMQ (which is often non-trivial to manage), but
 you could just export (csv, .sqlite, whatever) to a dropbox-or-similar
 synced directory (e.g. sparkleshare lets you own the repository and not rely
 on dropbox.com servers), and import it on the server side when the file has
 changed. much, much simpler and works just as well for one way communication
 that does not require the lowest possible latency.

-- 





Re: [web2py] Re: Error importing ldap_auth module

2012-06-26 Thread José Luis Redrejo
2012/6/26 ehgonzalez ehgonzale...@gmail.com:
 Hi everyone,

 I've finally found out what was wrong in my system. I use apache2 + mod_php
 + wsgi, if I disable mod_php the application works Ok. Is there anyway to
 run mod_php and wsgi without problems?


I'm doing it in a lot of servers without any problem (runing a web2py
application which uses ldap as auth backend and phpldapadmin in the
same machine). There must be an error in your apache configuration or
in the way web2py is installed. I'm running it on Debian systems using
the python-gluon package.

Regards
José L.



 Eduardo.

 El jueves, 21 de junio de 2012 14:48:19 UTC-4:30, ehgonzalez escribió:

 Ldap utilities works OK. For example: ldapsearch -x -h mycompany.com -b
 dc=mycompany,dc=com (sAMAccountName=gonzalezej).

 El jueves, 21 de junio de 2012 12:43:09 UTC-4:30, szimszon escribió:

 common ldap utilities are working? ldapsearch and co?

 2012. június 21., csütörtök 17:34:45 UTC+2 időpontban ehgonzalez a
 következőt írta:

 You rigth, python version is 2.6.6. I copied ldap_auth.py from trunk but
 it's throwing same error.

 any ideas?

 El jueves, 21 de junio de 2012 10:18:43 UTC-4:30, szimszon escribió:

 Try to use ldap_auth.py from trunk. Just copy it over the old one.

 You say Python 2.7.3 but in the error there is a

 ... python2.6/dist-packages/ldap ...


 2012. június 21., csütörtök 16:39:40 UTC+2 időpontban ehgonzalez a
 következőt írta:

 Hi,

 When I try to import the ldap_auth module in my db.py is throwing an
 error. Here's the traceback:

 Traceback (most recent call last):
   File /var/www/web2pytest/gluon/restricted.py, line 205, in
 restricted
 exec ccode in environment
   File /var/www/web2pytest/applications/SMS/models/db.py, line 44,
 in module
 from gluon.contrib.login_methods.ldap_auth import ldap_auth
   File /var/www/web2pytest/gluon/custom_import.py, line 293, in
 __call__
 fromlist, level)
   File /var/www/web2pytest/gluon/custom_import.py, line 78, in
 __call__
 level)
   File /var/www/web2pytest/gluon/contrib/login_methods/ldap_auth.py,
 line 9, in module
 raise e
 SystemError: error 89 from ldap_set_option


 Web2py's Shell:

 In [1] : import ldap

 In [2] : import ldap.filter

 In [3] : ldap.set_option( ldap.OPT_REFERRALS, 0 )
 Traceback (most recent call last):
   File /var/www/web2py/gluon/contrib/shell.py, line 225, in run
 exec compiled in statement_module.__dict__
   File string, line 1, in module
   File /usr/lib/python2.6/dist-packages/ldap/functions.py, line 124,
 in set_option
 _ldap_function_call(_ldap.set_option,option,invalue)
   File /usr/lib/python2.6/dist-packages/ldap/functions.py, line 57,
 in _ldap_function_call
 result = func(*args,**kwargs)
 SystemError: error 89 from ldap_set_option

 Debian 6.0.5, Apache 2.2.16, WSGI 3.3-2, Python 2.7.3, , web2py
 1.99.7.


 Any help much appreciated.

 Eduardo.






 --




-- 





Re: [web2py] Re: Error importing ldap_auth module

2012-06-26 Thread José Luis Redrejo
2012/6/26 Bill Thayer bill.tha...@live.com:

 Hi Jose,

 Not to hijack your thread but quickly

 Your are probably as busy as the rest of us but I'd love to see a recipe or
 tutorial on how you got php MyAdmin to run with web2py.



There 's not a special recipe. I'm using Debian, with python-gluon
installed and phpldapadmin installed as packages too.
In apache, I place my web2py configuration sometimes on
/etc/apache2/conf.d and some others on /etc/apache2/sites-available,
depending if I install my web2py application using a debian package
(then I use conf.d) or by hand (then I use sites-available, because
it's simpler)

I'm attaching the configuration I used in my latest project. This one
used a sqlite backend, not a ldap backend, and lives in a server
together with mediawiki , which uses php too. I needed both http and
https access, and I always install the application directory at
/var/web2py/applications , the application name in this case was aeee.

Hope this helps.


 Regards,
 Bill

 --




-- 





agenciaevaluacion
Description: Binary data


Re: [web2py] Re: Error importing ldap_auth module

2012-06-26 Thread José Luis Redrejo
2012/6/26 ehgonzalez ehgonzale...@gmail.com:
 José this is my configuration,

 db.py:
 from gluon.contrib.login_methods.ldap_auth import ldap_auth

 If mod_php is on:
 ERROR:root:missing ldap, try easy_install python-ldap (apache log error)

 If mod_php is off, the application works OK.

 mod_php  5.3.3
 mod_wsgi 3.3
 I've installed web2py from source.


I can not tell you where the problem is . It looks like php mod is
changing something in the way the directories are seen by
wsgihandler.py, thus it can not find gluon or gluon.contrib.
I think you should add gluon to your python path, so you avoid this problem.
That's why using the Debian package python-gluon in a Debian (or
Debian derivative distribution) helps, because the package allows you
doing
import gluon
at any directory in your machine.
You can do it even manually placing gluon dir from web2py sources in
the directory where your python modules are stored in your
distribution.





 Apache:
 VirtualHost *:80
   ServerName web2py-test.foo.com
   WSGIDaemonProcess web2pytest user=www-data group=www-data \
    display-name=%{GROUP}
   WSGIProcessGroup web2pytest
   WSGIScriptAlias / /var/www/web2pytest/wsgihandler.py

   Directory /var/www/web2pytest
     AllowOverride None
     Order Allow,Deny
     Deny from all
     Files wsgihandler.py
   Allow from all
     /Files
   /Directory

   AliasMatch ^/([^/]+)/static/(.*) \
    /var/www/web2pytest/applications/$1/static/$2
   Directory /var/www/web2pytest/applications/*/static/
     Order Allow,Deny
     Allow from all
   /Directory

   LocationMatch ^/([^/]+)/appadmin
       Deny from all
   /LocationMatch

   LogLevel info
   CustomLog /var/log/apache2/web2pytest_access.log common
   ErrorLog /var/log/apache2/web2pytest_error.log
 /VirtualHost



I can not see any diferences in this configuration with the one I'm
using and I've sent in a previous email.



 Eduardo.

 El martes, 26 de junio de 2012 13:07:43 UTC-4:30, Bill Thayer escribió:


 Hi Jose,

 Not to hijack your thread but quickly

 Your are probably as busy as the rest of us but I'd love to see a recipe
 or tutorial on how you got php MyAdmin to run with web2py.

 Regards,
 Bill

 --




-- 





Re: [web2py] web2py folder structure and security

2012-06-15 Thread José Luis Redrejo Rodríguez
2012/6/15 Chris ch...@spitfireinnovation.com:
 We have had very good experiences with web2py.  And now we are moving into a
 more locked-down production environment. This raises some new questions
 about security.  I would like to make a suggestion.  If this suggestion
 seems valuable then I would work with others to implement it.  However an
 opinion from Massino and others is most important on this point.

 Problem statement: web2py processes create and read files in the base web2py
 directory.  This makes it difficult to secure the application in a
 production environment.  Granting permissions to apache, and especially when
 using SELinux security contexts, is much harder when the rules differ file
 by file within a single directory.

 Examples: if you lock down write permission on the web2py directory then try
 to run Rocket server, you will have problems since httpserver.log and
 httpserver.pid can't be created.  If you use apache with mod_wsgi, apache
 needs read access to wsgihandler.py which lives in the top-level directory.
  (Similar issue for other handlers -- cgihandler.py and so on).

 Solution statement: refactor web2py slightly so no files exist in base
 folder, just other directories.  Add ./metadata -- where VERSION, LICENSE,
 README, CHANGELOG, splashlogo.gif go.  Add ./handlers -- where
 wsgihandler.py, anyserver.py and other handlers go.  Add ./cron where
 cron.master go.  Add ./logs where httpserver.log would go (plus other items
 the user might configure like wsgi logs and so on).  Add ./setup where
 Makefile, setup.py and others go.  Consider moving web2py.py to ./gluon or
 devise another new folder.

 Measure of goodness: (1) No processes have a requirement to read or write
 files in the base directory.  (2) The web2py default download has no files
 in the base directory.  (3) New folders are fine-grained enough in their
 permissions that one owner (chown) and one file permission mask (chmod) can
 be applied to all contents of that folder.  (4) No security-required files
 live in the same folder as no-need-to-secure files, e.g. don't put
 parameters_*.py files in the same folder as README and *.gif files.  (5) Per
 web2py module or major process, document what directories it reads and
 writes, and permissions required (chown and chmod options required for
 directory level and file contents level) for that module / process to
 operate. (6) Explicit error messages on stdout when a module or process
 encounters a directory or file permission problem.

 This would enhance everyone's ability to achieve a highly secure web2py
 environment and not worry about problem creeping into the environment over
 time -- since there is no requirement to fiddle with individual file-level
 permissions.

 Would this be useful to anyone other than me?  :)  Thanks


I've already done exactly this for the Debian package of web2py. gluon
goes to the standard python libraries directory in Debian (and its
derivatives) and the script launching web2py makes some links and
copies some of these directories if rocket is used. When using apache
only VERSION, wsgihandler.py and routes.py must be copied to the
directory where the application is stored. This is a production server
using apache2:

server:/var/web2py# ls
applications  deposit  logs  routes.py  site-packages  VERSION  wsgihandler.py

I use the -f option to do this, and works ok, excepting for this bug:
http://code.google.com/p/web2py/issues/detail?id=791

If all these changes were made to the code, it would make things
easier for me or other distribution maintainers.

Regards.
José L.


Re: [web2py] Re: Validator for sqlform combo list

2012-06-01 Thread José Luis Redrejo Rodríguez
Thanks very much Anthony, I didn't know this feature.

2012/5/31 Anthony abasta...@gmail.com:
 db.class_attendant.person_id.requires = IS_IN_DB(db(db.person.age = 18),

     'person.id', '%(name)s %(surname)s')

 The first argument to IS_IN_DB and IS_NOT_IN_DB can be a Set object rather
 than an entire db connection.
 See http://web2py.com/books/default/chapter/29/7#Database-validators.

 Anthony


 On Thursday, May 31, 2012 2:49:35 PM UTC-4, José L. wrote:

 Hi, I'm using a referenced table with IS_IN_DB validator, but I'd like to
 filter the fields to be shown in the combo list.
 As an example:

 db.define_table('person',
     Field('name'),
     Field('surname),
     Field(age,'integer')
 )

 db.define_table('class_attendant',
     Field('Date','date'),
     Field('Classname'),
     Field('person_id',db.person,readable=True,writable = True,
 label=User))

 db.class_attendant.person_id.requires = IS_IN_DB(db,'person.id','%(name)s
 %(surname)s')

 When using a SQLFORM(db.class_attendant) to add new persons to  the
 class_attendant table, the combo list shows all the persons in the person
 table, but I'd like it to show only the persons whose age is upper than 18.
 What's the best method to do it?




Re: [web2py] Help deploying Web2py on FluxFlex

2012-04-24 Thread José Luis Redrejo Rodríguez
There might be two problems:
- You uploaded the setup.py file included in web2py sources tar
ball. Remove it
-You pushed too many things: you only should push your app directory,
not the web2py or applications directory from your local drive.
I.e. git should be available only at myapp in
...web2py/applications/myapp
not in web2py neither in applications dir.

What I usually do is symlinking from git directory to my local web2py
installation:

cd ...web2py/applications/
ln -s ../public_html/applications/myapp .

modify myapp, and then git push from myapp dir.
There is no need to do any deploying later.


Hope this helps.

2012/4/24 Simon Shapiro simon.m.shap...@gmail.com:

 Hi,

 I have followed the instructions on deploying web2py to fluxflex that i
 found here.  My app was copied from local development on the path
 ...web2py/applications/myapp and placed in ../public_html/applications/myapp
 on the local git sandbox-  Then I ran 'git push' followed by a manual
 deploy.

 Once deployed I get a 404 file not found on flexflux, but the application
 was working fine on local development.

 I really don't undestamd what is required to take a working web2py app on
 local (under sqlite) and getting into flexflux production.

 Please help.  I am desparate  :-(



 Regards


 Simon


Re: [web2py] Re: Eclipse and autocomplete

2012-04-05 Thread José Luis Redrejo Rodríguez
2012/4/5 Anthony abasta...@gmail.com:
 Does it work if you do the following at the top of model and controller
 files (requires latest web2py version):

 if 0:
     from gluon import *

 If you've got db and auth objects, you could also add:

     from gluon.tools import Auth
     db = DAL()
     auth = Auth(db)

 Anthony


Hi, Anthony, that's enough to avoid Eclipse marking as errors lines
containing web2py references, but to get autocomplete working, with
the latest web2py stable version , I need to add to my modules:

if 0:
from gluon import *
global LOAD; LOAD  = compileapp.LoadFactory()
global request; request = globals.Request()
global response; response = globals.Response()
global session; session = globals.Session()
global cache; cache = cache.Cache()
global db; db = sql.DAL()
global auth; auth = tools.Auth()
global crud; crud = tools.Crud()
global mail; mail = tools.Mail()
global plugins; plugins = tools.PluginManager()
global service; service = tools.Service()



 On Tuesday, April 3, 2012 10:54:06 PM UTC-4, Rod Watkins wrote:

 I know this has been asked before. I don't mean to be an annoyance. I've
 done the searches are read numerous posts about how to handle this. But the
 advice conflicts and I've yet to actually fix the problem.

 What is the best way to handle imports for eclipse to get autocomplete to
 work properly (as well as rid eclipse of all the incorrect error messages?

 I rather like having autocomplete functioning since, as a beginner, it
 helps me discover functionality that I might otherwise miss (besides saving
 some typing).

 Please accept my thanks in advance for any help on this.

 Cordially,
 Rod Watkins


Re: [web2py] Re: executing javascript after accepting a form

2012-03-27 Thread José Luis Redrejo Rodríguez
It works perfectly. Thanks very much Anthony.

Sushant: I didn't want to change my code to an ajax form. I wanted to
keep it the way it was. Thanks for your suggestion anyway.

Regards.

2012/3/27 Anthony abasta...@gmail.com:
 Yes, response.js only works for requests for components (made via a
 client-side call to web2py_ajax_page(), which is called when you use the
 LOAD helper in the view). You might try something like this:

 def index():
     ...
     if form.accepts(request.vars):
         js = SCRIPT('$(function() {$(#dialog-message).dialog({modal:
 true});});', _type='text/javascript')
     else:
         js = ''
     ...
     return dict(form=form, js=js)

 and then somewhere in your index.html view:

 {{=js}}

 Anthony


 On Tuesday, March 27, 2012 8:31:14 AM UTC-4, José L. wrote:

 Hi, I'm having problems trying to show a modal window after the user
 submits correctly a form.
 I've tried to do it with:

 def index():
 
         if form.accepts(request.vars):
             response.js='$( #dialog-message ).dialog({ modal: true
 });'
 ...

 being #dialog-message a div in the same index.html page, but response.js
 doesn't do anything, and it seems to work only inside componentes.

 Any idea to get this funcionality working?
 Thanks.


Re: [web2py] Re: Upgrading web2py in Linux

2012-03-13 Thread José Luis Redrejo Rodríguez
2012/3/13 Wikus van de Merwe dupakrop...@googlemail.com:
 I assume that you have only one application and you keep it separate from
 web2py:
 $HOME/workspace/my-project/src  -- your application folder
 $HOME/workspace/my-project/web2py  -- web2py folder

 To upgrade web2py to a desired version you can run then the following
 script. It pulls the changes from the repository
 and applies them to web2py folder. The it copies the global configuration
 files (which has been overwritten during update) from
 the application src folder (yaml files are only needed for GAE apps).
 Finally, it creates symbolic link to your application from
 within the web2py folder.

 #!/bin/bash

 TAG=R-1.99.7

 cd $HOME/workspace/my-project

 # update files from repo
 cd web2py
 hg pull
 hg update -C $TAG
 cd ..

 # copy config files
 cp -p src/private/*.yaml web2py/.
 cp -p src/private/routes.py web2py/.

 # link to my application
 if [ ! -d web2py/applications/init ]
 then
     cd web2py/applications/
     ln -s ../../src init
 fi

 Notice that your application will be linked as init. If you have more than
 one application per web2py instance, adjust the script
 to link all applications. Also, you will need mercurial installed to run the
 script (sudo apt-get install mercurial).

 And one more thing, this is perfectly normal that you need to mange the
 changes carefully. So there is no need to be bitter.
 BTW, there was an attempt by Jose to package web2py for Debian. It's pretty
 good but stays a bit behind the upstream:
 http://packages.debian.org/sid/python-web2py

Actually, not too behind, I've just upoaded the latest version, it
will be available as soon as the mirrors synchronize ,)


Re: [web2py] Get the IP of the System

2012-02-28 Thread José Luis Redrejo Rodríguez
You can use netifaces, http://alastairs-place.net/projects/netifaces/
El 28/02/2012 11:39, Sanjeet Kumar sanjeet@gmail.com escribió:

 How we can get the IP address of the system



Re: [web2py] Re: Anyone using Backbone.js?

2012-02-15 Thread José Luis Redrejo Rodríguez
2012/2/15 Anthony abasta...@gmail.com:
 There are a number of other interesting Javascript MVC frameworks worth
 checking out as well, particularly those that enable two-way data binding
 between models and views, such as AngularJS (developed by Google), Batman.js
 (developed by Shopify), and Ember.js (formerly Sproutcore 2.0).

 Anthony





This is a good review of most known javascript frameworks:
http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/

José L.


 On Wednesday, February 15, 2012 1:19:55 PM UTC-5, pbreit wrote:

 I'm thinking about trying out Backbone.js. You pretty much just need to
 write a REST back-end on the server and then everything happens in
 JavaScript on the client. This guy just put out a Twitter Bootstrap +
 Backbone package:

 http://coenraets.org/blog/2012/02/sample-app-with-backbone-js-and-twitter-bootstrap/

 Web2py might be kind of heavy to use in such a limited way but I'll give
 it a shot.


Re: [web2py] getting started with dotcloud

2012-01-27 Thread José Luis Redrejo Rodríguez
2012/1/26 Brad Miller bonel...@gmail.com:
 That did it, thanks!

 Is there a newer version of the tutorial somewhere?

Not, as far as I know, but old tutorials are right in most parts.

 I have some basic
 questions like  how do I get the app to start with an admin password?


As far as I know you shouldn't run admin on dotcloud:
https://groups.google.com/forum/#!topic/web2py/aoU8FUQiYHs

as it's not safe. Just run admin on your machine and deploy the changes later.

If you need such feature maybe you should try fluxflex. It allows it
using the fluxflex web2py installation. Instructions are here:
https://github.com/nus/web2py-for-fluxflex


Regards.
José L.






 Thanks,

 Brad

 --
 Brad Miller

 On Thursday, January 26, 2012 at 12:13 PM, José Luis Redrejo Rodríguez
 wrote:

 2012/1/26 Brad Miller bonel...@gmail.com:

 Hi,

 I'm trying to follow the web2py tutorial that was posted here a while
 back.  Unfortunately that was written using the older version of the
 command line tools, so some things just don't exist anymore.  But I'm
 going back and forth between the new documentation and the old.

 I've done the following:

 dotcloud created  myapp
 I've create the dotcloud.yml file
 I've symlinked wsgihandler.py to wsgi.py  as instructed
 I've got a requirements.txt file listing my dependencies

 When I do dotcloud deploy myapp .

 It uploads, starts the build, then I get:


 17:15:44 [www] running build_scripts
 17:15:44 [www] creating build/scripts-2.6
 17:15:44 [www] error: file '/home/dotcloud/rsync-1327598128997/web2py/
 w2p_apps' does not exist
 17:15:45 [www] -- Build failed: python ./setup.py install failed
 with return code 1
 17:15:45 --- Aborting due to build failure


 you must delete the file setup.py included in web2py directory.
 Dotcloud interprets it as an installer and it's not.


 José L.




Re: [web2py] getting started with dotcloud

2012-01-26 Thread José Luis Redrejo Rodríguez
2012/1/26 Brad Miller bonel...@gmail.com:
 Hi,

 I'm trying to follow the web2py tutorial that was posted here a while
 back.  Unfortunately that was written using the older version of the
 command line tools, so some things just don't exist anymore.  But I'm
 going back and forth between the new documentation and the old.

 I've done the following:

 dotcloud created  myapp
 I've create the dotcloud.yml file
 I've symlinked wsgihandler.py to wsgi.py  as instructed
 I've got a requirements.txt file listing my dependencies

 When I do dotcloud deploy myapp .

 It uploads, starts the build, then I get:


 17:15:44 [www] running build_scripts
 17:15:44 [www] creating build/scripts-2.6
 17:15:44 [www] error: file '/home/dotcloud/rsync-1327598128997/web2py/
 w2p_apps' does not exist
 17:15:45 [www] -- Build failed: python ./setup.py install failed
 with return code 1
 17:15:45 --- Aborting due to build failure


you must delete the file setup.py included in web2py directory.
Dotcloud interprets it as an installer and it's not.


José L.


Re: [web2py] setup web2py with a virtual host on apache

2012-01-10 Thread José Luis Redrejo Rodríguez
2012/1/10 Web2Py Freak halna...@gardeniatelco.com:
 Dear all,

 i have a server  and i have a apache installed how can i tell apache
 to  the when someone asks for www.domain.com  , apache gives it the
 website at my localhost:8080 ..  how can i do that

If you can not run apache on port 80 you need to use some kind of
proxy like varnish.


Re: [web2py] Re: utf-8 and pyfpdf

2012-01-02 Thread José Luis Redrejo Rodríguez
Hi Martin, I'm using this in the controller, without any problem:


# coding: utf8
...
from gluon.contrib.pyfpdf.pdflabels import PDFLabel

import sys
reload(sys)
sys.setdefaultencoding( latin-1 )
...
def label_parejas():
 ...
            text=%s\n%s\n%s %s\n%s % (nombre_ella.decode('UTF-8'), ...)
            pdf.add_label(text)
    response.headers['Content-Type'] = 'application/pdf'
    return pdf.output(dest='S')


It works for me with any kind of symbol, including spanish ñ.

Regards


2012/1/1 Martin Weissenboeck mweis...@gmail.com:
 Now I have found that I have to convert the string:

 txt = 'äöü ß ÄÖÜ'
 txt = txt.decode('utf-8').encode('latin-1','replace')


 This new string will be written correctly into the pdf-file.Is there a
 better way?
 No chance for the Euro-currency-symbol '€'

 Maybe there will be a full unicode characterset for pyfpdf in the future.


 2012/1/1 Martin Weissenboeck mweis...@gmail.com

 Another question about pyfpdf:

 Is there any chance to get some more utf-8-characters?
 (I have asked this some months ago).

 It seems, that pyfpdf only supports the basic ascii character set and no
 latin-1-characters.
 I want to use äöü ß ÄÖÜ €...and so on.

 Regards, Martin




Re: [web2py] Web2Py on Kubuntu 11.10

2011-12-22 Thread José Luis Redrejo Rodríguez
2011/12/22 miroslavgojic miroslavgo...@gmail.com

 Today I make installation of Kubuntu 11.10 on my VM.

 In packages I find Web2py and on one click it was instated

 After some  time (1 minute) my Web2py is started

 Thanks

 Miroslav


Hi Miroslav,
Ubuntu/Kubuntu packages are taken from Debian, but they're not updated very
often. If your package is not the latest web2py version you can use  gdebi
and install always the latest version from:
http://packages.debian.org/sid/all/python-web2py/download

Regards.
José L.


Re: [web2py] web2py, amazon ec2 and static pages outside of the application

2011-12-08 Thread José Luis Redrejo Rodríguez
2011/12/8 Marco Tulio Cicero de M. Porto mtcpo...@gmail.com:
 Hi there!

 ok, here's the deal:

 I installed web2py on ec2 following the instructions on the attached file.
 So far so good. I had it installed and working perfectly.

 Thing is that now, I want to use on that same server a geoprocessing
 application that will read from the databases I created with my web2py
 applications.
 This geoprocessing tool (i3geo), was made with PHP and works well when
 installed on another server.

 But on when I try to put them togheter, I won't be able to see the
 geoprocessing tool.

 At first, I thought I should put the application on /var/www (/var/www/i3geo
 for ex), but it wouldn't read the pages there... then I remembered that when
 I was installing web2py there, I placed it on /home/www-data/web2py and that
 all of it's applications are under that (
 /home/www-data/web2py/applications/app_name for ex) then I tried to create a
 directory with a hello world on it and place it there. Couldn't read it.

 Well, problem: I can make applications with web2py that'll run smoothly on
 ec2. But I'm not beeing able to publish anything else (not a single html) on
 that server.

 Any hints?




Yes, I'm running a web server with php apps, and had to add a web2py
application on it.

You can use this recipe: http://www.web2pyslices.com/slices/take_slice/56

It mostly works, but since versions =1.96.1 of web2py you also have
to tweak a little bit routes.py to make it work.

Regards
José L.




 Thanks in advanced,
 Marco Tulio

 --
 []'s
 Marco Tulio


Re: [web2py] Re: web2py, amazon ec2 and static pages outside of the application

2011-12-08 Thread José Luis Redrejo Rodríguez
2011/12/8 Marco Tulio Cicero de M. Porto mtcpo...@gmail.com:
 I was wondering if there was any configuration on Apache that could help on
 that, so that I could set the php application on www root and the web2py
 applications on www-data ...



That's exactly what explains the recipe
http://www.web2pyslices.com/slices/take_slice/56 that I suggested you
in my previous email.


 2011/12/8 Marco Tulio Cicero de M. Porto mtcpo...@gmail.com

 I'd appreciate, (that's what I was going to say when the mail was sent by
 itself... :P :)

 Thanks in advanced,
 Marco Tulio

 2011/12/8 Marco Tulio Cicero de M. Porto mtcpo...@gmail.com

 well, about this: I created an application called maps and moved the
 whole php application to
 /home/www-data/web2py/applications/maps/static/i3geo so that, now instead of
 http://servername.com/i3geo I have http://servername.com/maps/static/i3geo
 wich ends up working since I can see the static files and they seem to be
 running fine. On the other hand, I'll have to configure that application
 (php one), in order to work with the new path... If anyone thinks of another
 way of making this work, I

 2011/12/8 Marco Tulio Cicero de M. Porto mtcpo...@gmail.com

 Hi there!

 ok, here's the deal:

 I installed web2py on ec2 following the instructions on the attached
 file.
 So far so good. I had it installed and working perfectly.

 Thing is that now, I want to use on that same server a geoprocessing
 application that will read from the databases I created with my web2py
 applications.
 This geoprocessing tool (i3geo), was made with PHP and works well when
 installed on another server.

 But on when I try to put them togheter, I won't be able to see the
 geoprocessing tool.

 At first, I thought I should put the application on /var/www
 (/var/www/i3geo for ex), but it wouldn't read the pages there... then I
 remembered that when I was installing web2py there, I placed it on
 /home/www-data/web2py and that all of it's applications are under that (
 /home/www-data/web2py/applications/app_name for ex) then I tried to create 
 a
 directory with a hello world on it and place it there. Couldn't read it.

 Well, problem: I can make applications with web2py that'll run smoothly
 on ec2. But I'm not beeing able to publish anything else (not a single 
 html)
 on that server.

 Any hints?

 Thanks in advanced,
 Marco Tulio

 --
 []'s
 Marco Tulio




 --
 []'s
 Marco Tulio




 --
 []'s
 Marco Tulio




 --
 []'s
 Marco Tulio


Re: [web2py] autocomplete widget

2011-11-14 Thread José Luis Redrejo Rodríguez
Hi
I've worked in a plugin using part of the code of autocomplete widget
but using jquery autocomplete and contains insted of like when a third
parameter (search_field) is used. It works perfectly in GAE.
The idea is being able to look in a field of kind list:string to
retrieve the id in the associated table.
I'd like to clean it up a little bit before publishing it in
web2pyslices, but if you're in a hurry I can send the dirty version to
you in a private email.


Regards.
José L.

2011/11/14 Jim Steil j...@qlf.com:
 Hi

 Are many people using the autocomplete widget out there?

 I'm having some inconvenient behavior with it.  First off, I think it would
 be great if it would do a .contains instead of a .like when it filters the
 data being returned.  Second, when using the control I'm seeing the
 following:

 1.  Type in a couple characters and a dropdown list appears
 2.  I would like to use the arrow key to navigate up and down through the
 list.  This doesn't work.  I have to tab to the list before arrow keys work.
 3.  I would like to select my desired option using the space bar, enter key
 or single-clicking with the mouse.  None of these work.
 4.  There seems to be a select delay or timeout where whatever list item is
 currently highlighted is selected and the list goes away without me doing
 anything.  I'm still thinking about which one I want to select and the list
 disappears and the currently highlighted selection is chosen (regardless of
 whether or not I'm actively scrolling through the list).  I'd prefer to have
 to do something to make it select something.

 Is it possible I'm using some old CSS or web2py_ajax.html file?  I don't
 recall what version I was on when my app was initially created.

    -Jim



Re: [web2py] Re: Running web2py in an apache directory

2011-10-24 Thread José Luis Redrejo Rodríguez
Bumping the message as a reminder...

El día 21 de octubre de 2011 19:54, José Luis Redrejo Rodríguez
jredr...@debian.org escribió:
 El día 21 de octubre de 2011 19:51, José Luis Redrejo Rodríguez
 jredr...@debian.org escribió:
 2011/10/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 Can you show us your routes?




 The application name is controlies, placed at
 /var/web2py/applications/controlies

 a web2py-apache file placed at /etc/apache2/conf.d contains:

 
         WSGIScriptAlias /controlies /var/web2py/subwsgihandler.py

         WSGIDaemonProcess web2py user=www-data group=www-data \
                           home=/var processes=5 \
                           maximum-requests=1 \
                           threads=1

         Location /controlies
             Order deny,allow
             Allow from all
             WSGIProcessGroup web2py
         /Location

 

 And /var/web2py/subwsgihandler.py is the same as the one at
 http://www.web2pyslices.com/slices/take_slice/56

 It all works correctly with web2py up to 1.95.1, but not since 1.96.1 .





 I've forgotten this in my previous email, there is also a symbolic link:

  /var/web2py/applications/controlies -  /var/web2py/applications/init







 On Oct 21, 5:20 am, José L. jredr...@gmail.com wrote:
 Hi,
 I've been running successfully web2py under apache in a directory following
 the slice athttp://www.web2pyslices.com/slices/take_slice/56. I need it
 running in a subdirectory because this apache server is running some other
 apps, some of them in php.

 It worked perfectly with version 1.95.1, but after trying to update web2py
 to versions =1.96.1, it doesn't work.

 I see this behaviour when going to the url where web2py should 
 work:http://miserver/mysubdir
 with 1.95.1, it redirects 
 to:http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init...
 but with versions =1.96.1 it redirects 
 to:http://miserver/init/default/user/login?_next=/init/default/index

 So, web2py it's removing the /mysubdir/ part somewhere.

 After checking the changelog between both versions I can not find anything
 related to this routes changes. Running under apache I'm not using the
 routes.py file nor changing apache configuration between web2py versions.

 Any idea?
 Thanks




Re: [web2py] Re: Running web2py in an apache directory

2011-10-21 Thread José Luis Redrejo Rodríguez
2011/10/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 Can you show us your routes?




The application name is controlies, placed at
/var/web2py/applications/controlies

a web2py-apache file placed at /etc/apache2/conf.d contains:


        WSGIScriptAlias /controlies /var/web2py/subwsgihandler.py

        WSGIDaemonProcess web2py user=www-data group=www-data \
                          home=/var processes=5 \
                          maximum-requests=1 \
                          threads=1

        Location /controlies
            Order deny,allow
            Allow from all
            WSGIProcessGroup web2py
        /Location



And /var/web2py/subwsgihandler.py is the same as the one at
http://www.web2pyslices.com/slices/take_slice/56

It all works correctly with web2py up to 1.95.1, but not since 1.96.1 .










 On Oct 21, 5:20 am, José L. jredr...@gmail.com wrote:
 Hi,
 I've been running successfully web2py under apache in a directory following
 the slice athttp://www.web2pyslices.com/slices/take_slice/56. I need it
 running in a subdirectory because this apache server is running some other
 apps, some of them in php.

 It worked perfectly with version 1.95.1, but after trying to update web2py
 to versions =1.96.1, it doesn't work.

 I see this behaviour when going to the url where web2py should 
 work:http://miserver/mysubdir
 with 1.95.1, it redirects 
 to:http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init...
 but with versions =1.96.1 it redirects 
 to:http://miserver/init/default/user/login?_next=/init/default/index

 So, web2py it's removing the /mysubdir/ part somewhere.

 After checking the changelog between both versions I can not find anything
 related to this routes changes. Running under apache I'm not using the
 routes.py file nor changing apache configuration between web2py versions.

 Any idea?
 Thanks


Re: [web2py] Re: Running web2py in an apache directory

2011-10-21 Thread José Luis Redrejo Rodríguez
El día 21 de octubre de 2011 19:51, José Luis Redrejo Rodríguez
jredr...@debian.org escribió:
 2011/10/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 Can you show us your routes?




 The application name is controlies, placed at
 /var/web2py/applications/controlies

 a web2py-apache file placed at /etc/apache2/conf.d contains:

 
         WSGIScriptAlias /controlies /var/web2py/subwsgihandler.py

         WSGIDaemonProcess web2py user=www-data group=www-data \
                           home=/var processes=5 \
                           maximum-requests=1 \
                           threads=1

         Location /controlies
             Order deny,allow
             Allow from all
             WSGIProcessGroup web2py
         /Location

 

 And /var/web2py/subwsgihandler.py is the same as the one at
 http://www.web2pyslices.com/slices/take_slice/56

 It all works correctly with web2py up to 1.95.1, but not since 1.96.1 .





I've forgotten this in my previous email, there is also a symbolic link:

 /var/web2py/applications/controlies -  /var/web2py/applications/init







 On Oct 21, 5:20 am, José L. jredr...@gmail.com wrote:
 Hi,
 I've been running successfully web2py under apache in a directory following
 the slice athttp://www.web2pyslices.com/slices/take_slice/56. I need it
 running in a subdirectory because this apache server is running some other
 apps, some of them in php.

 It worked perfectly with version 1.95.1, but after trying to update web2py
 to versions =1.96.1, it doesn't work.

 I see this behaviour when going to the url where web2py should 
 work:http://miserver/mysubdir
 with 1.95.1, it redirects 
 to:http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init...
 but with versions =1.96.1 it redirects 
 to:http://miserver/init/default/user/login?_next=/init/default/index

 So, web2py it's removing the /mysubdir/ part somewhere.

 After checking the changelog between both versions I can not find anything
 related to this routes changes. Running under apache I'm not using the
 routes.py file nor changing apache configuration between web2py versions.

 Any idea?
 Thanks



Re: [web2py] reports in Web2Py

2011-10-13 Thread José Luis Redrejo Rodríguez
2011/10/13 Naleen Yadav naleenya...@gmail.com:
 Creating reports in Web2Py

 Hello All, I'm a newbie on web2py and looking to create Reports in
 web2py, but unable to find something suitable for a newbie on the
 internet. Tried some videos on vimeo (http://vimeo.com/18601633) but
 didn't get the output. I could install the plugin for appreport but
 when trying to use it in the application, I'm getting the error -
 Import error : No module named plugin_appreport. Would really
 appreciate some help.



If your reports are not very complex, I'd use pyfpdf. It's already
included in web2py, you don't need to add any plugin or library.
There are some examples of use (even a whole web2py example project)
at http://code.google.com/p/pyfpdf/w/list

Regards


Re: [web2py] xml-rpc service, unicode string

2011-10-04 Thread José Luis Redrejo Rodríguez
2011/10/4 synergetic jandos...@gmail.com:
 Hello members,

 I have a following problem. In service.py controller I have
 --
 def call():
  return service()

 @service.xmlrpc
 def get_modules():
    modules = db().select(db.Module.ALL).as_list()
    return dict(get_modules=modules)
 --

 web2py returns the following xml to my Silverlight 4 client app.

 ?xml version='1.0'?
 methodResponse
 params
 param
 valuestruct
 member
 nameget_user_modules/name
 valuearraydata
 valuestruct
 member
 nameModuleName/name
 valuestringMain/string/value
 /member
 member
 nameDisplayName/name
 valuestring�Ǘ�/string/value
 /member
 member
 nameXapFileName/name
 valuestringLedgerware.Main.xap/string/value
 /member
 member
 nameViewNamespace/name
 valuestringLedgerware.Main/string/value
 /member
 member
 nameAssemblyName/name
 valuestringLedgerware.Main, Version=1.0.0.0, Culture=neutral,
 PublicKeyToken=null/string/value
 /member
 member
 nameid/name
 valueint1/int/value
 /member
 /struct/value
 /data/array/value
 /member
 /struct/value
 /param
 /params
 /methodResponse

 The problem is DisplayName value is a unicode string (in Japanese),
 and
 xml serialization fails prompting there's an invalid character.

 What should I do to solve this problem? Thank you.



The first line of your xml file should be something like:
?xml version=1.0 encoding=UTF-8 standalone=yes?

If you include the encoding information in the first line of the file
(and the file is correctly enconded, of course), any decent xml parser
will work. I use it everyday with xml.dom.minidom without problem with
spanish characters.

Regards.
José L.


Re: [web2py] Ubuntu and web2py

2011-09-21 Thread José Luis Redrejo Rodríguez
My recomendation is:
install the debian package:
python-gluon
(install too python-web2py if you want to develop , if you just want
to deploy, only python-gluon is needed).
Read the /usr/share/doc/python-gluon/Readme.Debian
you'll only need to modify the name of your application path in the
scripts that  the package contains following the Readme.Debian
procedures.

The python-gluon package is already in Ubuntu oneiric but it's more
updated in Debian . The package can be installed in any Debian or
Ubuntu version using python2.6 as default, it doesn't matter if your
version is not oneiric.

Cheers

2011/9/21 Web2Py Freak halna...@gardeniatelco.com:
 Hello guy ,

 i switched from using windows to Ubuntu ,  and i am trying to install
 apache+python+mod_wsgi+web2py+postgresql from scratch , so i used the
 one step deployment from the book:

 wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
 chmod +x setup-web2py-ubuntu.sh
 sudo ./setup-web2py-ubuntu.sh

 so i have web2py now in home/www-data/web2py  so how do i use web2py
 now am trying to run web2py.py but its not runing and  and i want to
 use postgresql ..

 so what to do guys

 best regards



Re: [web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-14 Thread José Luis Redrejo Rodríguez
2011/8/12 Mariano Reingart reing...@gmail.com:
 Thanks Jose, I've create an issue as this is important to get it
 working on most platform and versions.

 http://code.google.com/p/rad2py/issues/detail?id=3

 I've sent a mail to the wx-users mailing list, if the error persists,
 I'll change to standard toolbars.

 Regarding the paths, there is a ide2py.ini configuration file to adjust them.
 The idea is that the config file would be stored in the user
 directory, but beside that, I don't known what is the best approach to
 place web2py projects in the disk.


Not, I wasn't talking about the web2py projects, but about the paths
ide2py needs:
- a web2py installation in ../web2py
- I don't understand too much the paths in the .ini file, how the
checklist and data paths are created. I thought that having valid
paths, ide2py would create the .dat files, but I don't see it.

On the other hand: with current mercurial version, the bugs I detected
with wx have disappeared. I see this error when trying to use the
quick help, but I guess I'm trying something that's not finished yet:

Traceback (most recent call last):
  File main.py, line 627, in OnHelp
sel = self.active_child.GetSelectedText()
AttributeError: 'NoneType' object has no attribute 'GetSelectedText'





The most important problem for me is that trying to open a project I
just get an empty window with  the list of projects (and I have
projects in the web2py installation where psp2py is symlinked). I only
see in the rocket server logs:
127.0.0.1, 2011-08-14 10:03:06, POST, /psp2py/services/call/jsonrpc,
HTTP/1.1, 200, 0.038954
So, everything looks right, but no project can be accesed.
Am I missing a configuration option?

Thanks.
José L.


Re: [web2py] Re: web2py book multilanguage

2011-08-12 Thread José Luis Redrejo Rodríguez
2011/8/11 qasimak...@gmail.com qasimak...@gmail.com:
 Or you can use google translate some how :)


Please, don't do that. It's harder to understand the spanish
automatic translation than the original text in english. If you
don't have a human translator, I prefer to automatically access to the
original english text. And, anyway, anyone can use google translate on
his own if wants to have some fun.

Regards.
José L.



 On Thu, Aug 11, 2011 at 7:40 PM, Massimo Di Pierro
 massimo.dipie...@gmail.com wrote:

 True. I am hoping for a 4rd edition in one month. hold on!

 Massimo

 On Aug 11, 9:13 am, Mirek Zvolský zvol...@seznam.cz wrote:
  But, it's proper time to make new translations?
  There will be no update of the english book in short time? Because I
  think there are small mistakes and, more important, there is lot of
  new features not documented yet.
 
  If there will be future changes in book, should not be good to have
  something like Version Control, so if english version is updated,
  changed places could be easy find for the translation?
 
  And proper format for the translation? I think HTML, content of div
  class=page article
 
  Mirek



Re: [web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-12 Thread José Luis Redrejo Rodríguez
This is my problem (just downloaded using mercurial):

Traceback (most recent call last):
  File main.py, line 790, in module
app = MainApp(redirect=False)
  File /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py,
line 7978, in __init__
self._BootstrapApp()
  File /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py,
line 7552, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File main.py, line 774, in OnInit
self.main_frame = PyAUIFrame(None)
  File main.py, line 306, in __init__
PSPMixin.__init__(self)
  File /opt/src/web2py/rad2py/ide2py/psp.py, line 441, in __init__
tb4 = self.CreatePSPToolbar()
  File /opt/src/web2py/rad2py/ide2py/psp.py, line 523, in CreatePSPToolbar
tb4.Realize()
  File 
/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/agw/aui/auibar.py,
line 2837, in Realize
sizer_item.SetMinSize(min_size)
AttributeError: 'SizerItem' object has no attribute 'SetMinSize'
Violación de segmento

It looks like version 2.8.10 of wx is not enough to run it.

2011/8/12 Mariano Reingart reing...@gmail.com:
 Please check the latest version with the following recent bug-fixes:

  * Support for external browser (if no webkit/ie available, ie. MAC OS X)
  * Support for older wxpython versions (psp toolbar problem, ie.
 debian wx 2.8.10)

 http://rad2py.googlecode.com/files/rad2py-0.06-web2py-bugfix.zip

 Also, now ide2py will build a basic web2py enviroment, available in
 the editor for calltip and autocompletion, with the following objects:

  * request, response, session
  * db, auth, crud, service
  * HTML helpers, T, etc.

 So, if you write SQLFORM and press the . , it will show the docstring
 and parameters of that function.

 Hope it works,

 Best regards,

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



 On Thu, Aug 11, 2011 at 7:49 PM, pbreit pbreitenb...@gmail.com wrote:
 I got an error on MacOS Lion:
 ide2py $ python main.py
 2011-08-11 15:46:30.647 Python[1091:1107] CFURLCreateWithString was passed
 this invalid URL string:
 '/System/Library/CoreServices/CommonCocoaPanels.bundle' (a file system path
 instead of an URL string). The URL created will not work with most file URL
 functions. CFURLCreateWithFileSystemPath or
 CFURLCreateWithFileSystemPathRelativeToBase should be used instead.
 Traceback (most recent call last):
   File main.py, line 777, in module
     app = MainApp(redirect=False)
   File
 /usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py,
 line 7981, in __init__
     self._BootstrapApp()
   File
 /usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py,
 line 7555, in _BootstrapApp
     return _core_.PyApp__BootstrapApp(*args, **kwargs)
   File main.py, line 761, in OnInit
     self.aui_frame = PyAUIFrame(None)
   File main.py, line 273, in __init__
     self.browser = self.CreateBrowserCtrl()
   File main.py, line 613, in CreateBrowserCtrl
     return SimpleBrowserPanel(self)
   File /Users/pbreit/rad2py/ide2py/browser.py, line 113, in __init__
     self.browser = BrowserPanel(self)
 NameError: global name 'BrowserPanel' is not defined



Re: [web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-12 Thread José Luis Redrejo Rodríguez
2011/8/12 Mariano Reingart reing...@gmail.com:
 Thanks to all who are testing this project!

 Sorry for the inconveniences with wxPython, it seem that 2.8.10 is too
 old to run the Advanced User Interface (AUI), I'll look forward this
 in the wx mailing list to see if there is a workaround.


Hi Mariano, you don't have to apologize for making a work. But, as you
said it would be great if we could make it run in Debian stable, as
many servers run this version on Debian which has wxPython 2.8.10.
Up to now, I've checked that this bug is affecting this wxPython version:
http://trac.wxwidgets.org/ticket/11089

and found this workaround:

$ diff -u psp.py.original psp.py
--- psp.py.original 2011-08-12 17:16:30.0 +0200
+++ psp.py  2011-08-12 17:16:38.0 +0200
@@ -502,10 +502,10 @@

 ##tb4.AddLabel(-1, Phase:, width=50)
 self.psp_phase_choice = wx.Choice(tb4, -1, choices=PSP_PHASES)
-tb4.AddControl(self.psp_phase_choice, PSP Phase)
+#tb4.AddControl(self.psp_phase_choice, PSP Phase)

 self.psp_gauge = wx.Gauge(tb4, -1, 100, (50, 10))
-tb4.AddControl(self.psp_gauge, Progressbar)
+#tb4.AddControl(self.psp_gauge, Progressbar)

 tb4.AddSimpleTool(ID_DEFECT, Defect, images.GetDebuggingBitmap(),
   short_help_string=Add a PSP defect)


I.E: removing all the AddControl commands. Maybe you can find some
other way to put this controls here, or if they're really important,
moving it to another kind of toolbar.

On the other hand, I'd like to make a Debian package of this ide. I'm
still getting familiar with it and there's a question than has raised
very soon: the way to install it is very dependent on the paths under
the code. It would be much better if relative paths can be used, to be
able to use it, independently of the place where the web2py projects
are stored in the disk. I don't know if you have any idea to deal with
this.

Regards.
José L.




 I'm testing this with wxPython 2.8.11 and 2.8.12 (the current stable
 release) and it is working fine in Ubuntu 11.04 and Windows 7 / XP,
 I'll get a Mac and test it more deeply.

 BTW, If you have problems you can even delete non essential files (the
 missing features will be disabled):
  * psp.py: personal software process support (helpful to track defects
 and times, but not really needed)
  * browser.py: embedded webbrowser (you can use external one)
  * repo.py: mercurial repository support (only needed if you really
 want to use hg from the IDE)

 Please, use the latest version (cloning the googlecode repo, if not,
 check downloads section) and if you can, submit an issue in the
 project site so we don't bother other web2py users ;-)

 http://code.google.com/p/rad2py/issues/list
 http://code.google.com/p/rad2py/downloads

 Thanks again and best regards

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



 On Fri, Aug 12, 2011 at 10:34 AM, Johann Spies johann.sp...@gmail.com wrote:
 On Debian Linux I get:


 % python main.py
 Traceback (most recent call last):
 File main.py, line 777, in module
 app = MainApp(redirect=False)
 File /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py,
 line 7978, in __init__
 self._BootstrapApp()
 File /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py,
 line 7552, in _BootstrapApp
 return _core_.PyApp__BootstrapApp(*args, **kwargs)
 File main.py, line 761, in OnInit
 self.aui_frame = PyAUIFrame(None)
 File main.py, line 300, in __init__
 PSPMixin.__init__(self)
 File /home/js/programmeer/python/rad2py-0.05-experimental/ide2py/psp.py,
 line 441, in __init__
 tb4 = self.CreatePSPToolbar()
 File /home/js/programmeer/python/rad2py-0.05-experimental/ide2py/psp.py,
 line 483, in CreatePSPToolbar
 aui.AUI_TB_OVERFLOW | aui.AUI_TB_TEXT | aui.AUI_TB_HORZ_TEXT)
 TypeError: __init__() got an unexpected keyword argument 'agwStyle'
 zsh: segmentation fault python main.py

 Regards
 Johann
 --
  May grace and peace be yours in abundance through the full knowledge of God
 and of Jesus our Lord!  His divine power has given us everything we need for
 life and godliness through the full knowledge of the one who called us by
 his own glory and excellence.
                                                     2 Pet. 1:2b,3a





Re: [web2py] web2py vs. django for Manipulating LDAP Records?

2011-08-11 Thread José Luis Redrejo Rodríguez
There's not a dal interface to ldap, but a auth interface.
Some of my colleagues are developing also an in house system to manage
the schools ldap system (and using it to learn web2py). Up to now it
can manage unix groups , users, and some kind of network hosts , all
this info stored in ldap.
You can access to the web interface to subversion with the application
at 
http://desarrollo.educarex.es/linex/projects/servidoressecundaria/repository/show/controlies

All the ldap crud tasks are done via python functions stored in the
modules directory of the web2py application.

Hope it helps.

Regards.
José L.

2011/8/11 Aaron Mahler amah...@sbc.edu:

  Hello!

  I need to write an in-house app for managing and manipulating
 records in our LDAP environment and am evaluating which framework
 might be the best fit. I've been writing python code for years, worked
 with Zope in the past, etc., so lots of python frameworks are
 attractive in that regard. web2py looks to be the easier system to
 plunge into and I like its overall design and community. One thing
 attracting me to django, however, is the presence of an LDAP DAL
 (http://opensource.bolloretelecom.eu/projects/django-ldapdb/) that, in
 theory, will allow me to interact with LDAP much like any other
 database.

  Does such a DAL exist for web2py? If not, do any more experienced
 developers here have a strong opinion on how important this would be
 in the grand scheme of things? Basically, how would you approach such
 a project with web2py? Obviously, any queries I do about web2py and
 ldap are flooded with discussions about LDAP authentication (the
 dominant issue that one might expect), but little discussion of
 interacting with an LDAP server in a more database-like fashion (and,
 yes, I know LDAP isn't a database, per se). I saw a few queries here
 from the past year asking about an LDAP DAL, but there appeared to be
 no replies. Maybe something has changed since?

 Any input would be greatly appreciated!
  - Aaron



Re: [web2py] ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread José Luis Redrejo Rodríguez
Awesome, just tell me if you need a hand to package it for Debian.

Regards

2011/8/11 Mariano Reingart reing...@gmail.com:
 FYI

 I am pleased to announce of ide2py, an Integrated Development
 Environment for python and web2py.
 Although it is still experimental, basic functionality is working:

  * Editor with calltips and autocomplete
  * Shell and Debugger (breakpoints, inspection, etc.)
  * Repository (hg) support (add, commit, etc.)
  * wxPyDiff (diff viewer)
  * a Browser (webkit or IE) to test webpages
  * a Console to redirect stdio
  * Source code checking/validation using pep8, pyflakes and doctests

 It is built using wxPython widget toolkit and includes a minimal
 internal server for development, where applications can be run and
 debugged (no need to start a third-party debugger or a separate web2py
 server).

 Usage is similar to Visual Basic IDE (i.e. keyboard shortcuts are
 equal when possible)

 It also has PSP -Personal Software Project- support (defect
 management, time recording log, etc.) for quality self-improvement.

 Screenshot:

 http://rad2py.googlecode.com/hg/screenshots/ide2py-0.05-ubuntu.png

 Source code and more information:

 http://code.google.com/p/rad2py

 Quick installation:

  * Get python 2.5+ and wxpython 2.8+
  * Get optionally mercurial for repo support
  * Clone rad2py repo
  * Download and unzip web2py into rad2py folder
  * CD to rad2py/ide2py
  * Execute python main.py
  * Have fun!

 ASAP there will be installation packages for download, sorry for the
 inconvenience.

 Comments and help are welcome!

 Best regards

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



Re: [web2py] apologies

2011-07-20 Thread José Luis Redrejo Rodríguez
There are a couple of bugs I reported a couple of weeks ago:
http://code.google.com/p/web2py/issues/detail?id=324
http://code.google.com/p/web2py/issues/detail?id=319

Both contain suggested patches to fix them, and #324 is specially
important for many people.

2011/7/20 Massimo Di Pierro massimo.dipie...@gmail.com:
 Hello everybody,

 I apologize I have been not active on the list for a few days does to
 a series of circumstances: travel, power outage, jetlag. Anyway, looks
 like Anthony, Jonathan and a few others manage to answer almost all
 the questions which proves I am not needed and that is good. ;-)
 Anyway, if there is any pending issue feel free to ping.

 Massimo


Re: [web2py] Insert One to many related tables in GAE

2011-07-05 Thread José Luis Redrejo Rodríguez
2011/7/5 howesc how...@umich.edu:
 GAE will always choose the ID for you (at least with web2py dal, custom GAE
 keys are not implemented).  You could maybe add an extra field to the
 province table to store your internal id and use the for lookup when
 loading the second table.


That's the method I used finally. Thanks.

  or if you are doing the load back to back, create
 a dict in memcache that maps your ID to the google ID and do the lookup as
 you write the city rows.



Re: [web2py] autocomplete widget does not work on GAE

2011-07-03 Thread José Luis Redrejo Rodríguez
startswith and endswith are not supported in GAE either

2011/7/3 Bruno Rocha rochacbr...@gmail.com:
 I dont know about autocomplete widget, but, for 'like' in GAE you can use
 Row.find()

         term = something
         pages = db(db.table.id0).select().find(lambda row :
 row.field.startswith(term) or row.field.endswith(term) or row.field == term
 or term in row.field)

 On Sun, Jul 3, 2011 at 12:53 PM, José L. jredr...@gmail.com wrote:

 I've checked autocomplete widget can not work in gae, as it uses like in
 its callback.
 Checking this group archives, I've found this
 thread: https://groups.google.com/d/topic/web2py/HdnWTp7h3Do/discussion
 but even if it looks like it would work, finally it was not implemented.
 So, does anybody know of any workaround to make autocomplete work in GAE?
 BTW: A note should be added at the web2py book section
 (http://www.web2py.com/book/default/chapter/07#Autocomplete-Widget ) warning
 it does not work in gae. It will save time to many people.
 Regards.
 José L.


 --



 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]
 [ Aprenda a programar: http://CursoDePython.com.br ]
 [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
 [ Consultoria em desenvolvimento web: http://www.blouweb.com ]



Re: [web2py] Insert One to many related tables in GAE

2011-07-02 Thread José Luis Redrejo Rodríguez
2011/7/2 Vasile Ermicioi elff...@gmail.com:
 GAE is a NoSQL database http://en.wikipedia.org/wiki/NoSQL
 but you can use a field where you can store a list of ids (one to many
 relation denormalized)
 http://web2py.com/book/default/chapter/06#Many-to-Many,-list:type,-and-contains



I know, but using dal I can use one to many relationship in gae. My
problem is not how to use it, but how to fill two related datatables
to use it later.


  1   2   >