[web2py] Re: Javascript Template Engine for Cleaner Coding

2010-10-01 Thread Magnitus
Never heard of it.

With jQuery (http://jquery.com/), the Javascript part is not so bad as
about 95% of the browser dependant code is handled by the library.

However, css is still a real pain in the neck. I know people like to
complain about IE, but Google Chrome and Apple Safari are the ones
that give me big head aches for the css inconsistencies (I find that
IE and Firefox render things about the same way at least as far as
positioning and size go, Opera doesn't give me too many problems
either, though the fact that it renders thing smaller for a given
pixel value is midly irritating).

In the end, I decided to make everything that I could absolutely
positioned to reduce the amount of layout problems across browsers.

You can also place things dynamically when the page is loaded using
jQuery's ready handler (I found it especially useful for centering
your page on the screen if it doesn't take up the whole screen so that
your content is not stuck on the upper-left corner which looks ugly),
but you gotta be careful about one thing:

If you load your css info in a separate file, they may or may not be
loaded when your Javascript start executing (meaning all the
positioning, width and height values you defined in the css may not be
defined when the javascript start executing). I had this problem with
the Chrome/Safari browsers (big suprise) with a really slow server (my
slow USB stick which is not a bad simulation of what might happen to
the server under stress as far as page loading goes).

The solution I found to alleviate the above was to implement the css
definitions that I needed for the jQuery 'ready' handler directly in
the html page.

Hours of fun.

On Oct 2, 1:10 am, yamandu  wrote:
> Hi, I found thishttp://www.embeddedjs.com/
>
> Haven´t teste yet, but looks interesting.
> The goal is help by letting code html/javascript code cleanner by
> using templates
> similar to web2py templates.
>
> I always almost get crazy when writing html/javascript code.
> It always get confusing and this might help.
>
> Anyone knows it?
> I think I can imagine some cons, do you too?


[web2py] Javascript Template Engine for Cleaner Coding

2010-10-01 Thread yamandu
Hi, I found this
http://www.embeddedjs.com/

Haven´t teste yet, but looks interesting.
The goal is help by letting code html/javascript code cleanner by
using templates
similar to web2py templates.

I always almost get crazy when writing html/javascript code.
It always get confusing and this might help.

Anyone knows it?
I think I can imagine some cons, do you too?


Re: [web2py] Re: Simple PDF Report in Slices

2010-10-01 Thread Mariano Reingart
On Fri, Oct 1, 2010 at 10:12 AM, smg  wrote:
> Hi Mariano,
>
> I want to say thank you for  fpdf port.
>
>> Pyfpdf should work well with accented characters (LATIN1, by PDF specs).
>> In fact I use it in Argentina (spanish).
>
>> Of course, suggestions are wellcome, and any fix will be accepted :-)
>
> Pyfpdf add_font method is broken in 1.54b, and  I made quick dirty
> fix  for my web2py application. Is it hard to port UTF-8 support to
> pyfpdf?

No, indeed, it should be easier than in php, as Python has better
unicode support!

Here is how it is done in php (tfpdf and SFPDF, based on FPDF):
http://www.fpdf.org/en/script/script92.php
http://www.fpdf.org/en/script/script91.php

There are other recipes (scripts) to add support for other custom font
types and languages.

If you are interested, any help is welcome, and if you want to send me
your add_font patch, I'll be happy to review and include it

If you can, please fill an issue in pyfpdf.googlecode.com for both

Best regards,

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


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

2010-10-01 Thread Mariano Reingart
On Fri, Oct 1, 2010 at 3:40 PM, Ivan Matveev  wrote:
>
>
> 2010/10/1 mdipierro 
>>
>> keyed tables are only partially supported. Perhaps user Denes can say
>> more about that. For now here is a quick hack that should work:
>>
>
> Thank you for fast reply.
>
>>
>> db.define_table('cars',
>>    Field('car_id','integer'),
>>    Field('model_id',
>> 'integer',requires=IS_IN_DB(db,'car_models.model_id','%
>> (model_name)s')),
>>    Field('note','text'),
>>    primarykey=['car_id'],
>>    migrate=False
>> )
>>
>
> Thats what I'm using now.  Some nice tools (like WebGrid) don't work  this
> way. Maybe I'l try to fix WebGrid.
>

Did you try string notation for references?

db.define_table('cars',
   Field('car_id','integer'),
   Field('model_id', "reference car_models.model_id"),
   Field('note','text'),
   primarykey=['car_id'],
   migrate=False
)

Anyway, if you are using single-field integer primary keys, i think
you may try "id" field type:

db.define_table('car_models',
   Field('model_id','id'),
   Field('model_name','string'),
   migrate=False
)

db.define_table('cars',
   Field('car_id','id'),
   Field('model_id','reference car_models'),
   Field('note','text'),
   migrate=False
)

Regards,

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


Re: [web2py] Any open issues?

2010-10-01 Thread Jason Brower
There is my issue but it has to wait until i am back to work.
- Original message -
> Feel like I am forgot something



[web2py] Re: Search engine for Python Source

2010-10-01 Thread Bruno Rocha
web2py_utils is there
http://nullege.com/codes/show/src%40web2py_utils-0.0.11dev%40web2py_utils%40test_runner.py/76/gluon


2010/10/2 Bruno Rocha 

> Nullege is a search engine for Python source code.
>
> http://nullege.com/
>
>


-- 

http://rochacbruno.com.br


[web2py] Search engine for Python Source

2010-10-01 Thread Bruno Rocha
Nullege is a search engine for Python source code.

http://nullege.com/


[web2py] Any open issues?

2010-10-01 Thread mdipierro
Feel like I am forgot something


[web2py] Re: need a bit of help

2010-10-01 Thread mdipierro
Look also into this other options with may be better

http://www.mengu.net/post/pagination-with-web2py
http://packages.python.org/web2py_utils/paginate.html

On Oct 1, 6:39 pm, Andrew Evans  wrote:
> also there was a syntax error in that code don't know if you want to fix
> it..
>
> These two lines needed to close the A function
>
> backward=A('previous', _href=URL(r=request,args=[page-1])) if page else ''
> forward=A('next', _href=URL(r=request,args=[page+1])) if len(rows) else
> ''
>
> in the example they weren't anyway ty
>
> On Fri, Oct 1, 2010 at 4:36 PM, Andrew Evans  wrote:
> > Ok that pagination works better.
>
> > But for some reason the last entry in the db is always cut any ideas?
> > probably something I am doing but would appreciate some help
>
> > *cheers
>
> > here is the code
>
> > thank you for the help thus far
>
> > def index():
> >     if len(request.args):
> >        page=int(request.args[0])
> >     else:
> >        page=0
> >     query=db.product.id>0
> >     rows=db(query).select(db.product.ALL, orderby=db.product.product_name,
> > groupby=db.product.category, limitby=(page,page+1))
> >     backward=A('previous', _href=URL(r=request,args=[page-1])) if page else
> > ''
> >     forward=A('next', _href=URL(r=request,args=[page+1])) if len(rows) else
> > ''
> >     return dict(rows=rows,backward=backward,forward=forward)
>
> > Cheers
>
> > Andrew
>
> > On Fri, Oct 1, 2010 at 3:19 PM, mdipierro  wrote:
>
> >> Try this:
>
> >>http://www.web2py.com/AlterEgo/default/show/63
>
> >> On Oct 1, 4:41 pm, Andrew Evans  wrote:
> >> > Hello I am trying to create some pagination for my site I am building.
> >> > However this pagination is a bit messed up, (I forget exactly where I
> >> found
> >> > it) when I click next it doesn't display anything else in the database.
>
> >> > Also a few other things are rather odd about it.
>
> >> > Does anyone have some good solid working pagination they can share with
> >> me
>
> >> > *cheers
>
> >> > Here is the code
>
> >> > def index():
> >> >     if len(request.args):
> >> >         page=int(request.args[0])
> >> >     else:
> >> >         page=0
> >> >     items_per_page=2
> >> >     limitby=(page*items_per_page,(page+1)*items_per_page + 1)
> >> >     rows=db().select(db.product.ALL, orderby=db.product.product_name,
> >> > groupby=db.product.category, limitby=limitby)
> >> >     return dict(rows=rows,page=page,items_per_page=items_per_page)
>
> >> --
>
> >> > {{i = i+1}}
> >> > {{pass}}
>
> >> > 
> >> > 
>
> >> > {{if page:}}
> >> > 
>
> >> > previous
>
> >> > {{pass}}
> >> > 
>
> >> > {{if len(rows)>=items_per_page:}}
> >> > 
>
> >> > next
> >> > {{pass}}
>
> >> > 
> >> > 
> >> > 
>
>


Re: [web2py] Re: shorting your URL with routes

2010-10-01 Thread Jonathan Lundell
On Oct 1, 2010, at 9:48 AM, Francisco Costa wrote:
> 
> I would like to improve my users urls by cutting the 'view' function
> out so the url would be http://domain.com/user/username
> 
> Now I have this:
> 
> routes_in = (
>  ("/user/(.+)", r"/welcome/user/view/\1"),
>  ("/(.+)", r"/welcome/\1"),
> )
> 
> routes_out = (
>  ("/welcome/user/view/(.+)", r"/user/\1"),
>  ("/welcome/(.+)", r"/\1"),
> )
> 
> The thing is that I have more functions in the user control and they
> don't work unless I add a route for each of those functions.

Right. But as Wikus pointed out, you can do that with a single route that 
mentions those functions.

It can be easier to look at routes_out first: define how you're going to 
shorten the URLs, make sure it's unambiguous (you don't want to map multiple 
long URLs into a single short one, of course), and then write routes_in to undo 
it.

> 
> 
> On Oct 1, 5:25 pm, Jonathan Lundell  wrote:
>> On Oct 1, 2010, at 9:20 AM, Francisco Costa wrote:
>> 
>> 
>> 
>>> Has I said before, that way other functions of the controller user
>>> don't work
>> 
>> Can you list, more or less, what you're after?
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> :(
>> 
>>> On Oct 1, 3:10 pm, mdipierro  wrote:
 yes
>> 
 routes_in = (
   ("/user/(.+)", r"/welcome/user/view/\1"),
 )
>> 
 routes_out = (
   ("/welcome/user/view/(.+)", r"/user/\1"),
 )
>> 
 On Oct 1, 8:57 am, Francisco Costa  wrote:
>> 
> is it possible?
>> 
> On Oct 1, 10:55 am, Francisco Costa  wrote:
>> 
>> Thank you for your answers, both work for me, i didn't know that the
>> order was important.
>> But the thing is that I have others functions in the user controller
>> that stopped to work, unless I have a dedicated route for them.
>> ex: /welcome/user/index is a list of all users and only works if I
>> had
>> 
>> routes_in:  ("/user/index", r"/welcome/user/index"),
>> routes_out:   ("/welcome/user/index", r"/user/index"),
>> 
>> My question is, if there is any way that you don't have to route every
>> function, and only the view/user
>> 
>> On Sep 30, 3:19 pm, Wikus van de Merwe 
>> wrote:
>> 
>>> You mean this doesn't work for you?
>> 
>>> routes_in = (
>>>   ("/user/(.+)", r"/welcome/user/view/\1"),
>>>   ("/(.+)", r"/welcome/\1")
>>> )
>> 
>>> routes_out = (
>>>   ("/welcome/user/view/(.+)", r"/user/\1"),
>>>   ("/welcome/(.+)", r"/\1")
>>> )




Re: [web2py] Re: need a bit of help

2010-10-01 Thread Andrew Evans
also there was a syntax error in that code don't know if you want to fix
it..

These two lines needed to close the A function

backward=A('previous', _href=URL(r=request,args=[page-1])) if page else ''
forward=A('next', _href=URL(r=request,args=[page+1])) if len(rows) else
''

in the example they weren't anyway ty




On Fri, Oct 1, 2010 at 4:36 PM, Andrew Evans  wrote:

> Ok that pagination works better.
>
> But for some reason the last entry in the db is always cut any ideas?
> probably something I am doing but would appreciate some help
>
> *cheers
>
> here is the code
>
> thank you for the help thus far
>
>
> def index():
> if len(request.args):
>page=int(request.args[0])
> else:
>page=0
> query=db.product.id>0
> rows=db(query).select(db.product.ALL, orderby=db.product.product_name,
> groupby=db.product.category, limitby=(page,page+1))
> backward=A('previous', _href=URL(r=request,args=[page-1])) if page else
> ''
> forward=A('next', _href=URL(r=request,args=[page+1])) if len(rows) else
> ''
> return dict(rows=rows,backward=backward,forward=forward)
>
> Cheers
>
> Andrew
>
>
>
> On Fri, Oct 1, 2010 at 3:19 PM, mdipierro  wrote:
>
>> Try this:
>>
>> http://www.web2py.com/AlterEgo/default/show/63
>>
>> On Oct 1, 4:41 pm, Andrew Evans  wrote:
>> > Hello I am trying to create some pagination for my site I am building.
>> > However this pagination is a bit messed up, (I forget exactly where I
>> found
>> > it) when I click next it doesn't display anything else in the database.
>> >
>> > Also a few other things are rather odd about it.
>> >
>> > Does anyone have some good solid working pagination they can share with
>> me
>> >
>> > *cheers
>> >
>> > Here is the code
>> >
>> > def index():
>> > if len(request.args):
>> > page=int(request.args[0])
>> > else:
>> > page=0
>> > items_per_page=2
>> > limitby=(page*items_per_page,(page+1)*items_per_page + 1)
>> > rows=db().select(db.product.ALL, orderby=db.product.product_name,
>> > groupby=db.product.category, limitby=limitby)
>> > return dict(rows=rows,page=page,items_per_page=items_per_page)
>> >
>> --
>> >
>> > {{i = i+1}}
>> > {{pass}}
>> >
>> > 
>> > 
>> >
>> > {{if page:}}
>> > 
>> >
>> > previous
>> >
>> > {{pass}}
>> > 
>> >
>> > {{if len(rows)>=items_per_page:}}
>> > 
>> >
>> > next
>> > {{pass}}
>> >
>> > 
>> > 
>> > 
>>
>
>


Re: [web2py] Re: need a bit of help

2010-10-01 Thread Andrew Evans
Ok that pagination works better.

But for some reason the last entry in the db is always cut any ideas?
probably something I am doing but would appreciate some help

*cheers

here is the code

thank you for the help thus far

def index():
if len(request.args):
   page=int(request.args[0])
else:
   page=0
query=db.product.id>0
rows=db(query).select(db.product.ALL, orderby=db.product.product_name,
groupby=db.product.category, limitby=(page,page+1))
backward=A('previous', _href=URL(r=request,args=[page-1])) if page else
''
forward=A('next', _href=URL(r=request,args=[page+1])) if len(rows) else
''
return dict(rows=rows,backward=backward,forward=forward)

Cheers

Andrew


On Fri, Oct 1, 2010 at 3:19 PM, mdipierro  wrote:

> Try this:
>
> http://www.web2py.com/AlterEgo/default/show/63
>
> On Oct 1, 4:41 pm, Andrew Evans  wrote:
> > Hello I am trying to create some pagination for my site I am building.
> > However this pagination is a bit messed up, (I forget exactly where I
> found
> > it) when I click next it doesn't display anything else in the database.
> >
> > Also a few other things are rather odd about it.
> >
> > Does anyone have some good solid working pagination they can share with
> me
> >
> > *cheers
> >
> > Here is the code
> >
> > def index():
> > if len(request.args):
> > page=int(request.args[0])
> > else:
> > page=0
> > items_per_page=2
> > limitby=(page*items_per_page,(page+1)*items_per_page + 1)
> > rows=db().select(db.product.ALL, orderby=db.product.product_name,
> > groupby=db.product.category, limitby=limitby)
> > return dict(rows=rows,page=page,items_per_page=items_per_page)
> >
> --
> >
> > {{i = i+1}}
> > {{pass}}
> >
> > 
> > 
> >
> > {{if page:}}
> > 
> >
> > previous
> >
> > {{pass}}
> > 
> >
> > {{if len(rows)>=items_per_page:}}
> > 
> >
> > next
> > {{pass}}
> >
> > 
> > 
> > 
>


[web2py] Re: shorting your URL with routes

2010-10-01 Thread Wikus van de Merwe
Massimo, this will still change "http://domain.com/welcome/user/index";
to "http://domain.com/welcome/user/view/index"; instead of "http://
domain.com/user/index".

Francisco, if I were you, with more functions in the controller, I
wouldn't do any url shortening and simply stay with /user/view/.
Because I don't think there is a way to setup routes without
explicitly listing the functions as below:

USER_FUNCTIONS = ["index", "create", "delete", "view"]

routes_in = (
  ("/user/(?!%s)(.+)" % "|".join(USER_FUNCTIONS), r"/welcome/user/view/
\1"),
  ("/(.+)", r"/welcome/\1")
)

routes_out = (
  ("/welcome/user/view/(.+)", r"/user/\1"),
  ("/welcome/(.+)", r"/\1")
)


[web2py] Re: Language is Reseted when Server is Reseted

2010-10-01 Thread mdipierro
Do you have the latest stable web2py?

On Oct 1, 4:03 pm, yamandu  wrote:
> I translate my pt-br.py but everytime I start the server again it
> loses the translation.
> What can be wrong?


[web2py] Re: need a bit of help

2010-10-01 Thread mdipierro
Try this:

http://www.web2py.com/AlterEgo/default/show/63

On Oct 1, 4:41 pm, Andrew Evans  wrote:
> Hello I am trying to create some pagination for my site I am building.
> However this pagination is a bit messed up, (I forget exactly where I found
> it) when I click next it doesn't display anything else in the database.
>
> Also a few other things are rather odd about it.
>
> Does anyone have some good solid working pagination they can share with me
>
> *cheers
>
> Here is the code
>
> def index():
>     if len(request.args):
>         page=int(request.args[0])
>     else:
>         page=0
>     items_per_page=2
>     limitby=(page*items_per_page,(page+1)*items_per_page + 1)
>     rows=db().select(db.product.ALL, orderby=db.product.product_name,
> groupby=db.product.category, limitby=limitby)
>     return dict(rows=rows,page=page,items_per_page=items_per_page)
> --
>
> {{i = i+1}}
> {{pass}}
>
> 
> 
>
> {{if page:}}
> 
>
> previous
>
> {{pass}}
> 
>
> {{if len(rows)>=items_per_page:}}
> 
>
> next
> {{pass}}
>
> 
> 
> 


[web2py] Re: Confirm deletion of record

2010-10-01 Thread mdipierro
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.


[web2py] Confirm deletion of record

2010-10-01 Thread Tom Campbell
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.


[web2py] markmin2html, markmin2latex, markmin2pdf

2010-10-01 Thread mdipierro
I have done some cleanup in the house and moved

gluon/contrib/markmin.py
gluon/contrib/markmin2latex.py
gluon/contrib/markmin2pdf.py

into

gluon/contrib/markmin/markmin2html.py
gluon/contrib/markmin/markmin2latex.py
gluon/contrib/markmin/markmin2pdf.py

You can read about them here:

http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin.html
http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin.pdf



[web2py] Re: Need Embedded C++ developer profiles for my direct client requirement

2010-10-01 Thread mdipierro
It was a spam messages and it is now deleted

On Oct 1, 4:39 pm, Jason Brower  wrote:
> Sounds fun.  But where does web2py fit in this?
>
> On 10/01/2010 09:27 PM, Supriya from Javaji Inc. wrote:
>
>
>
> > *Send profiles to supr...@javaji.com *
>
> > * *
>
> > * Title: Embedded C++ developer*
>
> > *Location: TX*
>
> > *Duration: 6 months+*
>
> > *Description:*
>
> > To understand customer requirements
>
> > To design, develop and unit test in C++ code
>
> > To have a good practical knowledge on optical/SONET
>
> > To have a expertise on Object Oriented concepts
>
> > Working experience on Network protocols like SNMP.
>
> > --
>
> > *Thanks & Regards*
>
> > Supriya
>
> > Javaji System Solutions Inc.
>
> > supr...@javaji.com 
>
>


[web2py] [Pagination] need a bit of help

2010-10-01 Thread Andrew Evans
Hello I am trying to create some pagination for my site I am building.
However this pagination is a bit messed up, (I forget exactly where I found
it) when I click next it doesn't display anything else in the database.

Also a few other things are rather odd about it.

Does anyone have some good solid working pagination they can share with me

*cheers

Here is the code

def index():
if len(request.args):
page=int(request.args[0])
else:
page=0
items_per_page=2
limitby=(page*items_per_page,(page+1)*items_per_page + 1)
rows=db().select(db.product.ALL, orderby=db.product.product_name,
groupby=db.product.category, limitby=limitby)
return dict(rows=rows,page=page,items_per_page=items_per_page)
--


{{i = i+1}}
{{pass}}




{{if page:}}


previous

{{pass}}


{{if len(rows)>=items_per_page:}}


next
{{pass}}






Re: [web2py] Need Embedded C++ developer profiles for my direct client requirement

2010-10-01 Thread Jason Brower

Sounds fun.  But where does web2py fit in this?

On 10/01/2010 09:27 PM, Supriya from Javaji Inc. wrote:


*Send profiles to supr...@javaji.com *

* *

* Title: Embedded C++ developer*

*Location: TX*

*Duration: 6 months+*

*Description:*

To understand customer requirements

To design, develop and unit test in C++ code

To have a good practical knowledge on optical/SONET

To have a expertise on Object Oriented concepts

Working experience on Network protocols like SNMP.


--

*Thanks & Regards*

Supriya

Javaji System Solutions Inc.

supr...@javaji.com 




[web2py] Re: Select specific fields on GAE

2010-10-01 Thread Carl
I'd like to second that comment - and add patient community and lead
architect to it too!

On Oct 1, 1:47 pm, István Gazsi  wrote:
> Thanks Massimo, you're working really fast! And by the way web2py has
> the most user-friendly developers and community I have ever seen. :)


[web2py] Language is Reseted when Server is Reseted

2010-10-01 Thread yamandu
I translate my pt-br.py but everytime I start the server again it
loses the translation.
What can be wrong?


Re: [web2py] Re: login?_next= not working

2010-10-01 Thread Johann Spies
On 30 September 2010 21:46, mdipierro  wrote:
> I cannot try what is doing on. I do not have a password.

I don't understand what is going on: last night, when testing, the
login screen stayed on after the successful login.  This morning, when
I tested and another user tested it, we got redirected to index.html.
Tonight then I tested again and it worked as it is on my own computer.
 All this before I made any changes.

So you don't need to give attention to this problem any longer, thanks.

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


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
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] Re: shorting your URL with routes

2010-10-01 Thread mdipierro
routes_in = (
  ("/user/$username", "/welcome/user/view/$username"),
)

routes_out = (
  ("/welcome/user/view/$username", "/user/$username"),
)

On Oct 1, 11:48 am, Francisco Costa  wrote:
> I would like to improve my users urls by cutting the 'view' function
> out so the url would behttp://domain.com/user/username
>
> Now I have this:
>
> routes_in = (
>   ("/user/(.+)", r"/welcome/user/view/\1"),
>   ("/(.+)", r"/welcome/\1"),
> )
>
> routes_out = (
>   ("/welcome/user/view/(.+)", r"/user/\1"),
>   ("/welcome/(.+)", r"/\1"),
> )
>
> The thing is that I have more functions in the user control and they
> don't work unless I add a route for each of those functions.
>
> On Oct 1, 5:25 pm, Jonathan Lundell  wrote:
>
> > On Oct 1, 2010, at 9:20 AM, Francisco Costa wrote:
>
> > > Has I said before, that way other functions of the controller user
> > > don't work
>
> > Can you list, more or less, what you're after?
>
> > > :(
>
> > > On Oct 1, 3:10 pm, mdipierro  wrote:
> > >> yes
>
> > >> routes_in = (
> > >>   ("/user/(.+)", r"/welcome/user/view/\1"),
> > >> )
>
> > >> routes_out = (
> > >>   ("/welcome/user/view/(.+)", r"/user/\1"),
> > >> )
>
> > >> On Oct 1, 8:57 am, Francisco Costa  wrote:
>
> > >>> is it possible?
>
> > >>> On Oct 1, 10:55 am, Francisco Costa  wrote:
>
> >  Thank you for your answers, both work for me, i didn't know that the
> >  order was important.
> >  But the thing is that I have others functions in the user controller
> >  that stopped to work, unless I have a dedicated route for them.
> >  ex: /welcome/user/index is a list of all users and only works if I
> >  had
>
> >  routes_in:  ("/user/index", r"/welcome/user/index"),
> >  routes_out:   ("/welcome/user/index", r"/user/index"),
>
> >  My question is, if there is any way that you don't have to route every
> >  function, and only the view/user
>
> >  On Sep 30, 3:19 pm, Wikus van de Merwe 
> >  wrote:
>
> > > You mean this doesn't work for you?
>
> > > routes_in = (
> > >   ("/user/(.+)", r"/welcome/user/view/\1"),
> > >   ("/(.+)", r"/welcome/\1")
> > > )
>
> > > routes_out = (
> > >   ("/welcome/user/view/(.+)", r"/user/\1"),
> > >   ("/welcome/(.+)", r"/\1")
> > > )
>
>


[web2py] Re: Disable a user

2010-10-01 Thread mdipierro
use appadmin, edit the auth_user and in the field "registration_key"
write "blocked"

they will not be logged out if they are logged in but they will not be
able to login is the log out or login expires.


On Oct 1, 2:40 pm, Kenneth  wrote:
> Any ideas how to disable a user to login?
>
> I don´t want to delete users as they have done things in the system
> and I want to be able to check whos done what.
>
> Is the easiest thing to change theres passwords? But then they can
> request a new password.
>
> Kenneth


[web2py] Disable a user

2010-10-01 Thread Kenneth
Any ideas how to disable a user to login?

I don´t want to delete users as they have done things in the system
and I want to be able to check whos done what.

Is the easiest thing to change theres passwords? But then they can
request a new password.


Kenneth


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread mdipierro
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. :)
>
>


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

2010-10-01 Thread Ivan Matveev
2010/10/1 mdipierro 

> keyed tables are only partially supported. Perhaps user Denes can say
> more about that. For now here is a quick hack that should work:
>
>
Thank you for fast reply.


> db.define_table('cars',
>Field('car_id','integer'),
>Field('model_id',
> 'integer',requires=IS_IN_DB(db,'car_models.model_id','%
> (model_name)s')),
> Field('note','text'),
>primarykey=['car_id'],
>migrate=False
> )
>
>
Thats what I'm using now.  Some nice tools (like WebGrid) don't work  this
way. Maybe I'l try to fix WebGrid.


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
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] Need Embedded C++ developer profiles for my direct client requirement

2010-10-01 Thread Supriya from Javaji Inc.
*Send profiles to supr...@javaji.com*

* *

* Title: Embedded C++ developer*

*Location: TX*

*Duration: 6 months+*

*Description:*



To understand customer requirements

To design, develop and unit test in C++ code

To have a good practical knowledge on optical/SONET

To have a expertise on Object Oriented concepts

Working experience on Network protocols like SNMP.

-- 

*Thanks & Regards*

Supriya

Javaji System Solutions Inc.

supr...@javaji.com


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread mdipierro
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] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
I forgot to mention that I inserted a record into the gallery table. :)


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
Now I can insert records, but after that no new record appears in the
gallery_images table, and when I try to load the thumbnails via the
download function (with attachment=False) I get the following error:

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 2864, in retrieve
query = self.uploadfield == newfilename
NameError: global name 'newfilename' is not defined


[web2py] Re: shorting your URL with routes

2010-10-01 Thread Francisco Costa
I would like to improve my users urls by cutting the 'view' function
out so the url would be http://domain.com/user/username

Now I have this:

routes_in = (
  ("/user/(.+)", r"/welcome/user/view/\1"),
  ("/(.+)", r"/welcome/\1"),
)

routes_out = (
  ("/welcome/user/view/(.+)", r"/user/\1"),
  ("/welcome/(.+)", r"/\1"),
)

The thing is that I have more functions in the user control and they
don't work unless I add a route for each of those functions.


On Oct 1, 5:25 pm, Jonathan Lundell  wrote:
> On Oct 1, 2010, at 9:20 AM, Francisco Costa wrote:
>
>
>
> > Has I said before, that way other functions of the controller user
> > don't work
>
> Can you list, more or less, what you're after?
>
>
>
>
>
>
>
> > :(
>
> > On Oct 1, 3:10 pm, mdipierro  wrote:
> >> yes
>
> >> routes_in = (
> >>   ("/user/(.+)", r"/welcome/user/view/\1"),
> >> )
>
> >> routes_out = (
> >>   ("/welcome/user/view/(.+)", r"/user/\1"),
> >> )
>
> >> On Oct 1, 8:57 am, Francisco Costa  wrote:
>
> >>> is it possible?
>
> >>> On Oct 1, 10:55 am, Francisco Costa  wrote:
>
>  Thank you for your answers, both work for me, i didn't know that the
>  order was important.
>  But the thing is that I have others functions in the user controller
>  that stopped to work, unless I have a dedicated route for them.
>  ex: /welcome/user/index is a list of all users and only works if I
>  had
>
>  routes_in:  ("/user/index", r"/welcome/user/index"),
>  routes_out:   ("/welcome/user/index", r"/user/index"),
>
>  My question is, if there is any way that you don't have to route every
>  function, and only the view/user
>
>  On Sep 30, 3:19 pm, Wikus van de Merwe 
>  wrote:
>
> > You mean this doesn't work for you?
>
> > routes_in = (
> >   ("/user/(.+)", r"/welcome/user/view/\1"),
> >   ("/(.+)", r"/welcome/\1")
> > )
>
> > routes_out = (
> >   ("/welcome/user/view/(.+)", r"/user/\1"),
> >   ("/welcome/(.+)", r"/\1")
> > )


[web2py] Need best consultant Sr. technical project manager profile for my direct client requirement

2010-10-01 Thread Supriya from Javaji Inc.
*Please send profiles to supr...@javaji.com*

* *

*Title: Sr.Technical Project Manager *

*Location: Minneapolis, MN*

*Duration: 6 months+*

*Description:*



Should have Web Method integration exp. with project management skills with
BPM & BAM skills.



client is implementing pilot project for BPM & BAM on Web methods plat form.



 should be good in communication skills

-- 

*Thanks & Regards*

Supriya

Javaji System Solutions Inc.

supr...@javaji.com


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread mdipierro
can you please try again from trunnk

On Oct 1, 10:25 am, István Gazsi  wrote:
> Thank you!
>
> I've tested it, but when I try to insert a record to the db (on my
> machine not on GAE), get the following error:
>
> 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/appadmin.py", line 410, 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/appadmin.py", line 125, in insert
>     if form.accepts(request.vars, session):
>   File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
> sqlhtml.py", line 1103, in accepts
>     self.vars.id = self.table.insert(**fields)
> TypeError: insert() keywords must be strings
>
> Here is the relevant part of my db model:
>
> db.define_table('gallery_images',
>     Field('img_upload', 'upload' ,uploadfield='img_blob'),
>     Field('img_blob', 'blob'))
>
> db.define_table('gallery',
>     Field('category_id'),
>     Field('title'),
>     Field('title_hu'),
>     Field('thumbnail', 'upload',
> uploadfield=db.gallery_images.img_upload),
>     Field('image', 'upload'),
>     Field('posted_on', 'datetime', default=request.now))
>
> On Oct 1, 4:09 pm, mdipierro  wrote:
>
> > I have not tested it yet so perhaps you can help me.
> > In trunk
>
> > db.define_table('imagestore',
> >    Field('name','upload',uploadfield='myblob'),
> >    Field('myblob','blob'))
>
> > db.define_table('car'
> >    Field('name')
> >    Field('image','upload',uploadfield=db.imagestore.name))
>
> > notice car.image points to imagestore.name and imagestore.name points
> > to imagestore.myblob.
>
> > form=crud.create(db.car)
>
> > Should let you upload images but they all go into imagestore, not car.
> > Everything else should work out of the box. I have not tried it.
> > Please let me know what works or does not. Do not access imagestore
> > directly.
>
> > Massimo
>
> > On Oct 1, 7:44 am, mdipierro  wrote:
>
> > > It should be possible to re-write store() and retrieve() in sql.py to
> > > do this. I will look into it.
>
> > > Massimo
>
> > > On Oct 1, 7:40 am, István Gazsi  wrote:
>
> > > > Thanks for the quick reply! I have a database table which stores the
> > > > title, the thumbnail, and the full size version of an image among
> > > > other things. When I load 25 records from this table to a gallery, the
> > > > GAE loads the whole records and it consumes a lot of IO.
>
> > > > Can you recommend something about how can I store the full size image
> > > > in another table while it's still connected to the thumbnail and other
> > > > things? And I would like to upload the pictures via the default
> > > > appadmin interface.
>
>


Re: [web2py] Re: shorting your URL with routes

2010-10-01 Thread Jonathan Lundell
On Oct 1, 2010, at 9:20 AM, Francisco Costa wrote:
> 
> Has I said before, that way other functions of the controller user
> don't work

Can you list, more or less, what you're after?

> :(
> 
> 
> On Oct 1, 3:10 pm, mdipierro  wrote:
>> yes
>> 
>> routes_in = (
>>   ("/user/(.+)", r"/welcome/user/view/\1"),
>> )
>> 
>> routes_out = (
>>   ("/welcome/user/view/(.+)", r"/user/\1"),
>> )
>> 
>> On Oct 1, 8:57 am, Francisco Costa  wrote:
>> 
>>> is it possible?
>> 
>>> On Oct 1, 10:55 am, Francisco Costa  wrote:
>> 
 Thank you for your answers, both work for me, i didn't know that the
 order was important.
 But the thing is that I have others functions in the user controller
 that stopped to work, unless I have a dedicated route for them.
 ex: /welcome/user/index is a list of all users and only works if I
 had
>> 
 routes_in:  ("/user/index", r"/welcome/user/index"),
 routes_out:   ("/welcome/user/index", r"/user/index"),
>> 
 My question is, if there is any way that you don't have to route every
 function, and only the view/user
>> 
 On Sep 30, 3:19 pm, Wikus van de Merwe 
 wrote:
>> 
> You mean this doesn't work for you?
>> 
> routes_in = (
>   ("/user/(.+)", r"/welcome/user/view/\1"),
>   ("/(.+)", r"/welcome/\1")
> )
>> 
> routes_out = (
>   ("/welcome/user/view/(.+)", r"/user/\1"),
>   ("/welcome/(.+)", r"/\1")
> )
>> 
>> 




[web2py] Re: shorting your URL with routes

2010-10-01 Thread Francisco Costa
Has I said before, that way other functions of the controller user
don't work
:(


On Oct 1, 3:10 pm, mdipierro  wrote:
> yes
>
> routes_in = (
>   ("/user/(.+)", r"/welcome/user/view/\1"),
> )
>
> routes_out = (
>   ("/welcome/user/view/(.+)", r"/user/\1"),
> )
>
> On Oct 1, 8:57 am, Francisco Costa  wrote:
>
> > is it possible?
>
> > On Oct 1, 10:55 am, Francisco Costa  wrote:
>
> > > Thank you for your answers, both work for me, i didn't know that the
> > > order was important.
> > > But the thing is that I have others functions in the user controller
> > > that stopped to work, unless I have a dedicated route for them.
> > > ex: /welcome/user/index is a list of all users and only works if I
> > > had
>
> > > routes_in:  ("/user/index", r"/welcome/user/index"),
> > > routes_out:   ("/welcome/user/index", r"/user/index"),
>
> > > My question is, if there is any way that you don't have to route every
> > > function, and only the view/user
>
> > > On Sep 30, 3:19 pm, Wikus van de Merwe 
> > > wrote:
>
> > > > You mean this doesn't work for you?
>
> > > > routes_in = (
> > > >   ("/user/(.+)", r"/welcome/user/view/\1"),
> > > >   ("/(.+)", r"/welcome/\1")
> > > > )
>
> > > > routes_out = (
> > > >   ("/welcome/user/view/(.+)", r"/user/\1"),
> > > >   ("/welcome/(.+)", r"/\1")
> > > > )
>
>


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
Thank you!

I've tested it, but when I try to insert a record to the db (on my
machine not on GAE), get the following error:

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/appadmin.py", line 410, 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/appadmin.py", line 125, in insert
if form.accepts(request.vars, session):
  File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
sqlhtml.py", line 1103, in accepts
self.vars.id = self.table.insert(**fields)
TypeError: insert() keywords must be strings

Here is the relevant part of my db model:

db.define_table('gallery_images',
Field('img_upload', 'upload' ,uploadfield='img_blob'),
Field('img_blob', 'blob'))

db.define_table('gallery',
Field('category_id'),
Field('title'),
Field('title_hu'),
Field('thumbnail', 'upload',
uploadfield=db.gallery_images.img_upload),
Field('image', 'upload'),
Field('posted_on', 'datetime', default=request.now))

On Oct 1, 4:09 pm, mdipierro  wrote:
> I have not tested it yet so perhaps you can help me.
> In trunk
>
> db.define_table('imagestore',
>    Field('name','upload',uploadfield='myblob'),
>    Field('myblob','blob'))
>
> db.define_table('car'
>    Field('name')
>    Field('image','upload',uploadfield=db.imagestore.name))
>
> notice car.image points to imagestore.name and imagestore.name points
> to imagestore.myblob.
>
> form=crud.create(db.car)
>
> Should let you upload images but they all go into imagestore, not car.
> Everything else should work out of the box. I have not tried it.
> Please let me know what works or does not. Do not access imagestore
> directly.
>
> Massimo
>
> On Oct 1, 7:44 am, mdipierro  wrote:
>
>
>
>
>
>
>
> > It should be possible to re-write store() and retrieve() in sql.py to
> > do this. I will look into it.
>
> > Massimo
>
> > On Oct 1, 7:40 am, István Gazsi  wrote:
>
> > > Thanks for the quick reply! I have a database table which stores the
> > > title, the thumbnail, and the full size version of an image among
> > > other things. When I load 25 records from this table to a gallery, the
> > > GAE loads the whole records and it consumes a lot of IO.
>
> > > Can you recommend something about how can I store the full size image
> > > in another table while it's still connected to the thumbnail and other
> > > things? And I would like to upload the pictures via the default
> > > appadmin interface.


[web2py] Re: shorting your URL with routes

2010-10-01 Thread mdipierro
yes

routes_in = (
  ("/user/(.+)", r"/welcome/user/view/\1"),
)

routes_out = (
  ("/welcome/user/view/(.+)", r"/user/\1"),
)

On Oct 1, 8:57 am, Francisco Costa  wrote:
> is it possible?
>
> On Oct 1, 10:55 am, Francisco Costa  wrote:
>
> > Thank you for your answers, both work for me, i didn't know that the
> > order was important.
> > But the thing is that I have others functions in the user controller
> > that stopped to work, unless I have a dedicated route for them.
> > ex: /welcome/user/index is a list of all users and only works if I
> > had
>
> > routes_in:  ("/user/index", r"/welcome/user/index"),
> > routes_out:   ("/welcome/user/index", r"/user/index"),
>
> > My question is, if there is any way that you don't have to route every
> > function, and only the view/user
>
> > On Sep 30, 3:19 pm, Wikus van de Merwe 
> > wrote:
>
> > > You mean this doesn't work for you?
>
> > > routes_in = (
> > >   ("/user/(.+)", r"/welcome/user/view/\1"),
> > >   ("/(.+)", r"/welcome/\1")
> > > )
>
> > > routes_out = (
> > >   ("/welcome/user/view/(.+)", r"/user/\1"),
> > >   ("/welcome/(.+)", r"/\1")
> > > )
>
>


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread mdipierro
I have not tested it yet so perhaps you can help me.
In trunk

db.define_table('imagestore',
   Field('name','upload',uploadfield='myblob'),
   Field('myblob','blob'))

db.define_table('car'
   Field('name')
   Field('image','upload',uploadfield=db.imagestore.name))

notice car.image points to imagestore.name and imagestore.name points
to imagestore.myblob.

form=crud.create(db.car)

Should let you upload images but they all go into imagestore, not car.
Everything else should work out of the box. I have not tried it.
Please let me know what works or does not. Do not access imagestore
directly.

Massimo

On Oct 1, 7:44 am, mdipierro  wrote:
> It should be possible to re-write store() and retrieve() in sql.py to
> do this. I will look into it.
>
> Massimo
>
> On Oct 1, 7:40 am, István Gazsi  wrote:
>
> > Thanks for the quick reply! I have a database table which stores the
> > title, the thumbnail, and the full size version of an image among
> > other things. When I load 25 records from this table to a gallery, the
> > GAE loads the whole records and it consumes a lot of IO.
>
> > Can you recommend something about how can I store the full size image
> > in another table while it's still connected to the thumbnail and other
> > things? And I would like to upload the pictures via the default
> > appadmin interface.
>
>


[web2py] Re: Simple PDF Report in Slices

2010-10-01 Thread smg
Thank You!

On Oct 1, 3:42 pm, mdipierro  wrote:
> Meanwhile I remind you that you can do
>
> from gluon.contrib.markmin2pdf import markmin2pdf
> print markmin2pdf("""
> # title
> ## section
>
> Paragraph
>
> 
> this | is
> a    | table
> 
> """)
>
> requires latex and pdflatex installed. Supports some utf8. European
> languages are fine but not russian and chinese. Sorry.
>
> On Oct 1, 8:12 am, smg  wrote:
>
> > Hi Mariano,
>
> > I want to say thank you for  fpdf port.
>
> > > Pyfpdf should work well with accented characters (LATIN1, by PDF specs).
> > > In fact I use it in Argentina (spanish).
> > > Of course, suggestions are wellcome, and any fix will be accepted :-)
>
> > Pyfpdf add_font method is broken in 1.54b, and  I made quick dirty
> > fix  for my web2py application. Is it hard to port UTF-8 support to
> > pyfpdf?


[web2py] Re: shorting your URL with routes

2010-10-01 Thread Francisco Costa
is it possible?

On Oct 1, 10:55 am, Francisco Costa  wrote:
> Thank you for your answers, both work for me, i didn't know that the
> order was important.
> But the thing is that I have others functions in the user controller
> that stopped to work, unless I have a dedicated route for them.
> ex: /welcome/user/index is a list of all users and only works if I
> had
>
> routes_in:  ("/user/index", r"/welcome/user/index"),
> routes_out:   ("/welcome/user/index", r"/user/index"),
>
> My question is, if there is any way that you don't have to route every
> function, and only the view/user
>
> On Sep 30, 3:19 pm, Wikus van de Merwe 
> wrote:
>
> > You mean this doesn't work for you?
>
> > routes_in = (
> >   ("/user/(.+)", r"/welcome/user/view/\1"),
> >   ("/(.+)", r"/welcome/\1")
> > )
>
> > routes_out = (
> >   ("/welcome/user/view/(.+)", r"/user/\1"),
> >   ("/welcome/(.+)", r"/\1")
> > )
>
>


[web2py] Re: Simple PDF Report in Slices

2010-10-01 Thread mdipierro
Meanwhile I remind you that you can do

from gluon.contrib.markmin2pdf import markmin2pdf
print markmin2pdf("""
# title
## section

Paragraph


this | is
a| table

""")

requires latex and pdflatex installed. Supports some utf8. European
languages are fine but not russian and chinese. Sorry.



On Oct 1, 8:12 am, smg  wrote:
> Hi Mariano,
>
> I want to say thank you for  fpdf port.
>
> > Pyfpdf should work well with accented characters (LATIN1, by PDF specs).
> > In fact I use it in Argentina (spanish).
> > Of course, suggestions are wellcome, and any fix will be accepted :-)
>
> Pyfpdf add_font method is broken in 1.54b, and  I made quick dirty
> fix  for my web2py application. Is it hard to port UTF-8 support to
> pyfpdf?


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

2010-10-01 Thread mdipierro
keyed tables are only partially supported. Perhaps user Denes can say
more about that. For now here is a quick hack that should work:

db.define_table('cars',
Field('car_id','integer'),
Field('model_id',
'integer',requires=IS_IN_DB(db,'car_models.model_id','%
(model_name)s')),
Field('note','text'),
primarykey=['car_id'],
migrate=False
)



On Oct 1, 6:19 am, Ivan Matveev  wrote:
> Hello All,
> I'm trying to make a web2py interface to a legacy db(mysql).
> The db is defined like this:
>
> CREATE TABLE `car_models` (
>   `model_id` int(10) unsigned NOT NULL auto_increment,
>   `model_name` text NOT NULL,
>   PRIMARY KEY  (`model_id`)
> )
>
> CREATE TABLE `cars` (
>   `car_id` int(10) unsigned NOT NULL auto_increment,
>   `model_id` int(10) unsigned NOT NULL,
>   PRIMARY KEY  (`car_id`)
> )
>
> a model:
>
> db.define_table('car_models',
>     Field('model_id','integer'),
>     Field('model_name','string'),
>     primarykey=['model_id'],
>     migrate=False
> )
>
> db.define_table('cars',
>     Field('car_id','integer'),
>     Field('model_id','integer'),
>     Field('note','text'),
>     primarykey=['car_id'],
>     migrate=False
> )
>
> works fine in appadmin. Shows tables, inserts/edits rows.
> But if I'm trying to define a reference
>
> db.define_table('cars',
>     Field('car_id','integer'),
>     Field('model_id', db.car_models.model_id),
>     Field('note','text'),
>     primarykey=['car_id'],
>     migrate=False
> )
>
> I get this error:
>
> Error traceback
>
> Traceback (most recent call last):
>   File "/home/ivm/prg/web2py/gluon/restricted.py", line 186, in
> restricted
>     exec ccode in environment
>   File "/home/ivm/prg/web2py/applications/monicar_db_test/controllers/
> appadmin.py", line 410, in ?
>   File "/home/ivm/prg/web2py/gluon/globals.py", line 96, in 
>     self._caller = lambda f: f()
>   File "/home/ivm/prg/web2py/applications/monicar_db_test/controllers/
> appadmin.py", line 124, in insert
>     form = SQLFORM(db[table], ignore_rw=ignore_rw)
>   File "/home/ivm/prg/web2py/gluon/sqlhtml.py", line 668, in __init__
>     if field.type == 'id':
>   File "/home/ivm/prg/web2py/gluon/sql.py", line 2551, in __eq__
>     return Query(self, '=', value)
>   File "/home/ivm/prg/web2py/gluon/sql.py", line 2993, in __init__
>     right = sql_represent(right, left.type, left._db._dbname,
> left._db._db_codec)
>   File "/home/ivm/prg/web2py/gluon/sql.py", line 555, in sql_represent
>     return str(int(obj))
> ValueError: invalid literal for int(): id
>
> Looks like DAL wants me to refere to a field of type 'id'
>
> but if I change 'model_id' field type to id
>
> db.define_table('car_models',
>     Field('model_id','id'),
>     Field('model_name','string'),
>     primarykey=['model_id'],
>     migrate=False
> )
>
> appadmin shows 'car_models' but doesn't let me edit  rows
> and shows empty 'cars' table(its not empty )
>
> web2py 1.83.2
> python2.4


[web2py] Re: GAE address

2010-10-01 Thread Rick
Thanks for the link and the answer. Now I've figured out what I
exactly try to ask: How to make the "root site" 127.0.0.1:8080
redirect to 127.0.0.1:8080/myapp/views/default/index instead of
127.0.0.1:8080/myapp/welcome/default/index ?



On Sep 30, 8:20 pm, mdipierro  wrote:
> This is what I do:
>
> - I run web2py.py using 127.0.0.1:8000
> - I test in dev_appserver on 127.0.0.1:8080
>
> On port 8000 admin works and I can deploy apps locally. They will then
> be visible on port 8080 too.
> After I test that everything works I deply using the AppEngineLauncher
> or appcfg.py
>
> This may also help:
>
> http://gluonframework.wordpress.com/2010/03/02/shell-only-web2py/
>
> Massimo
>
> On Sep 30, 12:06 pm, Rick  wrote:
>
> > But how to upload it in my local copy? I understand that I'd somehow
> > get the app on the address  http://127.0.0.1:8000butI don't
> > understand how to get it there. It has still the 
> > address:http://127.0.0.1:8000/myapp
> > I'm running linux. Perhaps that has an impact on the procedure?
>
> > On Sep 28, 5:46 pm, mdipierro  wrote:
>
> > > You have to upload it in your local copy and then doply it again.
>
> > > On Sep 28, 11:20 am, Rick  wrote:
>
> > > > Hi,
>
> > > > When I upload my app with GAE the address will be myapp.appspot.com/
> > > > myapp . On the site myapp.appspot.com there is the administrative
> > > > interface that doesn't work with GAE. My question is: how to put my
> > > > app on myapp.appspot.com ?
>
> > > > Thanks in advance for help!
>
>


[web2py] Re: Simple PDF Report in Slices

2010-10-01 Thread smg
Hi Mariano,

I want to say thank you for  fpdf port.

> Pyfpdf should work well with accented characters (LATIN1, by PDF specs).
> In fact I use it in Argentina (spanish).

> Of course, suggestions are wellcome, and any fix will be accepted :-)

Pyfpdf add_font method is broken in 1.54b, and  I made quick dirty
fix  for my web2py application. Is it hard to port UTF-8 support to
pyfpdf?



[web2py] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
Thanks Massimo, you're working really fast! And by the way web2py has
the most user-friendly developers and community I have ever seen. :)


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread mdipierro
It should be possible to re-write store() and retrieve() in sql.py to
do this. I will look into it.

Massimo

On Oct 1, 7:40 am, István Gazsi  wrote:
> Thanks for the quick reply! I have a database table which stores the
> title, the thumbnail, and the full size version of an image among
> other things. When I load 25 records from this table to a gallery, the
> GAE loads the whole records and it consumes a lot of IO.
>
> Can you recommend something about how can I store the full size image
> in another table while it's still connected to the thumbnail and other
> things? And I would like to upload the pictures via the default
> appadmin interface.


[web2py] Re: Select specific fields on GAE

2010-10-01 Thread István Gazsi
Thanks for the quick reply! I have a database table which stores the
title, the thumbnail, and the full size version of an image among
other things. When I load 25 records from this table to a gallery, the
GAE loads the whole records and it consumes a lot of IO.

Can you recommend something about how can I store the full size image
in another table while it's still connected to the thumbnail and other
things? And I would like to upload the pictures via the default
appadmin interface.


[web2py] DAL, legacy keyed table, field references

2010-10-01 Thread Ivan Matveev
Hello All,
I'm trying to make a web2py interface to a legacy db(mysql).
The db is defined like this:

CREATE TABLE `car_models` (
  `model_id` int(10) unsigned NOT NULL auto_increment,
  `model_name` text NOT NULL,
  PRIMARY KEY  (`model_id`)
)

CREATE TABLE `cars` (
  `car_id` int(10) unsigned NOT NULL auto_increment,
  `model_id` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`car_id`)
)

a model:

db.define_table('car_models',
Field('model_id','integer'),
Field('model_name','string'),
primarykey=['model_id'],
migrate=False
)

db.define_table('cars',
Field('car_id','integer'),
Field('model_id','integer'),
Field('note','text'),
primarykey=['car_id'],
migrate=False
)

works fine in appadmin. Shows tables, inserts/edits rows.
But if I'm trying to define a reference

db.define_table('cars',
Field('car_id','integer'),
Field('model_id', db.car_models.model_id),
Field('note','text'),
primarykey=['car_id'],
migrate=False
)

I get this error:

Error traceback

Traceback (most recent call last):
  File "/home/ivm/prg/web2py/gluon/restricted.py", line 186, in
restricted
exec ccode in environment
  File "/home/ivm/prg/web2py/applications/monicar_db_test/controllers/
appadmin.py", line 410, in ?
  File "/home/ivm/prg/web2py/gluon/globals.py", line 96, in 
self._caller = lambda f: f()
  File "/home/ivm/prg/web2py/applications/monicar_db_test/controllers/
appadmin.py", line 124, in insert
form = SQLFORM(db[table], ignore_rw=ignore_rw)
  File "/home/ivm/prg/web2py/gluon/sqlhtml.py", line 668, in __init__
if field.type == 'id':
  File "/home/ivm/prg/web2py/gluon/sql.py", line 2551, in __eq__
return Query(self, '=', value)
  File "/home/ivm/prg/web2py/gluon/sql.py", line 2993, in __init__
right = sql_represent(right, left.type, left._db._dbname,
left._db._db_codec)
  File "/home/ivm/prg/web2py/gluon/sql.py", line 555, in sql_represent
return str(int(obj))
ValueError: invalid literal for int(): id

Looks like DAL wants me to refere to a field of type 'id'

but if I change 'model_id' field type to id

db.define_table('car_models',
Field('model_id','id'),
Field('model_name','string'),
primarykey=['model_id'],
migrate=False
)

appadmin shows 'car_models' but doesn't let me edit  rows
and shows empty 'cars' table(its not empty )

web2py 1.83.2
python2.4


[web2py] Re: shorting your URL with routes

2010-10-01 Thread Francisco Costa
Thank you for your answers, both work for me, i didn't know that the
order was important.
But the thing is that I have others functions in the user controller
that stopped to work, unless I have a dedicated route for them.
ex: /welcome/user/index is a list of all users and only works if I
had

routes_in:  ("/user/index", r"/welcome/user/index"),
routes_out:   ("/welcome/user/index", r"/user/index"),

My question is, if there is any way that you don't have to route every
function, and only the view/user

On Sep 30, 3:19 pm, Wikus van de Merwe 
wrote:
> You mean this doesn't work for you?
>
> routes_in = (
>   ("/user/(.+)", r"/welcome/user/view/\1"),
>   ("/(.+)", r"/welcome/\1")
> )
>
> routes_out = (
>   ("/welcome/user/view/(.+)", r"/user/\1"),
>   ("/welcome/(.+)", r"/\1")
> )


[web2py] Re: insert/update multiple record in one form [CLOSED]

2010-10-01 Thread David Marko
How did you solve it?

David

On 1 říj, 08:15, annet  wrote:
> On Sep 29, 10:16 am, annet  wrote:
>
>
>
>
>
>
>
> > I have a table in which users can insert/update css declarations to
> > customize a page's styling. Some sample records:
>
> > declaration_id                    1
> > declaration.company_id     263
> > declaration_selector           body
> > declaration_property           background-color
> > declaration.value                 #C0D785
>
> > declaration_id                    1
> > declaration.company_id     263
> > declaration.selector           body
> > declaration.property           color
> > declaration.value                 #008AC9
>
> > declaration_id                    1
> > declaration.company_id     263
> > declaration.selector           body
> > declaration.property           font-family
> > declaration.value                Verdana,Geneva,Arial,Helvetica,Sans-
> > Serif
>
> > declaration_id                    1
> > declaration.company_id     263
> > declaration.selector           #header
> > declaration.property           background-color
> > declaration.value                 #C0D785
>
> > declaration_id                    1
> > declaration.company_id     263
> > declaration.selector           #header
> > declaration.property           color
> > declaration.value                #0088C7
>
> > In the cms I would like the user to be able to insert/update the
> > declarations per selector (resulting in forms with one, two or three
> > fields). From what I understand crud.create and crud.update don't
> > support this kind of behaviour. I thought of building a custom form
> > using SQLFORM.factory, however, I have no idea of how to pre-populate
> > the fields in case of updates. I hope one of you does.
>
> > Furthermore, I hope one of you could provide me with a simpler
> > solutions.
>
> > Kind regards,
>
> > Annet.