Re: [web2py] Re: experimental... .pdf

2010-10-03 Thread Michele Comitini
@Mart

1) You need to install a TeX distribution, TeX Live is probably the
most complete: http://tug.org/texlive/


2010/10/3 mart :
> Ok, 'm really liking this! a few questions:
>
>
> 1) I'm not catching on where we get pdflatex... is it a plugin? where
> do we get it?
>
>
> 2) Is this a feature that can be add to an up for users? meanin
> something like "upload your document - then download your pdf (or
> email generated pdf")? should be doable?
>
>
> 3) I used reportlab for drawing fingerboard templates for kids
> learning the violin (which I got some nasty email from some template
> maker/vendor, so now I really want to put this out there - its just
> number crunching so it should be a crome to sell numbers to kids ;) )
> Is here a way to make use of those drawing capabilities? simple: draw
> lines @ coordinates?
>
>
> 4) scaling: is there a way to control that at this end? (for printing
> purposes - scaling needs to be disabled)
>
>
> thanks :)
>
>
> On Oct 3, 12:28 am, mdipierro  wrote:
>> or better
>>
>> {{
>> import re
>> from gluon.contrib.markmin.markmin2pdf import markmin2pdf
>> def markmin_serializer(text,tag=None,attr={}):
>>     if tag==None: return re.sub('\s+',' ',text)
>>     if tag=='br': return '\n\n'
>>     if tag=='h1': return '# '+text+'\n\n'
>>     if tag=='h2': return '#'*2+' '+text+'\n\n'
>>     if tag=='h3': return '#'*3+' '+text+'\n\n'
>>     if tag=='h4': return '#'*4+' '+text+'\n\n'
>>     if tag=='p': return text+'\n\n'
>>     if tag=='li': return '\n- '+text.replace('\n',' ')
>>     if tag=='tr': return text[3:].replace('\n',' ')+'\n'
>>     if tag in ['table','blockquote']: return '\n-\n'+text+'\n--
>> \n'
>>     if tag in ['td','th']: return ' | '+text
>>     if tag in ['b','strong','label']: return '**%s**' % text
>>     if tag in ['em','i']: return "''%s''" % text
>>     if tag in ['tt','code']: return '``%s``' % text
>>     if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
>>     return text
>> html=response.render('%s/%s.html' %
>> (request.controller,request.function))
>> markmin=TAG(html).element('#content').flatten(markmin_serializer)
>> pdf,warnings,errors=markmin2pdf(markmin)
>> if errors:
>>    response.headers['Content-Type']='text'
>>
>> response.write(HTML(BODY(H1('errors'),LU(*errors),H1('warnings'),LU(*warnings
>> else:
>>    response.headers['Content-Type']='application/pdf'
>>    response.write(pdf,escape=False)
>> pass
>>
>> }}
>>
>> On Oct 2, 11:10 pm, mdipierro  wrote:
>>
>> > install pdflatex
>>
>> > create a views/generic.pdf that contains:
>>
>> >  begin file 
>> > {{
>> > import re
>> > from gluon.contrib.markmin.markmin2pdf import markmin2pdf
>> > def markmin_serializer(text,tag=None,attr={}):
>> >     if tag==None: return re.sub('\s+',' ',text)
>> >     if tag=='br': return '\n\n'
>> >     if tag=='h1': return '# '+text+'\n\n'
>> >     if tag=='h2': return '#'*2+' '+text+'\n\n'
>> >     if tag=='h3': return '#'*3+' '+text+'\n\n'
>> >     if tag=='h4': return '#'*4+' '+text+'\n\n'
>> >     if tag=='li': return '\n- '+text.replace('\n',' ')
>> >     if tag=='table': return '\n-\n'+text+'\n--\n'
>> >     if tag=='tr': return text[3:].replace('\n',' ')+'\n'
>> >     if tag=='td': return ' | '+text
>> >     if tag=='p': return text+'\n\n'
>> >     if tag=='b' or tag=='strong': return '**%s**' % text
>> >     if tag=='em' or tag=='i': return "''%s''" % text
>> >     if tag=='tt' or tag=='code': return '``%s``' % text
>> >     if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
>> >     return text
>> > html=response.render('%s/%s.html' %
>> > (request.controller,request.function))
>> > markmin=TAG(html).element('#content').flatten(markmin_serializer)
>> > response.write(markmin2pdf(markmin)[0],escape=False)
>> > response.headers['content-type']='text'}}
>>
>> >  end file---
>>
>> > Now you should be able to view any web2py page with .pdf in pdf.
>>
>> > I am sure this can also be done and better with pyfpdf but I have not
>> > tried. Perhaps Mariano can help us
>>
>>


[web2py] Re: Admin - edit static files is broken

2010-10-03 Thread Arnaud Masselin
Hi MAssimo,

on localhost, I use web2py server. I look in httpd config.

Thanks.


On 2 oct, 22:04, mdipierro  wrote:
> Could be a permission issue. When you open it from localhost do you
> still use lighttpd or do you start web2py user your user account?
>
> On Oct 2, 10:58 am, Arnaud Masselin  wrote:
>
>
>
> > Hi all,
>
> > i have deployed Web2py 1.83.2 on lighttpd production server. And i
> > have a problem for edit css files in the admin interface. I raise a
> > 404 error when I try  to edit files.
>
> > Files seems to be accessible because, for example, /static/
> > landing_a_default_new.css display content of my css file.
>
> > All others files (language, contoller, html files in views) are
> > editable without problems.
>
> > When i run the same app on localhost, I can edit my css.
>
> > Where comes this problem ?
>
> > Thanks.


Re: [web2py] web2py 1.86.1 is OUT

2010-10-03 Thread Jason Brower
I love the db(db.table) idea... when I first started using web2py I 
would do that thinking it would do that.

BR,
JAson

On 10/02/2010 11:50 PM, mdipierro wrote:

Changelog:

markmin2latex
markmin2pdf
Storage getfirst, getlast, getall by Kevin and Nathan
db(db.table), db(db.table.id) both supported and equivalent to
db(db.table.id>0)
postresql ssl support
less unnecessary logging and warnings on GAE
IS_DECIMAL_IN_RANGE and IS_FLOAT_IN_RANGE support dot="," (dot="." is
default)
on_failed_authorization can be a function, thanks Niphold
gluon/contrib/login_methods/cas_auth.py for integration between CAS
and Auth.
many bug fixes and small improvements
   


Re: [web2py] Re: Confirm deletion of record

2010-10-03 Thread Jason Brower
I do something similar except I use request.args(0) and look for "yes".  
If it has it delete otherwise show a screen with a "du ya reelize wanna" 
and a no with goes to some page, and yes which just adds a /yes to the 
end.  IF there is yes, delete AND redirect to a page somewhere...

BR,
J


On 10/02/2010 01:14 AM, mdipierro wrote:

The fact is crud.delete() does not return a form, ever. If you call
it, it deletes the record.

you can do something like this

def delete():
 task=db.tasks[request.args[0]]
 if request.vars.confirm:
 crud.delete(db.tasks, task.id,next=URL(r=request,f='index'),
message=T('Deleted'),deletable=True)
 else:
 form = BUTTON('really
delete',_onclick='document.location="%s"'%URL(vars=dict(confirm=True)))
 return dict(form = form)


On Oct 1, 4:53 pm, Tom  Campbell  wrote:
   

I have a 'Delete' link in my edit view. The controller looks like
this:

def delete():
 task=db.tasks[request.args[0]]
 form = crud.delete(db.tasks, task.id,
next=URL(r=request,f='index'), message=T('Deleted'),deletable=True)
 return dict(form = form)

what I want is before the crud.delete to ask whether the user really
wanted to delete. Is there some way to put up a confirmation dialog in
the delete action? The framework puts the logic for it in the view of
course, but I'd like to avoid the 2-step process of checkbox, then
submit. Instead I'd like a Delete button, then a confirmation.
 


Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-03 Thread Ivan Matveev
Hi Denes,

>2010/10/3 DenesL :
> Hi Ivan,
>
> mysql is not one of the supported DBs for keyed tables:
> only DB2, MSSQL, Ingres, and Informix have been added as per

I looked at dal.py (web2py 1.83.2 2010-08-15). It has

# list of drivers will be built on the fly
# and lists only what is available
drivers = []
[...]
try:
import MySQLdb
drivers.append('MySQL')
[...]
class MySQLAdapter(BaseAdapter):
types = {
'boolean': 'CHAR(1)',

so MySQL support is there? Or shell something else be added?


Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-03 Thread Ivan Matveev
>2010/10/3 mdipierro :
> Since August we had many improvements in sql.py that were not
> reflected into dal.py.

So shell I start hacking DAL or wait for improvements to be put in?

> web2py is still using sql.py and it will be a little while before we
> move to dal.py

If I start hacking how do I make web2py use dal.py insted of sql.py?


[web2py] reduce textarea rows in autogenerated form

2010-10-03 Thread Markandeya
Dear Friends of Web2py,
where do i go to edit the default number of rows for a textarea
displayed in a SQLFORM or CRUD form that is autogenerated from a
model? There are fields with a 'text' datatype. The textareas  are too
long vertically and they have scroll bars if more text area is needed
which is good. I also could increase the cols as i have width space on
my page.
  Thanks much, couldn't find textarea and rows in the base.css nor in
jquery.js.


[web2py] Re: DAL, legacy keyed table, field references

2010-10-03 Thread DenesL
Hi Ivan,

sorry for the confusion, I have been a little away from web2py, not by
choice.

Don't wait for dal.py, just follow the 3 steps under point (E) in the
post
http://groups.google.com/group/web2py/browse_thread/thread/db150376b06d47fc

The insert function in step 2 is on line 2527 now (1.85.3).

If you get stuck just ask, I will try to reply as promptly as I can.

Denes.

On Oct 3, 6:46 am, Ivan Matveev  wrote:
> >2010/10/3 mdipierro :
> > Since August we had many improvements in sql.py that were not
> > reflected into dal.py.
>
> So shell I start hacking DAL or wait for improvements to be put in?
>
> > web2py is still using sql.py and it will be a little while before we
> > move to dal.py
>
> If I start hacking how do I make web2py use dal.py insted of sql.py?


[web2py] Re: experimental... .pdf

2010-10-03 Thread mdipierro
what is scaling?

On Oct 3, 12:02 am, mart  wrote:
> Ok, 'm really liking this! a few questions:
>
> 1) I'm not catching on where we get pdflatex... is it a plugin? where
> do we get it?
>
> 2) Is this a feature that can be add to an up for users? meanin
> something like "upload your document - then download your pdf (or
> email generated pdf")? should be doable?
>
> 3) I used reportlab for drawing fingerboard templates for kids
> learning the violin (which I got some nasty email from some template
> maker/vendor, so now I really want to put this out there - its just
> number crunching so it should be a crome to sell numbers to kids ;) )
> Is here a way to make use of those drawing capabilities? simple: draw
> lines @ coordinates?
>
> 4) scaling: is there a way to control that at this end? (for printing
> purposes - scaling needs to be disabled)
>
> thanks :)
>
> On Oct 3, 12:28 am, mdipierro  wrote:
>
> > or better
>
> > {{
> > import re
> > from gluon.contrib.markmin.markmin2pdf import markmin2pdf
> > def markmin_serializer(text,tag=None,attr={}):
> >     if tag==None: return re.sub('\s+',' ',text)
> >     if tag=='br': return '\n\n'
> >     if tag=='h1': return '# '+text+'\n\n'
> >     if tag=='h2': return '#'*2+' '+text+'\n\n'
> >     if tag=='h3': return '#'*3+' '+text+'\n\n'
> >     if tag=='h4': return '#'*4+' '+text+'\n\n'
> >     if tag=='p': return text+'\n\n'
> >     if tag=='li': return '\n- '+text.replace('\n',' ')
> >     if tag=='tr': return text[3:].replace('\n',' ')+'\n'
> >     if tag in ['table','blockquote']: return '\n-\n'+text+'\n--
> > \n'
> >     if tag in ['td','th']: return ' | '+text
> >     if tag in ['b','strong','label']: return '**%s**' % text
> >     if tag in ['em','i']: return "''%s''" % text
> >     if tag in ['tt','code']: return '``%s``' % text
> >     if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
> >     return text
> > html=response.render('%s/%s.html' %
> > (request.controller,request.function))
> > markmin=TAG(html).element('#content').flatten(markmin_serializer)
> > pdf,warnings,errors=markmin2pdf(markmin)
> > if errors:
> >    response.headers['Content-Type']='text'
>
> > response.write(HTML(BODY(H1('errors'),LU(*errors),H1('warnings'),LU(*warnings
> > else:
> >    response.headers['Content-Type']='application/pdf'
> >    response.write(pdf,escape=False)
> > pass
>
> > }}
>
> > On Oct 2, 11:10 pm, mdipierro  wrote:
>
> > > install pdflatex
>
> > > create a views/generic.pdf that contains:
>
> > >  begin file 
> > > {{
> > > import re
> > > from gluon.contrib.markmin.markmin2pdf import markmin2pdf
> > > def markmin_serializer(text,tag=None,attr={}):
> > >     if tag==None: return re.sub('\s+',' ',text)
> > >     if tag=='br': return '\n\n'
> > >     if tag=='h1': return '# '+text+'\n\n'
> > >     if tag=='h2': return '#'*2+' '+text+'\n\n'
> > >     if tag=='h3': return '#'*3+' '+text+'\n\n'
> > >     if tag=='h4': return '#'*4+' '+text+'\n\n'
> > >     if tag=='li': return '\n- '+text.replace('\n',' ')
> > >     if tag=='table': return '\n-\n'+text+'\n--\n'
> > >     if tag=='tr': return text[3:].replace('\n',' ')+'\n'
> > >     if tag=='td': return ' | '+text
> > >     if tag=='p': return text+'\n\n'
> > >     if tag=='b' or tag=='strong': return '**%s**' % text
> > >     if tag=='em' or tag=='i': return "''%s''" % text
> > >     if tag=='tt' or tag=='code': return '``%s``' % text
> > >     if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
> > >     return text
> > > html=response.render('%s/%s.html' %
> > > (request.controller,request.function))
> > > markmin=TAG(html).element('#content').flatten(markmin_serializer)
> > > response.write(markmin2pdf(markmin)[0],escape=False)
> > > response.headers['content-type']='text'}}
>
> > >  end file---
>
> > > Now you should be able to view any web2py page with .pdf in pdf.
>
> > > I am sure this can also be done and better with pyfpdf but I have not
> > > tried. Perhaps Mariano can help us
>
>


[web2py] Re: web2py 1.86.1 is OUT

2010-10-03 Thread mdipierro
I knew I forgot something important. I apologize.

1.86.1 also includes Hebrew translation by our user Yair. He did more
than that since he fixed some typos in many of the existing
translations.

Massimo

On Oct 3, 12:49 am, guruyaya  wrote:
> Oh, awsome! I see there's Hebrew and RTL support, in the admin! Who is
> this fine work?
> Sorry. I just like the attention.
>
> On Oct 2, 10:50 pm, mdipierro  wrote:
>
> > Changelog:
>
> > markmin2latex
> > markmin2pdf
> > Storage getfirst, getlast, getall by Kevin and Nathan
> > db(db.table), db(db.table.id) both supported and equivalent to
> > db(db.table.id>0)
> > postresql ssl support
> > less unnecessary logging and warnings on GAE
> > IS_DECIMAL_IN_RANGE and IS_FLOAT_IN_RANGE support dot="," (dot="." is
> > default)
> > on_failed_authorization can be a function, thanks Niphold
> > gluon/contrib/login_methods/cas_auth.py for integration between CAS
> > and Auth.
> > many bug fixes and small improvements
>
>


[web2py] Re: reduce textarea rows in autogenerated form

2010-10-03 Thread mdipierro
something like this should do

form=crud.create(...)
form.element('textarea')[_cols']=40
form.element('textarea')[_rows']=2

or use jQuery/CSS. I normally use jQuery.


On Oct 3, 7:00 am, Markandeya  wrote:
> Dear Friends of Web2py,
> where do i go to edit the default number of rows for a textarea
> displayed in a SQLFORM or CRUD form that is autogenerated from a
> model? There are fields with a 'text' datatype. The textareas  are too
> long vertically and they have scroll bars if more text area is needed
> which is good. I also could increase the cols as i have width space on
> my page.
>   Thanks much, couldn't find textarea and rows in the base.css nor in
> jquery.js.


[web2py] Re: DAL, legacy keyed table, field references

2010-10-03 Thread mdipierro
Thanks Denes,

I agree. It is better to continue add features to sql.py until
somebody has the time to put dal.py back in sync with sql.py.

Massimo

On Oct 3, 8:35 am, DenesL  wrote:
> Hi Ivan,
>
> sorry for the confusion, I have been a little away from web2py, not by
> choice.
>
> Don't wait for dal.py, just follow the 3 steps under point (E) in the
> posthttp://groups.google.com/group/web2py/browse_thread/thread/db150376b0...
>
> The insert function in step 2 is on line 2527 now (1.85.3).
>
> If you get stuck just ask, I will try to reply as promptly as I can.
>
> Denes.
>
> On Oct 3, 6:46 am, Ivan Matveev  wrote:
>
> > >2010/10/3 mdipierro :
> > > Since August we had many improvements in sql.py that were not
> > > reflected into dal.py.
>
> > So shell I start hacking DAL or wait for improvements to be put in?
>
> > > web2py is still using sql.py and it will be a little while before we
> > > move to dal.py
>
> > If I start hacking how do I make web2py use dal.py insted of sql.py?
>
>


[web2py] auth.has_membership syntax erron

2010-10-03 Thread Dr Schmulge
Hi all

 Missing gluon.tools  import ??

File "/home/john/web2py/applications/testapp/models/menu.py", line 32
if auth.has_membership(auth.id_group('Administrator')):
 ^
SyntaxError: invalid syntax

in file menu.py

if auth.has_membership(auth.id_group('Administrator')):
  response.menu=[
 [T('Our company'),False,URL('index')],
 [T('Contacts'),False,URL('list_contacts')],
 [T('Help'),False,URL('list_persons')],
 [T('Users'),False,URL('list_tasks')],
 [T('MAPP'),False,URL('list_tasks')],
 [T('RFID'),False,URL('list_tasks')],
 [T('Report'),False,URL('list_tasks')],
]

Thanks in advance.


[web2py] Re: auth.has_membership syntax erron

2010-10-03 Thread mdipierro
more likely there is an incomplete line before and it expects an
indented block

On Oct 3, 9:41 am, Dr Schmulge  wrote:
> Hi all
>
>  Missing gluon.tools  import ??
>
> File "/home/john/web2py/applications/testapp/models/menu.py", line 32
>     if auth.has_membership(auth.id_group('Administrator')):
>      ^
> SyntaxError: invalid syntax
>
> in file menu.py
>
> if auth.has_membership(auth.id_group('Administrator')):
>       response.menu=[
>      [T('Our company'),False,URL('index')],
>      [T('Contacts'),False,URL('list_contacts')],
>      [T('Help'),False,URL('list_persons')],
>      [T('Users'),False,URL('list_tasks')],
>      [T('MAPP'),False,URL('list_tasks')],
>      [T('RFID'),False,URL('list_tasks')],
>      [T('Report'),False,URL('list_tasks')],
> ]
>
> Thanks in advance.


Re: [web2py] Re: auth.has_membership syntax erron

2010-10-03 Thread Dr Schmulge
Thank you , sorry , this is my fault, stupid copy past error  .

2010/10/3 mdipierro :
> more likely there is an incomplete line before and it expects an
> indented block
>
> On Oct 3, 9:41 am, Dr Schmulge  wrote:
>> Hi all
>>
>>  Missing gluon.tools  import ??
>>
>> File "/home/john/web2py/applications/testapp/models/menu.py", line 32
>>     if auth.has_membership(auth.id_group('Administrator')):
>>      ^
>> SyntaxError: invalid syntax
>>
>> in file menu.py
>>
>> if auth.has_membership(auth.id_group('Administrator')):
>>       response.menu=[
>>      [T('Our company'),False,URL('index')],
>>      [T('Contacts'),False,URL('list_contacts')],
>>      [T('Help'),False,URL('list_persons')],
>>      [T('Users'),False,URL('list_tasks')],
>>      [T('MAPP'),False,URL('list_tasks')],
>>      [T('RFID'),False,URL('list_tasks')],
>>      [T('Report'),False,URL('list_tasks')],
>> ]
>>
>> Thanks in advance.


[web2py] Re: auth.has_membership syntax erron

2010-10-03 Thread mdipierro
we all do that.  ;-)

On Oct 3, 12:28 pm, Dr Schmulge  wrote:
> Thank you , sorry , this is my fault, stupid copy past error  .
>
> 2010/10/3 mdipierro :
>
> > more likely there is an incomplete line before and it expects an
> > indented block
>
> > On Oct 3, 9:41 am, Dr Schmulge  wrote:
> >> Hi all
>
> >>  Missing gluon.tools  import ??
>
> >> File "/home/john/web2py/applications/testapp/models/menu.py", line 32
> >>     if auth.has_membership(auth.id_group('Administrator')):
> >>      ^
> >> SyntaxError: invalid syntax
>
> >> in file menu.py
>
> >> if auth.has_membership(auth.id_group('Administrator')):
> >>       response.menu=[
> >>      [T('Our company'),False,URL('index')],
> >>      [T('Contacts'),False,URL('list_contacts')],
> >>      [T('Help'),False,URL('list_persons')],
> >>      [T('Users'),False,URL('list_tasks')],
> >>      [T('MAPP'),False,URL('list_tasks')],
> >>      [T('RFID'),False,URL('list_tasks')],
> >>      [T('Report'),False,URL('list_tasks')],
> >> ]
>
> >> Thanks in advance.
>
>


[web2py] @Massimo: email notification on documentation User Comments additions

2010-10-03 Thread cjrh
Hi Massimo

Is it possible for you to set something up so that I can be notified
by email whenever a visitor to the web2py book leaves a User Comment?
Frequently, these comments point out errors in the documentation.  I
would like to fix errors faster, but I don't get around to check the
all comments often enough.

While we're at it, if anyone else is willing to email documentation
bugs to me directly, that's fine too, and I'll try to fix them as soon
as possible, time permitting.   IMO, "Documentation bugs" also
includes passages that are more difficult to understand than they
might need to be.


[web2py] Re: @Massimo: email notification on documentation User Comments additions

2010-10-03 Thread mdipierro
Good point. I will look into ti. should not be difficult but I am
swamped at the moment.
If it does not get done in one week, please remind me personally.

Massimo

On Oct 3, 2:20 pm, cjrh  wrote:
> Hi Massimo
>
> Is it possible for you to set something up so that I can be notified
> by email whenever a visitor to the web2py book leaves a User Comment?
> Frequently, these comments point out errors in the documentation.  I
> would like to fix errors faster, but I don't get around to check the
> all comments often enough.
>
> While we're at it, if anyone else is willing to email documentation
> bugs to me directly, that's fine too, and I'll try to fix them as soon
> as possible, time permitting.   IMO, "Documentation bugs" also
> includes passages that are more difficult to understand than they
> might need to be.


[web2py] Re: experimental... .pdf

2010-10-03 Thread mart
@Michele: Thanks for that, I will make good use of it! :)

@Massimo: scaling is one of those options that is more often set by
the pdf viewer (because what generates the pdf usually sets the
default to "scaling=enabled"). If I re-use that fingerboard example:
When using the app, the young violinist, will be asked to measure his/
her violin's scale length (from nut to bridge). then enters the
measurement, exactly.  so by simply using the rule of 18 (really
17.817), it generates that template that he/she can print and use to
out his position markers on the violin. The important thing, is that
the printed pdf must be exact, if not he/she will be pitchy. Which
means, if scaling is enabled, the printer will print in a wysisyg
fashion (fits the screen)... which is completely wrong. there must be
no scaling at all, print the exact measutrements.

Since PDF seems to be a hot issue, here's how I use reportlab to
generate the pdf templates (but now, I want to use the web2py builtin
libs) - I know, not too too pretty, but works :)

Thanks,
Mart :)

'''
@author: mart
'''
import os, sys, string
from pyFret.reportlab.pdfgen.canvas import Canvas
from pyFret.reportlab.lib.pagesizes import letter, A4
from pyFret.reportlab.lib.units import cm, mm, inch, pica
from pyFret.reportlab.graphics.charts.textlabels import Label
from pyFret.reportlab.lib import colors

 
#
 
M
## create string instrument position markers
A###
 
##R##
 
###T#


"""
ref. 4/4 = 32.6 ou 32.7 cm
rect(x, y, width, height, stroke=1, fill=0)
RGB Brown =(107,66,38)
RGB Purple = (135,31,120)
"""

###
# rule of 18, unrounded to 17.817 #
###
n = 17.817

#
# number of position markers to create  #
#
markers = 12

###
# list of standard markers as indices #
###
indexList = [1,3,4,6,8,10,11]

#
# string resources  #
#
sJoin = ' join at previous marker'

def main():
 
##
# will create position markers in range of 2000 mm to 9000 mm,
converted to cm (20.00 to 90.00)  #
# dynamically printed to
PDF
#
 
##
#createAll()
# Test()
byInput()


def byInput():
sLenght = raw_input("your scale lenght: ")
calculateOffsetFromScaleLenght(float(sLenght))

def Test():
List = [32.6,21.75,21.4,23.45,73,90]
for item in List:
createTest(item)

def createTest(sLenght):
calculateOffsetFromScaleLenght(sLenght)

def createAll():
##
# generate scalelenghts  #
##
i = 20.0
Min = 20
Max = 90
for c in range(Min,Max):
while i < Max:
print i
i += 0.01
calculateOffsetFromScaleLenght(i)

def calculateOffsetFromScaleLenght(initScaleLenght):
offsetList = []
offset = 0
nScaleLenght = initScaleLenght
counter = 0
while counter < markers:
offset = getOffSet(nScaleLenght);
offsetList.append(offset)
nScaleLenght = get_nScalelenght(nScaleLenght,offset)
counter += 1
genPDF(initScaleLenght, (7.62,9.5,12.7),cm, offsetList)

def genPDF(initScaleLenght, (startLine,endLine, stringLine), measure,
offsetList):
##
# create reference to PDF object #
##
pdf = Canvas(str(initScaleLenght) + '.pdf', bottomup=1)
pdf.setFont("Courier", 10)

###
# calculate total lenght of frets #
###
fLenght = 0
for item in offsetList:
fLenght += item

#
# draw nut  #
#
pdf.line(startLine*measure,3*measure,endLine*measure,3*measure)
pdf.drawString(stringLine * measure, 3*measure, str(0) + ' /nut/'
+ str(initScaleLenght))

#
# if offsets are generated  (valid number)  #
#
if len(offsetList) > 0:
pageLenghtMax = 26
accruedOffSet = 0
belowMaxList = []
##
# draw terminating rectangle #
##
pdf.setStrokeColorRGB(0, 0, 0)
pdf.rect(startLine*measure, 3*measure, 1.9*measure,
(fLenght)*measure, stroke=1, fill=0)

#
# build up belowMaxList #

Re: [web2py] experimental... .pdf

2010-10-03 Thread Michele Comitini
@Massimo,

is it text?

response.headers['content-type']='text'

or

response.headers['content-type']='application/pdf' ?

tnx
mic

2010/10/3 mdipierro :
> install pdflatex
>
> create a views/generic.pdf that contains:
>
>  begin file 
> {{
> import re
> from gluon.contrib.markmin.markmin2pdf import markmin2pdf
> def markmin_serializer(text,tag=None,attr={}):
>    if tag==None: return re.sub('\s+',' ',text)
>    if tag=='br': return '\n\n'
>    if tag=='h1': return '# '+text+'\n\n'
>    if tag=='h2': return '#'*2+' '+text+'\n\n'
>    if tag=='h3': return '#'*3+' '+text+'\n\n'
>    if tag=='h4': return '#'*4+' '+text+'\n\n'
>    if tag=='li': return '\n- '+text.replace('\n',' ')
>    if tag=='table': return '\n-\n'+text+'\n--\n'
>    if tag=='tr': return text[3:].replace('\n',' ')+'\n'
>    if tag=='td': return ' | '+text
>    if tag=='p': return text+'\n\n'
>    if tag=='b' or tag=='strong': return '**%s**' % text
>    if tag=='em' or tag=='i': return "''%s''" % text
>    if tag=='tt' or tag=='code': return '``%s``' % text
>    if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
>    return text
> html=response.render('%s/%s.html' %
> (request.controller,request.function))
> markmin=TAG(html).element('#content').flatten(markmin_serializer)
> response.write(markmin2pdf(markmin)[0],escape=False)
> response.headers['content-type']='text'
> }}
>  end file---
>
> Now you should be able to view any web2py page with .pdf in pdf.
>
> I am sure this can also be done and better with pyfpdf but I have not
> tried. Perhaps Mariano can help us


[web2py] Re: Select specific fields on GAE

2010-10-03 Thread István Gazsi
I think it almost works. :) The uploaded files were redirected to the
gallery_images table, but when I try to display them using the
download function, the app can't retrieve them. I get the following
error:

Traceback (most recent call last):
  File "/base/data/home/apps/scalpellino-manufactory/
3.345245272823609875/gluon/restricted.py", line 188, in restricted
exec ccode in environment
  File "/base/data/home/apps/scalpellino-manufactory/
3.345245272823609875/applications/init/controllers/
gallery.py:download", line 90, in 
  File "/base/data/home/apps/scalpellino-manufactory/
3.345245272823609875/gluon/globals.py", line 96, in 
self._caller = lambda f: f()
  File "/base/data/home/apps/scalpellino-manufactory/
3.345245272823609875/applications/init/controllers/
gallery.py:download", line 88, in download
  File "/base/data/home/apps/scalpellino-manufactory/
3.345245272823609875/gluon/globals.py", line 196, in download
(filename, stream) = field.retrieve(name)
  File "/base/data/home/apps/scalpellino-manufactory/
3.345245272823609875/gluon/sql.py", line 2865, in retrieve
data = self.uploadfield._table(query)[blob_uploadfield_name]
TypeError: 'NoneType' object is unsubscriptable

István

On Oct 2, 10:01 pm, mdipierro  wrote:
> hmm. a GAE thing. I think it is fixed now. One more test please.
>
> On Oct 2, 11:44 am, István Gazsi  wrote:
>
>
>
>
>
>
>
> > I have tried it on GAE, but it looks like it uses the gallery table
> > instead of the gallery_images table, so the uploaded files are not
> > redirected to the other db table.
>
> > On Oct 1, 9:58 pm, István Gazsi  wrote:
>
> > > It's great now it works! :) Thank you very much. I will test it on GAE
> > > as soon as I can and I'll post the results here.
>
> > > Have a nice day!
>
> > > István
>
> > > On Oct 1, 9:18 pm, mdipierro  wrote:
>
> > > > Now I think I fixed it. This time I tried it. Please double check.
> > > > Notice you can have a single table with all your files and more than
> > > > one record from different tables use that as uploadfield.
>
> > > > Massimo
>
> > > > On Oct 1, 1:29 pm, István Gazsi  wrote:
>
> > > > > I've made a little mistake, because I added the uploadfield option to
> > > > > another field, but it didn't cause any problem. But it looks like when
> > > > > I upload a file into the redirected field (the one with the
> > > > > uploadfield option) web2py still doesn't create a new record in the
> > > > > gallery_images table, and it can't load the image later. Here is the
> > > > > traceback:
>
> > > > > Traceback (most recent call last):
> > > > >   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
> > > > > restricted.py", line 188, in restricted
> > > > >     exec ccode in environment
> > > > >   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/
> > > > > applications/init/controllers/gallery.py", line 90, in 
> > > > >   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
> > > > > globals.py", line 96, in 
> > > > >     self._caller = lambda f: f()
> > > > >   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/
> > > > > applications/init/controllers/gallery.py", line 88, in download
> > > > >     return response.download(request,db,attachment=False)
> > > > >   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
> > > > > globals.py", line 196, in download
> > > > >     (filename, stream) = field.retrieve(name)
> > > > >   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
> > > > > sql.py", line 2865, in retrieve
> > > > >     data = self.uploadfield._table(query)[blob_uploadfield_name]
> > > > > TypeError: 'NoneType' object is unsubscriptable
>
> > > > > And I'm really thankful for your hard work and help. :)
>
> > > > > István
>
> > > > > On Oct 1, 8:05 pm, mdipierro  wrote:
>
> > > > > > one more try please
>
> > > > > > On Oct 1, 11:52 am, István Gazsi  wrote:
>
> > > > > > > I forgot to mention that I inserted a record into the gallery 
> > > > > > > table. :)


[web2py] Packt Publishing Web2py cookbook

2010-10-03 Thread Richard
Just got this email:

"""
Hi,

I am Usha Iyer, an Acquisition Editor with Packt Publishing. As an
Acquisition Editor, it is my role to evaluate, develop and ultimately
bring book ideas to publication. I am also responsible for finding the
right author for any book; bringing them onboard, then working with
them as the book is written.

Recently, I have begun to develop a title on ‘Web2py cookbook’, and am
now looking for an author to write this book. This book will consist
of some recipes for people who are already familiar with Web2py .

You can find some more information about writing for us at Packt’s
website http://www.packtpub.com/authors.

Please contact me if you are interested in writing this book and I
would love to discuss the opportunity with you further.

Even if you do not want to involve yourself in the project, can you
please suggest someone who may suit this project?

Thanks,
Usha
Email: us...@packtpub.com
"""


Re: [web2py] Script to generate schema (models) from mysql

2010-10-03 Thread Alexandre Andrade
Alvaro,

I didn't see this post before.

this can be a great feature and I will trye to adapt it to postgresql and
mysql, at least.

if massimo already don't use it, with sqlite, postresql and mysql, it can
worth the value.



2010/6/11 Álvaro Justen 

> Hello Alexandre, nice work.
> I did it in past for SQLite and made it integrated to DAL
> I think we can union the implementations and try to get more databases
> working with this code.
>
> The email I sent to Massimo talking about my work (in the end of 2009)
> is copied and my code is attached:
>
> Note: I think we should discuss it in web2py-dev list.
>
> --
>
> Hi Massimo,
> Some weeks ago I had an idea: db.discover_tables() - a function that
> will search DB and map it into web2py's DAL.
> Today a user asked about it in mail list, so I decided to try: and my
> first result is good, I think.
>
> My implementation only have support to SQLite, but we can add all
> databases with a little effort - I think you could help me in this
> task.
>
> I modified that simple 'news' app an gluon/sql.py. My modification is
> NOT based on SVN, it is based in 1.62 rc1.
> To test: modify db.py, uncomment define_table and comment
> discover_tables. So, web2py will create tables. Enter in appadmin and
> populate them. After that, comment all define_table and uncomment
> discover_tables. So, enter in:
>
> http://localhost:8000/news/appadmin/select/db?query=db.authors.id%3E0
> http://localhost:8000/news/appadmin/select/db?query=db.news.id%3E0
> http://localhost:8000/news/default/test
> http://localhost:8000/news/default/create_code
>
> In gluon/sql.py I added:
>  - method discover_tables in class SQLDB.
>  - some code in __init__ in class SQLDB.
>  - keys 'show_tables' and 'table_fields' in SQL_DIALECTS['sqlite'] ->
> please add keys to other databases and test if you could.
>
> I'm sure that this code can be optimized.
>
> What do you think?
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141
>



-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com


[web2py] Building Rows and Columns

2010-10-03 Thread Andrew Evans
Hello all

I am facing a challenge in my code for some reason the logic to generate a
group of div tags in a 3 by 3 column is eluding me

here is my code I am missing something can anyone help

if you can help by showing me a way to avoid using tables that would be
great if not and end up using tables thats fine to

{{counter = 0}}
Displaying Current Products

{{i = 1}}

{{for row in rows:}}
{{if counter == 0:}}

{{pass}}




{{=i}} . {{=A(row.product_name,
_href=URL('indv_product', args=row.id))}} 










{{if counter == 3:}}

{{pass}}

{{counter += 1}}

{{if counter == 4:}}
{{counter = 0}}
{{pass}}


{{pass}}



*cheers


[web2py] Re: experimental... .pdf

2010-10-03 Thread mdipierro
if there are errors it should return text containing the errors, else
pdf. This mechanism for error reporting is temporary and does not
quite work.

On Oct 3, 3:02 pm, Michele Comitini 
wrote:
> @Massimo,
>
> is it text?
>
> response.headers['content-type']='text'
>
> or
>
> response.headers['content-type']='application/pdf' ?
>
> tnx
> mic
>
> 2010/10/3 mdipierro :
>
> > install pdflatex
>
> > create a views/generic.pdf that contains:
>
> >  begin file 
> > {{
> > import re
> > from gluon.contrib.markmin.markmin2pdf import markmin2pdf
> > def markmin_serializer(text,tag=None,attr={}):
> >    if tag==None: return re.sub('\s+',' ',text)
> >    if tag=='br': return '\n\n'
> >    if tag=='h1': return '# '+text+'\n\n'
> >    if tag=='h2': return '#'*2+' '+text+'\n\n'
> >    if tag=='h3': return '#'*3+' '+text+'\n\n'
> >    if tag=='h4': return '#'*4+' '+text+'\n\n'
> >    if tag=='li': return '\n- '+text.replace('\n',' ')
> >    if tag=='table': return '\n-\n'+text+'\n--\n'
> >    if tag=='tr': return text[3:].replace('\n',' ')+'\n'
> >    if tag=='td': return ' | '+text
> >    if tag=='p': return text+'\n\n'
> >    if tag=='b' or tag=='strong': return '**%s**' % text
> >    if tag=='em' or tag=='i': return "''%s''" % text
> >    if tag=='tt' or tag=='code': return '``%s``' % text
> >    if tag=='a': return '[[%s %s]]' % (text,attr.get('_href',''))
> >    return text
> > html=response.render('%s/%s.html' %
> > (request.controller,request.function))
> > markmin=TAG(html).element('#content').flatten(markmin_serializer)
> > response.write(markmin2pdf(markmin)[0],escape=False)
> > response.headers['content-type']='text'
> > }}
> >  end file---
>
> > Now you should be able to view any web2py page with .pdf in pdf.
>
> > I am sure this can also be done and better with pyfpdf but I have not
> > tried. Perhaps Mariano can help us
>
>


[web2py] Re: Packt Publishing Web2py cookbook

2010-10-03 Thread mdipierro
A bunch of us got that. If you did please contact me privately.

Massimo

On Oct 3, 4:27 pm, Richard  wrote:
> Just got this email:
>
> """
> Hi,
>
> I am Usha Iyer, an Acquisition Editor with Packt Publishing. As an
> Acquisition Editor, it is my role to evaluate, develop and ultimately
> bring book ideas to publication. I am also responsible for finding the
> right author for any book; bringing them onboard, then working with
> them as the book is written.
>
> Recently, I have begun to develop a title on ‘Web2py cookbook’, and am
> now looking for an author to write this book. This book will consist
> of some recipes for people who are already familiar with Web2py .
>
> You can find some more information about writing for us at Packt’s
> websitehttp://www.packtpub.com/authors.
>
> Please contact me if you are interested in writing this book and I
> would love to discuss the opportunity with you further.
>
> Even if you do not want to involve yourself in the project, can you
> please suggest someone who may suit this project?
>
> Thanks,
> Usha
> Email: us...@packtpub.com
> """


[web2py] Re: Script to generate schema (models) from mysql

2010-10-03 Thread mdipierro
we also have

scripts/extract_mysql_models.py

Massimo

On Oct 3, 5:37 pm, Alexandre Andrade  wrote:
> Alvaro,
>
> I didn't see this post before.
>
> this can be a great feature and I will trye to adapt it to postgresql and
> mysql, at least.
>
> if massimo already don't use it, with sqlite, postresql and mysql, it can
> worth the value.
>
> 2010/6/11 Álvaro Justen 
>
>
>
> > Hello Alexandre, nice work.
> > I did it in past for SQLite and made it integrated to DAL
> > I think we can union the implementations and try to get more databases
> > working with this code.
>
> > The email I sent to Massimo talking about my work (in the end of 2009)
> > is copied and my code is attached:
>
> > Note: I think we should discuss it in web2py-dev list.
>
> > --
>
> > Hi Massimo,
> > Some weeks ago I had an idea: db.discover_tables() - a function that
> > will search DB and map it into web2py's DAL.
> > Today a user asked about it in mail list, so I decided to try: and my
> > first result is good, I think.
>
> > My implementation only have support to SQLite, but we can add all
> > databases with a little effort - I think you could help me in this
> > task.
>
> > I modified that simple 'news' app an gluon/sql.py. My modification is
> > NOT based on SVN, it is based in 1.62 rc1.
> > To test: modify db.py, uncomment define_table and comment
> > discover_tables. So, web2py will create tables. Enter in appadmin and
> > populate them. After that, comment all define_table and uncomment
> > discover_tables. So, enter in:
>
> >http://localhost:8000/news/appadmin/select/db?query=db.authors.id%3E0
> >http://localhost:8000/news/appadmin/select/db?query=db.news.id%3E0
> >http://localhost:8000/news/default/test
> >http://localhost:8000/news/default/create_code
>
> > In gluon/sql.py I added:
> >  - method discover_tables in class SQLDB.
> >  - some code in __init__ in class SQLDB.
> >  - keys 'show_tables' and 'table_fields' in SQL_DIALECTS['sqlite'] ->
> > please add keys to other databases and test if you could.
>
> > I'm sure that this code can be optimized.
>
> > What do you think?
>
> > --
> > Álvaro Justen - Turicas
> >  http://blog.justen.eng.br/
> >  21 9898-0141
>
> --
> Atenciosamente
>
> --
> =
> Alexandre Andrade
> Hipercenter.com


[web2py] Autocomplete widget doesn't work on GAE?

2010-10-03 Thread Tito Garrido
I'm trying to use autocomplete widget (
http://web2py.com/book/default/chapter/07#Autocomplete-Widget) on GAE and
I'm receiving this error:
Traceback (most recent call last):
  File
"/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/restricted.py",
line 188, in restricted
exec ccode in environment
  File
"/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/applications/init/models/db.py",
line 171, in 
db.user_jogo.jogo.widget = SQLFORM.widgets.autocomplete(request,
db.jogo.nome, id_field=db.jogo.id)
  File
"/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/sqlhtml.py",
line 473, in __init__
self.callback()
  File
"/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/sqlhtml.py",
line 479, in callback
rows = self.db(field.like(self.request.vars[self.keyword]+'%'))\
  File
"/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/contrib/gql.py",
line 140, in __call__
return Set(self, where)
  File
"/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/contrib/gql.py",
line 639, in __init__
self._tables = [filter.left._tablename for filter in where.filters]
AttributeError: 'Query' object has no attribute 'filters'


Is it expected?

Regards,

Tito


-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] Re: Building Rows and Columns

2010-10-03 Thread mdipierro
I would do this:

{{def display(i,row):}}
{{=i}} . {{=A(row.product_name,
_href=URL('indv_product', args=row.id))}} 






{{return}}


{{for i,row in enumerate(rows):}}
  {{if i%3==0:}}{{pass}}
{{display(i,row)}}
  {{if i%3==2:}}{{pass}}
{{pass}}
{{# fill up blanks #}}
{{for j in range(i%3,2):}}{{pass}}{{if i%3!=2}}{{pass}}


On Oct 3, 5:58 pm, Andrew Evans  wrote:
> Hello all
>
> I am facing a challenge in my code for some reason the logic to generate a
> group of div tags in a 3 by 3 column is eluding me
>
> here is my code I am missing something can anyone help
>
> if you can help by showing me a way to avoid using tables that would be
> great if not and end up using tables thats fine to
>
> {{counter = 0}}
> Displaying Current Products
> 
> {{i = 1}}
>
> {{for row in rows:}}
> {{if counter == 0:}}
> 
> {{pass}}
> 
> 
> 
>
> {{=i}} . {{=A(row.product_name,
> _href=URL('indv_product', args=row.id))}} 
> 
>  width="100" height="100" onclick="this.src='{{=URL('default','download',
> args=row.image)}}'; this.height=420;this.width=300"
> ondblclick="this.src='{{=URL('default','download',
> args=row.image)}}';this.height=100;this.width=100" title="Click to Enlarge
> Image" border="2">
>
> 
>
> 
> 
> 
> 
> {{if counter == 3:}}
> 
> {{pass}}
>
> {{counter += 1}}
>
> {{if counter == 4:}}
> {{counter = 0}}
> {{pass}}
>
> {{pass}}
> 
>
> *cheers


Re: [web2py] Re: web2py 1.86.1 is OUT

2010-10-03 Thread Manu
Hi ,
  I have tried this release and have some issues with the Windows
release . Here is the log generated when i start the
web2py_no_console.exe .

Traceback (most recent call last):
  File "web2py.py", line 17, in 
  File "gluon/widget.py", line 25, in 
  File "gluon/main.py", line 44, in 
  File "gluon/globals.py", line 18, in 
  File "gluon/compileapp.py", line 26, in 
  File "gluon/sql.py", line 44, in 
  File "gluon/serializers.py", line 8, in 
  File "gluon/html.py", line 25, in 
ImportError: No module named markmin2html

Thx for fixing this .



On Sun, Oct 3, 2010 at 4:13 PM, mdipierro  wrote:
> I knew I forgot something important. I apologize.
>
> 1.86.1 also includes Hebrew translation by our user Yair. He did more
> than that since he fixed some typos in many of the existing
> translations.
>
> Massimo
>
> On Oct 3, 12:49 am, guruyaya  wrote:
>> Oh, awsome! I see there's Hebrew and RTL support, in the admin! Who is
>> this fine work?
>> Sorry. I just like the attention.
>>
>> On Oct 2, 10:50 pm, mdipierro  wrote:
>>
>> > Changelog:
>>
>> > markmin2latex
>> > markmin2pdf
>> > Storage getfirst, getlast, getall by Kevin and Nathan
>> > db(db.table), db(db.table.id) both supported and equivalent to
>> > db(db.table.id>0)
>> > postresql ssl support
>> > less unnecessary logging and warnings on GAE
>> > IS_DECIMAL_IN_RANGE and IS_FLOAT_IN_RANGE support dot="," (dot="." is
>> > default)
>> > on_failed_authorization can be a function, thanks Niphold
>> > gluon/contrib/login_methods/cas_auth.py for integration between CAS
>> > and Auth.
>> > many bug fixes and small improvements
>>
>>
>


[web2py] Re: Autocomplete widget doesn't work on GAE?

2010-10-03 Thread mdipierro
Yes.

You can make it work (sort of) if you edit gluon/sqlhtml.py and
replace

rows = self.db(field.like(self.request.vars[self.keyword]
+'%'))\
.select(orderby=self.orderby,limitby=self.limitby,*self.fields)

with

rows = self.db(field>=self.request.vars[self.keyword])\
  (field<=self.request.vars[self.keyword]
+chr(126))\
.select(orderby=self.orderby,limitby=self.limitby,*self.fields)

It will work but case will have to be exact.

The problem is, as usual, gae does not allow searching substrings.

On Oct 3, 8:33 pm, Tito Garrido  wrote:
> I'm trying to use autocomplete widget 
> (http://web2py.com/book/default/chapter/07#Autocomplete-Widget) on GAE and
> I'm receiving this error:
> Traceback (most recent call last):
>   File
> "/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/restricted.py",
> line 188, in restricted
>     exec ccode in environment
>   File
> "/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/applications/init/models/db.py",
> line 171, in 
>     db.user_jogo.jogo.widget = SQLFORM.widgets.autocomplete(request,
> db.jogo.nome, id_field=db.jogo.id)
>   File
> "/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/sqlhtml.py",
> line 473, in __init__
>     self.callback()
>   File
> "/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/sqlhtml.py",
> line 479, in callback
>     rows = self.db(field.like(self.request.vars[self.keyword]+'%'))\
>   File
> "/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/contrib/gql.py",
> line 140, in __call__
>     return Set(self, where)
>   File
> "/Users/titogarrido/Documents/Projetos/GAE/gametroca/web2py/gluon/contrib/gql.py",
> line 639, in __init__
>     self._tables = [filter.left._tablename for filter in where.filters]
> AttributeError: 'Query' object has no attribute 'filters'
>
> Is it expected?
>
> Regards,
>
> Tito
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___


[web2py] Re: web2py 1.86.1 is OUT

2010-10-03 Thread mdipierro
Fixed in 1.86.2

incidentally I discovered the win binary was missing login_methods and
both osx and win binaries were missing pyfpdf.

I am surprised nobody noticed. This was an error in the build script
now fixed.

Massimo

On Oct 3, 9:01 pm, Manu  wrote:
> Hi ,
>   I have tried this release and have some issues with the Windows
> release . Here is the log generated when i start the
> web2py_no_console.exe .
>
> Traceback (most recent call last):
>   File "web2py.py", line 17, in 
>   File "gluon/widget.py", line 25, in 
>   File "gluon/main.py", line 44, in 
>   File "gluon/globals.py", line 18, in 
>   File "gluon/compileapp.py", line 26, in 
>   File "gluon/sql.py", line 44, in 
>   File "gluon/serializers.py", line 8, in 
>   File "gluon/html.py", line 25, in 
> ImportError: No module named markmin2html
>
> Thx for fixing this .
>
> On Sun, Oct 3, 2010 at 4:13 PM, mdipierro  wrote:
> > I knew I forgot something important. I apologize.
>
> > 1.86.1 also includes Hebrew translation by our user Yair. He did more
> > than that since he fixed some typos in many of the existing
> > translations.
>
> > Massimo
>
> > On Oct 3, 12:49 am, guruyaya  wrote:
> >> Oh, awsome! I see there's Hebrew and RTL support, in the admin! Who is
> >> this fine work?
> >> Sorry. I just like the attention.
>
> >> On Oct 2, 10:50 pm, mdipierro  wrote:
>
> >> > Changelog:
>
> >> > markmin2latex
> >> > markmin2pdf
> >> > Storage getfirst, getlast, getall by Kevin and Nathan
> >> > db(db.table), db(db.table.id) both supported and equivalent to
> >> > db(db.table.id>0)
> >> > postresql ssl support
> >> > less unnecessary logging and warnings on GAE
> >> > IS_DECIMAL_IN_RANGE and IS_FLOAT_IN_RANGE support dot="," (dot="." is
> >> > default)
> >> > on_failed_authorization can be a function, thanks Niphold
> >> > gluon/contrib/login_methods/cas_auth.py for integration between CAS
> >> > and Auth.
> >> > many bug fixes and small improvements
>
>


Re: [web2py] Re: web2py 1.86.1 is OUT

2010-10-03 Thread Manu
Thx Massimo , It works perfectly on windows now!

On Mon, Oct 4, 2010 at 4:16 AM, mdipierro  wrote:
> Fixed in 1.86.2
>
> incidentally I discovered the win binary was missing login_methods and
> both osx and win binaries were missing pyfpdf.
>
> I am surprised nobody noticed. This was an error in the build script
> now fixed.
>
> Massimo
>


[web2py] Re: web2py 1.86.1 is OUT

2010-10-03 Thread mdipierro
Thank you for reporting the problem. Hard to fix things when I do not
know there is a problem. ;-)

On Oct 3, 9:22 pm, Manu  wrote:
> Thx Massimo , It works perfectly on windows now!
>
> On Mon, Oct 4, 2010 at 4:16 AM, mdipierro  wrote:
> > Fixed in 1.86.2
>
> > incidentally I discovered the win binary was missing login_methods and
> > both osx and win binaries were missing pyfpdf.
>
> > I am surprised nobody noticed. This was an error in the build script
> > now fixed.
>
> > Massimo
>
>


Re: [web2py] Re: Building Rows and Columns

2010-10-03 Thread Andrew Evans
hey ty that gives me a good start

*Cheers


[web2py] How to loop through two items

2010-10-03 Thread Andrew Evans
I am trying to use two database values returned in my function

If I use two loops (one inside another) it repeats itself for a single item
for how many items are in the database, I think its cause of the two loops

So I am trying to combine the loops into one

{{for (stuff, products) in (userstuff, product):}}

But I am unsure how to do this

Any ideas

Or is there anyway to use the values in the view with out using a for loop
and looping in general that may be best

*cheers


Re: [web2py] How to loop through two items

2010-10-03 Thread Gary Herron

On 10/03/2010 08:21 PM, Andrew Evans wrote:

I am trying to use two database values returned in my function

If I use two loops (one inside another) it repeats itself for a single 
item for how many items are in the database, I think its cause of the 
two loops


So I am trying to combine the loops into one

{{for (stuff, products) in (userstuff, product):}}

But I am unsure how to do this

Any ideas

Or is there anyway to use the values in the view with out using a for 
loop and looping in general that may be best


*cheers


Use the built-in called zip:

for stuff,product in zip(stuff_list, product_list):
  ...

Then the two lists will be walked through in lock step.

See http://docs.python.org/library/functions.html for documentation.

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



Re: [web2py] Script to generate schema (models) from mysql

2010-10-03 Thread Álvaro Justen [Turicas]
On Sun, Oct 3, 2010 at 19:37, Alexandre Andrade
 wrote:
> Alvaro,
>
> I didn't see this post before.
>
> this can be a great feature and I will trye to adapt it to postgresql and
> mysql, at least.
>
> if massimo already don't use it, with sqlite, postresql and mysql, it can
> worth the value.

Please post news about this. :-)

-- 
Álvaro Justen - @turicas
 http://blog.justen.eng.br/
 21 9898-0141