Re: [web2py] Re: The web2py version

2012-02-12 Thread Bruce Wade
Hi Massimo,

The problem is fixed in the nightly build. The problem was caused from
using:
if not translate(self.error_messages):

instead of:

if not self.error_messages: Changing to this in the stable branch also
fixes the issue.

On Sat, Feb 11, 2012 at 10:37 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you attempt a patch? Else I can do it, but open a ticket first.
> Thanks.
>
> On Feb 11, 10:51 pm, Bruce Wade  wrote:
> > See attached welcome application.
> >
> > Downloaded fresh current stable source code from web2py, started server
> > created a register action at the top of default.py controller.
> >
> > I just used the generic view, and added some of what I had from the live
> > sites form. When entering a password such as 1 the error returned is
> > None
> >
> > --
> > Regards,
> > Bruce
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sat, Feb 11, 2012 at 2:15 PM, Anthony  wrote:
> > > On Saturday, February 11, 2012 4:35:25 PM UTC-5, Detectedstealth wrote:
> >
> > >> Ok just got back this is the code I am using for both password and
> > >> security password (with name changed only)
> >
> > >>  LABEL(SPAN(T('Password'), _title=T("Choose a safe password")),
> > >>   INPUT(_name='password', requires=[IS_STRONG(),
> CRYPT(),
> > >> IS_NOT_EMPTY(error_message=T('**Enter password'))], _type="password"),
> > >>   _class="left clearfix", _for="password")
> >
> > > Hmm, the problem must be elsewhere -- if I wrap that in a FORM() and
> > > submit and validate with a weak password, the form still correctly
> displays
> > > the full error message. Maybe you can show the minimal complete
> controller
> > > and view code that will reproduce the problem in a clean "welcome" app.
> >
> > > Anthony
> >
> > --
> > --
> > Regards,
> > Bruce Wadehttp://
> ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com
> >
> >  welcome.tar.gz
> > 166KViewDownload




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Dedicated IDE

2012-02-12 Thread Bruce Wade
Thank's for the link Massimo.

Bruno, I guess every developer is different. I would like to see tools that
make it easier to generate interfaces/views, a more visual way of creating
database design that maps to DAL etc

On Sat, Feb 11, 2012 at 10:42 PM, Bruno Rocha  wrote:

> I am working exclusively with web2py, over 2 years (8-24 hours a day *7)
> plus holydays. And I never used an IDE. I use Sublime-text-2 and VIM, I
> have Python code completion and I have set some web2py completions for
> common code snippets both in VIM and Sublime-text.
>
> But, If I wanted or needed to use an IDE, I would use WingIDE. WingIDE
> works perfectly with web2py!
>
> On Sun, Feb 12, 2012 at 4:09 AM, Bruce Wade  wrote:
>
>> Hi,
>>
>> I have been using web2py for a little over 2 months (8-12 hours a day *
>> 7) now. It might not seem like a long time, however because of the scope of
>> projects I am working on I have had to learn a lot.
>>
>> One of the situations I found as projects grow in size, although the web
>> based IDE is great and very powerful I find it slows down my productivity
>> greatly when going back and forth between controllers etc.. or having
>> multiple browser tabs open.
>>
>> After awhile I decided to move back to eclipse to handle my programming
>> needs. However I noticed because of how web2py is designed with lots of
>> global's going on eclipse code completion is pretty much useless. (Correct
>> me if I am wrong and someone was able to get code completion with web2py to
>> work).
>>
>> Would anyone be interested in making a dedicated standalone IDE for
>> web2py?
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Dedicated IDE

2012-02-12 Thread Mariano Reingart
Bruce:

As you could have seen from the link that sent Massimo (rad2py,
ide2py, psp2py, etc.), I'm finishing a fully-featured IDE, including
coding completion, local and remote debugger, integrated shell, etc.
The web2py dedication is complete, currently the tool can be attached
to a web2py server (using admin-like webservices), browse and edit
files, debug, etc.
Code completion currently is static (similar to what you will find in
eclipse or other IDEs), but shortly it will be dynamically generated,
so you would be able to explore database tables and fields live as you
write, evaluate dal expressions on the fly, etc.

The tools also includes quality assurance and project management
features (defect & time tracking, estimation, performance reports,
etc.)

I hope to release a stable version very soon, you can see the poster
I'll be presenting at PyCon about this for further information:

https://us.pycon.org/2012/schedule/presentation/147/

About a better view editor, it is in my plans to add a custom style to
the editor to correctly highlight the html code, check for errors,
etc.
Also, In the long time I would like to implement a visual database
designer, query-by-example, etc
BTW, a visual DAL designer already exists (web accesible from the admin) IIRC

PS: the admin-like web services would enable to build third-party
plugins for your favourite IDE

Best regards

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



On Sun, Feb 12, 2012 at 5:41 AM, Bruce Wade  wrote:
> Thank's for the link Massimo.
>
> Bruno, I guess every developer is different. I would like to see tools that
> make it easier to generate interfaces/views, a more visual way of creating
> database design that maps to DAL etc
>
>
> On Sat, Feb 11, 2012 at 10:42 PM, Bruno Rocha  wrote:
>>
>> I am working exclusively with web2py, over 2 years (8-24 hours a day *7)
>> plus holydays. And I never used an IDE. I use Sublime-text-2 and VIM, I have
>> Python code completion and I have set some web2py completions for common
>> code snippets both in VIM and Sublime-text.
>>
>> But, If I wanted or needed to use an IDE, I would use WingIDE. WingIDE
>> works perfectly with web2py!
>>
>> On Sun, Feb 12, 2012 at 4:09 AM, Bruce Wade  wrote:
>>>
>>> Hi,
>>>
>>> I have been using web2py for a little over 2 months (8-12 hours a day *
>>> 7) now. It might not seem like a long time, however because of the scope of
>>> projects I am working on I have had to learn a lot.
>>>
>>> One of the situations I found as projects grow in size, although the web
>>> based IDE is great and very powerful I find it slows down my productivity
>>> greatly when going back and forth between controllers etc.. or having
>>> multiple browser tabs open.
>>>
>>> After awhile I decided to move back to eclipse to handle my programming
>>> needs. However I noticed because of how web2py is designed with lots of
>>> global's going on eclipse code completion is pretty much useless. (Correct
>>> me if I am wrong and someone was able to get code completion with web2py to
>>> work).
>>>
>>> Would anyone be interested in making a dedicated standalone IDE for
>>> web2py?
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.warplydesigned.com
>>> http://www.fitnessfriendsfinder.com
>>
>>
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com


Re: [web2py] Dedicated IDE

2012-02-12 Thread Marin Pranjić
+1 for Wing, it is great

On Sun, Feb 12, 2012 at 7:42 AM, Bruno Rocha  wrote:

> I am working exclusively with web2py, over 2 years (8-24 hours a day *7)
> plus holydays. And I never used an IDE. I use Sublime-text-2 and VIM, I
> have Python code completion and I have set some web2py completions for
> common code snippets both in VIM and Sublime-text.
>
> But, If I wanted or needed to use an IDE, I would use WingIDE. WingIDE
> works perfectly with web2py!
>
> On Sun, Feb 12, 2012 at 4:09 AM, Bruce Wade  wrote:
>
>> Hi,
>>
>> I have been using web2py for a little over 2 months (8-12 hours a day *
>> 7) now. It might not seem like a long time, however because of the scope of
>> projects I am working on I have had to learn a lot.
>>
>> One of the situations I found as projects grow in size, although the web
>> based IDE is great and very powerful I find it slows down my productivity
>> greatly when going back and forth between controllers etc.. or having
>> multiple browser tabs open.
>>
>> After awhile I decided to move back to eclipse to handle my programming
>> needs. However I noticed because of how web2py is designed with lots of
>> global's going on eclipse code completion is pretty much useless. (Correct
>> me if I am wrong and someone was able to get code completion with web2py to
>> work).
>>
>> Would anyone be interested in making a dedicated standalone IDE for
>> web2py?
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


[web2py] Re: How to change menu colors?

2012-02-12 Thread Edward Shave
Thanks for that...  Also had to make changes to topbar in order to get 
color across the whole screen.

[web2py] accessing admin via ssh fails with:- "admin disabled because unable to access password file"

2012-02-12 Thread Edward Shave
Hi, despite being a total novice with little or no experience beyond 
windows I have managed to install web2py on a webfaction shared server. By 
substituting my webfaction application listening port into the 
 instructions I found here... 
http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-tunnel-with-putty
   I 
can connect to my web2py application over SSH. Problem is when I try to 
access admin I get " admin disabled because unable to access password 
file". 

I found a lot of references to this error when searching the group but no 
real answer. There was some talk of admin using port 80 maybe when looking 
for the password? Another suggestion was that I should have two instances 
of web2py running on the server but I think that's only necessary if admin 
has been disabled, which in my case I don't think it has. Either way I 
don't know how to go about fixing it.

Here you can find the web2py install script I used...  
http://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi

One last question... Is there any need to access admin on the server? I'm 
wondering if I can just make changes localy then upload the changes via ftp?


[web2py] invalid literal for int() with base 10: '%s%id'

2012-02-12 Thread Praveen Bhat
Hello,

I am getting the following error:

 invalid literal for int() with base 10: 
'%s%id'

and the code in my controller is:

def show():
redirect(URL(c='articles',f='show?id=%s%id'))

which redirects to the following function in articles controller:

def show():
id=request.vars.id
articles=db(db.article.id==id).select()
if not len(articles): redirect(URL('articles'))
return dict(article=articles[0])

Could someone help me out?

Regards
Praveen




Re: [web2py] accessing admin via ssh fails with:- "admin disabled because unable to access password file"

2012-02-12 Thread Mariano Reingart
The admin is not mandatory, you can upload your chages via FTP.

Also, you can create a password file (parameters_.py, replace xxx
with the port number) just running web2py in your local machine, and
then upload it too your server (copy it to the folder where web2py.py
resides).

Best regards,

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



On Sun, Feb 12, 2012 at 7:57 AM, Edward Shave
 wrote:
> Hi, despite being a total novice with little or no experience beyond windows
> I have managed to install web2py on a webfaction shared server. By
> substituting my webfaction application listening port into the  instructions
> I found here...
> http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-tunnel-with-putty   I
> can connect to my web2py application over SSH. Problem is when I try to
> access admin I get " admin disabled because unable to access password
> file".
>
> I found a lot of references to this error when searching the group but no
> real answer. There was some talk of admin using port 80 maybe when looking
> for the password? Another suggestion was that I should have two instances of
> web2py running on the server but I think that's only necessary if admin has
> been disabled, which in my case I don't think it has. Either way I don't
> know how to go about fixing it.
>
> Here you can find the web2py install script I used...
>  http://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi
>
> One last question... Is there any need to access admin on the server? I'm
> wondering if I can just make changes localy then upload the changes via ftp?


[web2py] How to success myapp example from web2py official book

2012-02-12 Thread codingstar
Dear web2py users!
I am study on web2py.
I have a problem.

I try to apply web2py example on official book ( 
http://web2py.com/books/default/chapter/29/3
)

# example
##
Write the corresponding actions in the default controller:

def first():
return dict()

def second():
return dict()


Then create a view "default/first.html" for the first action, and
enter:


{{extend 'layout.html'}}
What is your name?

  
  

Finally, create a view "default/second.html" for the second action:

{{extend 'layout.html'}}
Hello {{=request.vars.visitor_name}}


#

However, I got a different result on  my browser.

( 
http://web2py.com/books/static/books/29/document.source.bbc0fb2590824e23.656e313530302e706e67.png
)

I have a no submission form on my browser, no input-box too.

my case : http://codingstar.net/mycase.png

Why it happens?

Please tell me about that..


*. My working environment
- OS : win7 64bit
- python : 2.7.2
- web2py : 1.99.4
- browser : chrome 16.0.912.77 m


[web2py] common row for multiple fildes names

2012-02-12 Thread Td CtrlSoft

in model:

db.define_table("news",
Field("title_en",requires=IS_NOT_EMPTY()),
Field("conten_en" ,type='text'),

Field("title_fr",requires=IS_NOT_EMPTY()),
Field("conten_fr" ,type='text'),

Field("title_de",requires=IS_NOT_EMPTY()),
Field("conten_de" ,type='text'),
#
Field('added_on', 'datetime', default=request.now, 
requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S'))),
Field('updated_on', 'datetime', default=request.now, 
update=request.now, requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S'

in controller:

if lang == 'de':
news = [db.news.title_de, db.news.conten_de]
elif lang == 'fr': 
news = [db.news.title_fr, db.news.conten_fr]
else:
news = [db.news.title_en, db.news.conten_en] 
 
rows = db(db.news).select(*news)
   #
return dict(row=rows)

in view:
here i need a common row something like 
{{=row.title}}
{{=row.content}}

so how can i create a common row object for different filds names? thx


[web2py] Re: invalid literal for int() with base 10: '%s%id'

2012-02-12 Thread Alan Etkin
The string interpolation here:

redirect(URL(c='articles',f='show?id=%s%id'))

is not being performed, so the controller gets ...%s%id as raw string,
and the id argument should evaluate to an integer to return a db
record. So i think that the part of the code that has to replace the
string in the f parameter is missing or is prevented to run by other
instruction.

Instead, this should work:

redirect(URL(c='articles',f='show?id=%s' % myid))

where the expression int(myid) evaluates to an int object

On 12 feb, 08:04, Praveen Bhat  wrote:
> Hello,
>
> I am getting the following error:
>
>  invalid literal for int() with base 10:
> '%s%id'
>
> and the code in my controller is:
>
> def show():
> redirect(URL(c='articles',f='show?id=%s%id'))
>
> which redirects to the following function in articles controller:
>
> def show():
> id=request.vars.id
> articles=db(db.article.id==id).select()
> if not len(articles): redirect(URL('articles'))
> return dict(article=articles[0])
>
> Could someone help me out?
>
> Regards
> Praveen


[web2py] Re: Dedicated IDE

2012-02-12 Thread Alan Etkin
I don't use IDEs for web2py, as I am very comfortable with the built-
in web2py interface. I'd prefer to use an open source web2py oriented
development environment rather than wingide for this two reasons.:

-I cannot afford it ($245 per license)
-I think it is not (completely) open source as far as understood by
seeing the source dowload agreement.

On 12 feb, 06:20, Marin Pranjić  wrote:
> +1 for Wing, it is great
>
>
>
>
>
>
>
> On Sun, Feb 12, 2012 at 7:42 AM, Bruno Rocha  wrote:
> > I am working exclusively with web2py, over 2 years (8-24 hours a day *7)
> > plus holydays. And I never used an IDE. I use Sublime-text-2 and VIM, I
> > have Python code completion and I have set some web2py completions for
> > common code snippets both in VIM and Sublime-text.
>
> > But, If I wanted or needed to use an IDE, I would use WingIDE. WingIDE
> > works perfectly with web2py!
>
> > On Sun, Feb 12, 2012 at 4:09 AM, Bruce Wade  wrote:
>
> >> Hi,
>
> >> I have been using web2py for a little over 2 months (8-12 hours a day *
> >> 7) now. It might not seem like a long time, however because of the scope of
> >> projects I am working on I have had to learn a lot.
>
> >> One of the situations I found as projects grow in size, although the web
> >> based IDE is great and very powerful I find it slows down my productivity
> >> greatly when going back and forth between controllers etc.. or having
> >> multiple browser tabs open.
>
> >> After awhile I decided to move back to eclipse to handle my programming
> >> needs. However I noticed because of how web2py is designed with lots of
> >> global's going on eclipse code completion is pretty much useless. (Correct
> >> me if I am wrong and someone was able to get code completion with web2py to
> >> work).
>
> >> Would anyone be interested in making a dedicated standalone IDE for
> >> web2py?
>
> >> --
> >> --
> >> Regards,
> >> Bruce Wade
> >>http://ca.linkedin.com/in/brucelwade
> >>http://www.wadecybertech.com
> >>http://www.warplydesigned.com
> >>http://www.fitnessfriendsfinder.com
>
> > --
>
> > Bruno Rocha
> > [http://rochacbruno.com.br]


Re: [web2py] accessing admin via ssh fails with:- "admin disabled because unable to access password file"

2012-02-12 Thread Edward Shave
What you say is very interesting as it caused me to go back to the 
installation script which contains the following line...

python -c "from gluon.main import save_password; 
save_password('${web2py_password}',443)"

I have no idea where the 443 comes from, but when I renamed the file using 
my port number... viola it worked..!

Many, many thanks for your help
Kind regards
Ed


[web2py] Re: How to success myapp example from web2py official book

2012-02-12 Thread Alan Etkin
I have tried the example with the last mercurial version and it works
well.

By seeing the output screenshot it seems like (maybe) you have not
created the corresponding view in the correct path:

For web2py to use the view, it should be placed here:
[application path]/views/default/first.html

Also, you can set a specific view location with the response.view
parameter that takes a url (to be placed at the controller or model
section), although that is not the usual way of linking views to
controllers

On 12 feb, 04:12, codingstar  wrote:
> Dear web2py users!
> I am study on web2py.
> I have a problem.
>
> I try to apply web2py example on official book 
> (http://web2py.com/books/default/chapter/29/3
> )
>
> # example
> ##
> Write the corresponding actions in the default controller:
>
> def first():
>     return dict()
>
> def second():
>     return dict()
>
> Then create a view "default/first.html" for the first action, and
> enter:
>
> {{extend 'layout.html'}}
> What is your name?
> 
>   
>   
> 
> Finally, create a view "default/second.html" for the second action:
>
> {{extend 'layout.html'}}
> Hello {{=request.vars.visitor_name}}
>
> #
>
> However, I got a different result on  my browser.
>
> (http://web2py.com/books/static/books/29/document.source.bbc0fb2590824...
> )
>
> I have a no submission form on my browser, no input-box too.
>
> my case :http://codingstar.net/mycase.png
>
> Why it happens?
>
> Please tell me about that..
>
> *. My working environment
> - OS : win7 64bit
> - python : 2.7.2
> - web2py : 1.99.4
> - browser : chrome 16.0.912.77 m


Re: [web2py] Dedicated IDE

2012-02-12 Thread Ross Peoples
I have been following ide/rad2py for a little while now. I am really 
looking forward to trying this out and I appreciate all the work you have 
put into it Mariano!

Depending on the type of project, I will use either TextMate or Komodo 
Edit. For larger projects, I use Komodo for the code completion and 
organization. I also use SourceTree for source code management. I tried 
Eclipse + PyDev / Aptana, but it seems way too heavy and doesn't really 
really offer much more than I have already. I didn't play with it too long, 
as it reminded me of Java development too much, so I could be wrong and 
could totally be missing out.

I am looking forward to playing with ide/rad2py to see if it can unseat 
Komodo as my IDE of choice.


[web2py] Re: common row for multiple fildes names

2012-02-12 Thread Alan Etkin
I would use virtual fields to create the required fields based on the
client language.
I you have not yet, you could check the info in the web2py book: from
section 6.20.1

On the other hand I'd consider using the web2py internationalization
features to translate every input from english.

On 12 feb, 09:41, Td CtrlSoft  wrote:
> in model:
>
> db.define_table("news",
>     Field("title_en",requires=IS_NOT_EMPTY()),
>     Field("conten_en" ,type='text'),
>
>     Field("title_fr",requires=IS_NOT_EMPTY()),
>     Field("conten_fr" ,type='text'),
>
>     Field("title_de",requires=IS_NOT_EMPTY()),
>     Field("conten_de" ,type='text'),
>     #
>     Field('added_on', 'datetime', default=request.now,
> requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S'))),
>     Field('updated_on', 'datetime', default=request.now,
> update=request.now, requires=IS_DATETIME(format=T('%d-%m-%Y %H:%M:%S'
>
> in controller:
>
>     if lang == 'de':
>         news = [db.news.title_de, db.news.conten_de]
>     elif lang == 'fr':
>         news = [db.news.title_fr, db.news.conten_fr]
>     else:
>         news = [db.news.title_en, db.news.conten_en]
>
>     rows = db(db.news).select(*news)
>    #
>     return dict(row=rows)
>
> in view:
> here i need a common row something like
> {{=row.title}}
> {{=row.content}}
>
> so how can i create a common row object for different filds names? thx


[web2py] Re: invalid literal for int() with base 10: '%s%id'

2012-02-12 Thread Praveen Bhat
Hello,

Thank you as it worked for me.

I did this:
  
def show():
myid =request.vars.id
redirect(URL(c='articles',f='show?id=%s' % myid))


Regards
Praveen


[web2py] Re: Markmin Output Questions

2012-02-12 Thread Alan Etkin
-I'd prefer separated files for large documents (but does MARKMIN
support it?)
-I don't see page break options in the docs. CSS seems to support page
breaks, but I don't think that MARKMIN accepts style sheets so far.
I'm affraid you will have to explore this:

http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py
http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py
http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py

On 11 feb, 17:30, Ross Peoples  wrote:
> Anyone have any thoughts on this?


[web2py] validators.py error in

2012-02-12 Thread Alan Etkin
I have pulled the last mercurial version and get this new exception in
a query. This behavior is new, older versions of web2py don't return
this error:

Note: the app is a wxPython application that queries a PostgreSQL
database with web2py and gui2py:
http://code.google.com/p/gestionlibre.gui


  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
options
self.options() #
  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
options
self.options() #
  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
options
self.options() #
  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
options
self.options() #
  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
options
self.options() #
  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 463, in
options
self.build_set()
  File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 451, in
build_set
records = self.dbset.select(*fields, **dd)
  File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 7379, in
select
return adapter.select(self.query,fields,attributes)
  File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1301, in
select
sql = self._select(query, fields, attributes)
  File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
_select
sql_t = ', '.join(alias(t) for t in tablenames)
  File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in

sql_t = ', '.join(alias(t) for t in tablenames)
RuntimeError: maximum recursion depth exceeded while calling a Python
object

Here is a part of the model wich I suppose is relevant

# Source Document (transactions records)
db.define_table('operation',
Field('operation_id', 'id', label = T("id")),
Field('code', unique = True, label = T("code")),
Field('description', label = T("description")),
Field('customer_id', 'reference customer', label =
T("customer")), # reference
Field('supplier_id', 'reference supplier', label =
T("supplier")), # reference
Field('detail', type='string', length=60,
comment=T('Observations'), label = T("detail")),
Field('payment_terms_id', 'reference payment_terms',
comment=T('Terms of payment'), label = T("payment terms")), #
reference
Field('term', type='string', length=50, label = T("term")),
Field('amount', type='double', label = T("amount")),
Field('balance', type='double', label = T("balance")),
Field('posted', type='datetime', default = now, label =
T("posted")),
Field('issue', type='datetime', label = T("issue")),
Field('document_id', 'reference document', comment=T('Points
to order / invoice / packingslips'), label = T("document")), #
reference
Field('branch', label = T("branch")),
Field('number', type='integer', default=0, label =
T("number")),
Field('due_date', type='datetime', label = T("due date")),
Field('type', type='string', length=1,
requires=IS_IN_SET({'T': 'Stock','S': 'Sales','P': 'Purchases'}),
label = T("type")), # reference? types: T: Stock, S: Sales, P:
Purchases
Field('canceled', type='boolean', default=False,
comment=T('False if deferred payment (df), True if paid with cash, ch
(check) or current account'), label = T("canceled")),
Field('processed', type='boolean', default=False, label =
T("processed")),
Field('voided', type='boolean', default=False, label =
T("voided")), # ¿anulado?
Field('fund_id', 'reference fund', label = T("fund")), #
reference
Field('cost_center_id', 'reference cost_center', label =
T("cost center")), # reference
Field('module', type='integer', default=0,
comment=T('Referenced table'), label = T("module")), # reference?
Field('observations', type='string', length=50, label =
T("observations")),
Field('cancellation', type='boolean', default=False, label =
T("cancellation")),
Field('avoidance', type='boolean', default=False, label =
T("avoidance")), # ¿anulación?
Field('file_id', 'reference file', label = T("file")), #
¿legajo? # reference
Field('payroll_id', 'reference payroll', label =
T("payroll")), # reference
Field('user_id', 'reference auth_user', label = T("user")), #
reference
Field('hour', type='datetime', label = T("hour")),
Field('replicated', type='datetime', label = T("replicated")),
Field('subcustomer_id', 'reference subcustomer', label =
T("subcustomer")), # reference
Field('salesperson_id', 'reference salesperson', label =
T("salesperson")), # reference
Field('printed', type='boolean', default=False, label =
T("printed")),
Field('jurisdiction_id', 'reference jurisdiction', label =
T("jurisdiction")), # reference
Field('replica', type='boolean', default=False, label =
T("replica")),
format=operation_format,
sequence_name = "operation_operation_id_Seq",
migrate=migra

[web2py] Re: cPickle instead of return dict(D=D) in serverside ajax function: accessing it in View

2012-02-12 Thread Vineet
I see.
That means neither cPickle nor session can be used.

A workaround can be like this--
Keep the dataset stored in session.
On client-side, after hitting the save button, collect the values of
elements in JSON array format.
I can't use request.vars.elmt, because I require to pass the class
values also (of html elements) to the ajax controller.
(These class values are set/altered after user-interaction.)
web2py's ajax function can't pass JSON array to controller.

Can you pl. tell how to pass JSON array to controller via ajax?
(maybe $.ajax ?)

Thanks,

Vineet

On Feb 11, 10:28 pm, Anthony  wrote:
> > 3) User interacts with HTML elements & changes the data.
>
> > 4) Dynamically, the dataset is altered after user-interaction with
> > HTML elements.
>
> In that case, this part of your view won't work:
>
> {{for i in newD:}}
> ...processing statements...
> {{pass}}
> {{cPickle.dump(newD, open( "my_pkcl.p", "wb" ) )}}
>
> Anything done in the web2py template language has to happen on the server
> (before sending the page to the browser), not in the client. cPickle.dump
> cannot be called from the browser -- that is strictly a server-side
> operation. Anything that happens on the client side has to be done via
> Javascript (and/or a standard form submission).
>
> > 5) After hitting 'Save' button, the dataset is passed to controller
> > function for handling add/update/delete on related DB tables.
>
> This sounds fine. It's not clear you need to store the data in the session
> at all. It sounds like you can just load the data in the view, let the user
> make and submit changes, and then simply update the db with those changes.
>
> Anthony


Re: [web2py] Dedicated IDE

2012-02-12 Thread Bruce Wade
Hi  Mariano,

That is a great start, I'm glad someone else has also started on this. I am
going to start reading through the code you have done and when I am up to
speed I would like to help you build the tool.

I am also comfortable with the web based IDE. However even with youadworld
there was over 5000 files to port over. (Most didn't have to be ported
because web2py added the same features required). It is very hard to work
with a large amount of files with the built in web based IDE. Now if it
would have a folder tree panel like most standalone IDE's that would help
greatly. This can easily be done using Dojo, not sure how easy with jquery.

--
Regards,
Bruce

On Sun, Feb 12, 2012 at 5:41 AM, Ross Peoples wrote:

> I have been following ide/rad2py for a little while now. I am really
> looking forward to trying this out and I appreciate all the work you have
> put into it Mariano!
>
> Depending on the type of project, I will use either TextMate or Komodo
> Edit. For larger projects, I use Komodo for the code completion and
> organization. I also use SourceTree for source code management. I tried
> Eclipse + PyDev / Aptana, but it seems way too heavy and doesn't really
> really offer much more than I have already. I didn't play with it too long,
> as it reminded me of Java development too much, so I could be wrong and
> could totally be missing out.
>
> I am looking forward to playing with ide/rad2py to see if it can unseat
> Komodo as my IDE of choice.
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


[web2py] Re: cPickle instead of return dict(D=D) in serverside ajax function: accessing it in View

2012-02-12 Thread Anthony
Google is your friend:
http://stackoverflow.com/questions/7594740/convert-objects-to-json-and-send-via-jquery-ajax
http://stackoverflow.com/questions/3168401/json-formatting-sending-json-via-jquery-ajax-post-to-java-wicket-server
http://www.intelligrape.com/blog/2010/06/11/jquery-send-json-object-with-an-ajax-request/


On Sunday, February 12, 2012 10:54:48 AM UTC-5, Vineet wrote:
>
> I see. 
> That means neither cPickle nor session can be used. 
>
> A workaround can be like this-- 
> Keep the dataset stored in session. 
> On client-side, after hitting the save button, collect the values of 
> elements in JSON array format. 
> I can't use request.vars.elmt, because I require to pass the class 
> values also (of html elements) to the ajax controller. 
> (These class values are set/altered after user-interaction.) 
> web2py's ajax function can't pass JSON array to controller. 
>
> Can you pl. tell how to pass JSON array to controller via ajax? 
> (maybe $.ajax ?) 
>
> Thanks, 
>
> Vineet 
>
> On Feb 11, 10:28 pm, Anthony  wrote: 
> > > 3) User interacts with HTML elements & changes the data. 
> > 
> > > 4) Dynamically, the dataset is altered after user-interaction with 
> > > HTML elements. 
> > 
> > In that case, this part of your view won't work: 
> > 
> > {{for i in newD:}} 
> > ...processing statements... 
> > {{pass}} 
> > {{cPickle.dump(newD, open( "my_pkcl.p", "wb" ) )}} 
> > 
> > Anything done in the web2py template language has to happen on the 
> server 
> > (before sending the page to the browser), not in the client. 
> cPickle.dump 
> > cannot be called from the browser -- that is strictly a server-side 
> > operation. Anything that happens on the client side has to be done via 
> > Javascript (and/or a standard form submission). 
> > 
> > > 5) After hitting 'Save' button, the dataset is passed to controller 
> > > function for handling add/update/delete on related DB tables. 
> > 
> > This sounds fine. It's not clear you need to store the data in the 
> session 
> > at all. It sounds like you can just load the data in the view, let the 
> user 
> > make and submit changes, and then simply update the db with those 
> changes. 
> > 
> > Anthony



Re: [web2py] Dedicated IDE

2012-02-12 Thread Anthony

>
> I am also comfortable with the web based IDE. However even with youadworld 
> there was over 5000 files to port over. (Most didn't have to be ported 
> because web2py added the same features required). It is very hard to work 
> with a large amount of files with the built in web based IDE. Now if it 
> would have a folder tree panel like most standalone IDE's that would help 
> greatly.


Note, the web-based IDE isn't really intended as the main editing interface 
for large projects. It's more of a convenience for moderate editing needs, 
as well as an interface for other application management tasks.

With the latest trunk, if you do "from gluon import *" in a file, you 
should get code completion for all of the web2py API (works for me in 
Aptana).

Anthony 


Re: [web2py] Re: The web2py version

2012-02-12 Thread Anthony
Sorry, I was using trunk, so wasn't seeing the problem.

Anthony

On Sunday, February 12, 2012 3:38:59 AM UTC-5, Detectedstealth wrote:
>
> Hi Massimo,
>
> The problem is fixed in the nightly build. The problem was caused from 
> using:
> if not translate(self.error_messages):
>
> instead of:
>
> if not self.error_messages: Changing to this in the stable branch also 
> fixes the issue.
>
> On Sat, Feb 11, 2012 at 10:37 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> Can you attempt a patch? Else I can do it, but open a ticket first.
>> Thanks.
>>
>> On Feb 11, 10:51 pm, Bruce Wade  wrote:
>> > See attached welcome application.
>> >
>> > Downloaded fresh current stable source code from web2py, started server
>> > created a register action at the top of default.py controller.
>> >
>> > I just used the generic view, and added some of what I had from the live
>> > sites form. When entering a password such as 1 the error returned is
>> > None
>> >
>> > --
>> > Regards,
>> > Bruce
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Sat, Feb 11, 2012 at 2:15 PM, Anthony  wrote:
>> > > On Saturday, February 11, 2012 4:35:25 PM UTC-5, Detectedstealth 
>> wrote:
>> >
>> > >> Ok just got back this is the code I am using for both password and
>> > >> security password (with name changed only)
>> >
>> > >>  LABEL(SPAN(T('Password'), _title=T("Choose a safe password")),
>> > >>   INPUT(_name='password', requires=[IS_STRONG(), 
>> CRYPT(),
>> > >> IS_NOT_EMPTY(error_message=T('**Enter password'))], 
>> _type="password"),
>> > >>   _class="left clearfix", _for="password")
>> >
>> > > Hmm, the problem must be elsewhere -- if I wrap that in a FORM() and
>> > > submit and validate with a weak password, the form still correctly 
>> displays
>> > > the full error message. Maybe you can show the minimal complete 
>> controller
>> > > and view code that will reproduce the problem in a clean "welcome" 
>> app.
>> >
>> > > Anthony
>> >
>> > --
>> > --
>> > Regards,
>> > Bruce Wadehttp://
>> ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com
>> >
>> >  welcome.tar.gz
>> > 166KViewDownload
>
>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>


[web2py] Re: cPickle instead of return dict(D=D) in serverside ajax function: accessing it in View

2012-02-12 Thread Vineet
Yeah.
Let me dive into these links.

Thanks,

Vineet

On Feb 12, 9:09 pm, Anthony  wrote:
> Google is your 
> friend:http://stackoverflow.com/questions/7594740/convert-objects-to-json-an...http://stackoverflow.com/questions/3168401/json-formatting-sending-js...http://www.intelligrape.com/blog/2010/06/11/jquery-send-json-object-w...
>
>
> On Sunday, February 12, 2012 10:54:48 AM UTC-5, Vineet wrote:
>
> > I see.
> > That means neither cPickle nor session can be used.
>
> > A workaround can be like this--
> > Keep the dataset stored in session.
> > On client-side, after hitting the save button, collect the values of
> > elements in JSON array format.
> > I can't use request.vars.elmt, because I require to pass the class
> > values also (of html elements) to the ajax controller.
> > (These class values are set/altered after user-interaction.)
> > web2py's ajax function can't pass JSON array to controller.
>
> > Can you pl. tell how to pass JSON array to controller via ajax?
> > (maybe $.ajax ?)
>
> > Thanks,
>
> > Vineet
>
> > On Feb 11, 10:28 pm, Anthony  wrote:
> > > > 3) User interacts with HTML elements & changes the data.
>
> > > > 4) Dynamically, the dataset is altered after user-interaction with
> > > > HTML elements.
>
> > > In that case, this part of your view won't work:
>
> > > {{for i in newD:}}
> > > ...processing statements...
> > > {{pass}}
> > > {{cPickle.dump(newD, open( "my_pkcl.p", "wb" ) )}}
>
> > > Anything done in the web2py template language has to happen on the
> > server
> > > (before sending the page to the browser), not in the client.
> > cPickle.dump
> > > cannot be called from the browser -- that is strictly a server-side
> > > operation. Anything that happens on the client side has to be done via
> > > Javascript (and/or a standard form submission).
>
> > > > 5) After hitting 'Save' button, the dataset is passed to controller
> > > > function for handling add/update/delete on related DB tables.
>
> > > This sounds fine. It's not clear you need to store the data in the
> > session
> > > at all. It sounds like you can just load the data in the view, let the
> > user
> > > make and submit changes, and then simply update the db with those
> > changes.
>
> > > Anthony


[web2py] Re: How to success myapp example from web2py official book

2012-02-12 Thread Anthony
And the reason you're still seeing a page even though your "first.html" is 
likely in the wrong place is that when web2py can't find the expected view, 
it defaults to "generic.html", which appears to be what is showing in your 
screenshot.

Anthony

On Sunday, February 12, 2012 8:30:02 AM UTC-5, Alan Etkin wrote:
>
> I have tried the example with the last mercurial version and it works 
> well. 
>
> By seeing the output screenshot it seems like (maybe) you have not 
> created the corresponding view in the correct path: 
>
> For web2py to use the view, it should be placed here: 
> [application path]/views/default/first.html 
>
> Also, you can set a specific view location with the response.view 
> parameter that takes a url (to be placed at the controller or model 
> section), although that is not the usual way of linking views to 
> controllers 
>
> On 12 feb, 04:12, codingstar  wrote: 
> > Dear web2py users! 
> > I am study on web2py. 
> > I have a problem. 
> > 
> > I try to apply web2py example on official book (
> http://web2py.com/books/default/chapter/29/3 
> > ) 
> > 
> > # example 
> > ## 
> > Write the corresponding actions in the default controller: 
> > 
> > def first(): 
> > return dict() 
> > 
> > def second(): 
> > return dict() 
> > 
> > Then create a view "default/first.html" for the first action, and 
> > enter: 
> > 
> > {{extend 'layout.html'}} 
> > What is your name? 
> >  
> >
> >
> >  
> > Finally, create a view "default/second.html" for the second action: 
> > 
> > {{extend 'layout.html'}} 
> > Hello {{=request.vars.visitor_name}} 
> > 
> > 
> # 
>
> > 
> > However, I got a different result on  my browser. 
> > 
> > (http://web2py.com/books/static/books/29/document.source.bbc0fb2590824... 
>
> > ) 
> > 
> > I have a no submission form on my browser, no input-box too. 
> > 
> > my case :http://codingstar.net/mycase.png 
> > 
> > Why it happens? 
> > 
> > Please tell me about that.. 
> > 
> > *. My working environment 
> > - OS : win7 64bit 
> > - python : 2.7.2 
> > - web2py : 1.99.4 
> > - browser : chrome 16.0.912.77 m



[web2py] Representing foreign field with image (format/represent)

2012-02-12 Thread Keith Edmunds
I have a form based on a table which includes foreign fields. By default,
the foreign fields are displayed as the name from the foreign table
as expected.

I want to have an image displayed rather than the name from the foreign
table.

Not having used 'format' before, I changed the format of the foreign table
to:

format="xyz"

As expected, every row now displayed "xyz". I then changed to:

format=URL('static','images/red.jpg')

and again, as expected, the URL string appears in every row. Then I did:

format=IMG(_src=URL('static','images/red.jpg'))

and now no foreign key lookup seems to occur at all: I just get the id
value showing in the table.

I have two questions:

Why does that happen and
How can I display an image for a foreign key value?

Thanks for pointers or help!
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?


[web2py] Re: Representing foreign field with image (format/represent)

2012-02-12 Thread Alan Etkin
I belive that format is intended for string output:

"... defines a format string for the table. It determines how a record
should be represented as a string. ..."

For presenting other objects you could use the Field attribute
represent

"... table.id.represent = lambda id, row: \
A('edit:',id,_href=URL(args=(request.args(0),id)))
(...)
represent=... that tells web2py to change the
representation of the id field and display a link instead to the page
itself
..."

Extracted from the web2py book, 4th edition, section 7.4.3


On Feb 12, 2:43 pm, Keith Edmunds  wrote:
> I have a form based on a table which includes foreign fields. By default,
> the foreign fields are displayed as the name from the foreign table
> as expected.
>
> I want to have an image displayed rather than the name from the foreign
> table.
>
> Not having used 'format' before, I changed the format of the foreign table
> to:
>
>         format="xyz"
>
> As expected, every row now displayed "xyz". I then changed to:
>
>         format=URL('static','images/red.jpg')
>
> and again, as expected, the URL string appears in every row. Then I did:
>
>         format=IMG(_src=URL('static','images/red.jpg'))
>
> and now no foreign key lookup seems to occur at all: I just get the id
> value showing in the table.
>
> I have two questions:
>
> Why does that happen and
> How can I display an image for a foreign key value?
>
> Thanks for pointers or help!
> --
> "You can have everything in life you want if you help enough other people
> get what they want" - Zig Ziglar.
>
> Who did you help today?


Re: [web2py] Re: Representing foreign field with image (format/represent)

2012-02-12 Thread Keith Edmunds
Thanks Alan, that has enabled me to do what I want.
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?


[web2py] Re: Representing foreign field with image (format/represent)

2012-02-12 Thread Anthony
Like "represent", "format" should be either a string or a callable, so you 
should also be able to do:

format=lambda row: IMG(_src=URL('static', 'images/red.jpg')) 

Anthony

On Sunday, February 12, 2012 1:02:55 PM UTC-5, Alan Etkin wrote:
>
> I belive that format is intended for string output: 
>
> "... defines a format string for the table. It determines how a record 
> should be represented as a string. ..." 
>
> For presenting other objects you could use the Field attribute 
> represent 
>
> "... table.id.represent = lambda id, row: \ 
> A('edit:',id,_href=URL(args=(request.args(0),id))) 
> (...) 
> represent=... that tells web2py to change the 
> representation of the id field and display a link instead to the page 
> itself 
> ..." 
>
> Extracted from the web2py book, 4th edition, section 7.4.3 
>
>
> On Feb 12, 2:43 pm, Keith Edmunds  wrote: 
> > I have a form based on a table which includes foreign fields. By 
> default, 
> > the foreign fields are displayed as the name from the foreign table 
> > as expected. 
> > 
> > I want to have an image displayed rather than the name from the foreign 
> > table. 
> > 
> > Not having used 'format' before, I changed the format of the foreign 
> table 
> > to: 
> > 
> > format="xyz" 
> > 
> > As expected, every row now displayed "xyz". I then changed to: 
> > 
> > format=URL('static','images/red.jpg') 
> > 
> > and again, as expected, the URL string appears in every row. Then I did: 
> > 
> > format=IMG(_src=URL('static','images/red.jpg')) 
> > 
> > and now no foreign key lookup seems to occur at all: I just get the id 
> > value showing in the table. 
> > 
> > I have two questions: 
> > 
> > Why does that happen and 
> > How can I display an image for a foreign key value? 
> > 
> > Thanks for pointers or help! 
> > -- 
> > "You can have everything in life you want if you help enough other 
> people 
> > get what they want" - Zig Ziglar. 
> > 
> > Who did you help today?



Re: [web2py] uwsgi configuration: why many lines in /root/var/log/uwsgi-python/web2py log : routing 0 routes 0 ?

2012-02-12 Thread Carlos
Hi,

Can you please provide the details on how to upgrade uwsgi-python on my 
ubuntu linux 10.04 LTS OS?.

I am no expert in linux, and all I did to install uwsgi was:

   add-apt-repository ppa:uwsgi/release

How can I (re-)install / upgrade uwsgi-python in my environment?.

Thanks a lot!,

   Carlos


[web2py] Re: Markmin Output Questions

2012-02-12 Thread Massimo Di Pierro
No but we can think about extending it

On Feb 12, 7:59 am, Alan Etkin  wrote:
> -I'd prefer separated files for large documents (but does MARKMIN
> support it?)
> -I don't see page break options in the docs. CSS seems to support page
> breaks, but I don't think that MARKMIN accepts style sheets so far.
> I'm affraid you will have to explore this:
>
>    http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py
>    http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py
>    http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py
>
> On 11 feb, 17:30, Ross Peoples  wrote:
>
>
>
>
>
>
>
> > Anyone have any thoughts on this?


[web2py] Re: validators.py error in

2012-02-12 Thread Massimo Di Pierro
Any chance you can tell us which versions broke it?

On Feb 12, 8:30 am, Alan Etkin  wrote:
> I have pulled the last mercurial version and get this new exception in
> a query. This behavior is new, older versions of web2py don't return
> this error:
>
> Note: the app is a wxPython application that queries a PostgreSQL
> database with web2py and gui2py:http://code.google.com/p/gestionlibre.gui
>
> 
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> options
>     self.options() #
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> options
>     self.options() #
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> options
>     self.options() #
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> options
>     self.options() #
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> options
>     self.options() #
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 463, in
> options
>     self.build_set()
>   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 451, in
> build_set
>     records = self.dbset.select(*fields, **dd)
>   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 7379, in
> select
>     return adapter.select(self.query,fields,attributes)
>   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1301, in
> select
>     sql = self._select(query, fields, attributes)
>   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> _select
>     sql_t = ', '.join(alias(t) for t in tablenames)
>   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> 
>     sql_t = ', '.join(alias(t) for t in tablenames)
> RuntimeError: maximum recursion depth exceeded while calling a Python
> object
>
> Here is a part of the model wich I suppose is relevant
>
>     # Source Document (transactions records)
>     db.define_table('operation',
>         Field('operation_id', 'id', label = T("id")),
>         Field('code', unique = True, label = T("code")),
>         Field('description', label = T("description")),
>         Field('customer_id', 'reference customer', label =
> T("customer")), # reference
>         Field('supplier_id', 'reference supplier', label =
> T("supplier")), # reference
>         Field('detail', type='string', length=60,
> comment=T('Observations'), label = T("detail")),
>         Field('payment_terms_id', 'reference payment_terms',
> comment=T('Terms of payment'), label = T("payment terms")), #
> reference
>         Field('term', type='string', length=50, label = T("term")),
>         Field('amount', type='double', label = T("amount")),
>         Field('balance', type='double', label = T("balance")),
>         Field('posted', type='datetime', default = now, label =
> T("posted")),
>         Field('issue', type='datetime', label = T("issue")),
>         Field('document_id', 'reference document', comment=T('Points
> to order / invoice / packingslips'), label = T("document")), #
> reference
>         Field('branch', label = T("branch")),
>         Field('number', type='integer', default=0, label =
> T("number")),
>         Field('due_date', type='datetime', label = T("due date")),
>         Field('type', type='string', length=1,
> requires=IS_IN_SET({'T': 'Stock','S': 'Sales','P': 'Purchases'}),
> label = T("type")), # reference? types: T: Stock, S: Sales, P:
> Purchases
>         Field('canceled', type='boolean', default=False,
> comment=T('False if deferred payment (df), True if paid with cash, ch
> (check) or current account'), label = T("canceled")),
>         Field('processed', type='boolean', default=False, label =
> T("processed")),
>         Field('voided', type='boolean', default=False, label =
> T("voided")), # ¿anulado?
>         Field('fund_id', 'reference fund', label = T("fund")), #
> reference
>         Field('cost_center_id', 'reference cost_center', label =
> T("cost center")), # reference
>         Field('module', type='integer', default=0,
> comment=T('Referenced table'), label = T("module")), # reference?
>         Field('observations', type='string', length=50, label =
> T("observations")),
>         Field('cancellation', type='boolean', default=False, label =
> T("cancellation")),
>         Field('avoidance', type='boolean', default=False, label =
> T("avoidance")), # ¿anulación?
>         Field('file_id', 'reference file', label = T("file")), #
> ¿legajo? # reference
>         Field('payroll_id', 'reference payroll', label =
> T("payroll")), # reference
>         Field('user_id', 'reference auth_user', label = T("user")), #
> reference
>         Field('hour', type='datetime', label = T("hour")),
>         Field('replicated', type='datetime', label = T("replicated")),
>         Field('subcustomer_id', 'reference subcustomer', label =
> T("subcustomer")), # reference
>         Field('salesperson_id', 'reference salesperson', label =
> T("salesperson")), # reference
>         Field('printed', type='boolean', default=False, labe

[web2py] Re: validators.py error in

2012-02-12 Thread Carlos
Hi Massimo,

self.options() is being called (recursively) inside options function 
in IS_IN_DB class.

changeset # c3ed339c547b (fixed issue 647, problem with is_in_db and 
multiple).

   Carlos



[web2py] Re: Markmin Output Questions

2012-02-12 Thread Ross Peoples
Massimo,

How do you generate the PDF book now?


[web2py] New Plugin: plugin_markitup

2012-02-12 Thread Ross Peoples
I have created another plugin for the MarkItUp widget. I know that 
plugin_wiki has this currently, but I wanted a dedicated plugin for this 
for an upcoming project I'm working on.

You can get the plugin from 
Bitbucket: https://bitbucket.org/PhreeStyle/web2py_markitup

There is no documentation yet, as I just pushed the code. But I wanted to 
announce in case anyone wants to play with this. It has not been thoroughly 
tested and is only an alpha at this point. It can be used with several 
different markup languages:

   - BBCode
   - HTML
   - Markdown
   - Markmin
   - reStructuredText
   - Textile
   - Wiki

The plugin can be used standalone, or as a form field widget. It currently 
supports live previews for 4 markup languages: html, markmin, markdown, 
textile, and bbcode. Code blocks for markmin and markdown markup are 
highlighted by pygments, which is included as part of the plugin. No 
external dependencies. Using pygments for code highlighting allows over 100 
languages to be highlighted.

Code highlighting in markmin:

``
def testing():
print 'Testing'
``:python

Code highlighting in markdown:

:::python
def testing():
print 'Testing'

Markdown requires four spaces at the beginning of each line for code blocks.

Example for basic usage:

from plugin_markitup.markitup import MarkItUp

def test():
widget = MarkItUp(set_name='markmin').markitup()
return dict(widget=widget)


Example model for form fields:

from plugin_markitup.markitup import MarkItUp

db.define_table('content',
Field('name', length=20),
Field('description', 'text')
)
db.content.description.widget = MarkItUp().widget


Example controller:
def test():
form = SQLFORM(db.content)
if form.accepts(request, session):
redirect(URL())

return dict(form=form)


This plugin is more of an alpha preview, so I expect there to be problems 
and inconsistencies. Please try it out and let me know if you have any 
questions, comments, or problems!


Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?

2012-02-12 Thread Sebastian E. Ovide
thanks Michele

On Fri, Feb 10, 2012 at 10:57 PM, Michele Comitini <
michele.comit...@gmail.com> wrote:

> I wrote:
> > The problem with MAP_ANONYMOUS is that you cannot share after fork.
>
> I should have written: you cannot share *a mmap created* after fork.
>
> >
> > http://www.kernel.org/doc/man-pages/online/pages/man2/mmap.2.html
> >
> > If you are on Linux here you find some quick explanation how mmap,
> > tmpfs and shm fs relate to each others:
> > http://stackoverflow.com/questions/904581/shmem-vs-tmpfs-vs-mmap
>



-- 
Sebastian E. Ovide


[web2py] Virtual Field Issue - Possible Bug with old style/class definitions?

2012-02-12 Thread BrendanC
I've been experimenting with creating virtual fields and have come across 
what may be a possible bug when
they are created via old style (class definitions). 

I created a small table with 3 fields (ID, Name and dob). I've added some 
virtual fields to compute the age in days using all the options defined in 
the docs.  
http://web2py.com/books/default/chapter/29/6?search=virtual+fields#Virtual-fields

I see the following (unexpected results) (See the test code below)

1) For old style (class defined vf's) - Results returned from virtual 
fields computations are incorrect. The same value for all records is shown 
- 
(the last value in the table is displayed in each case)

2) For New style vfs: - Correct results are returned:

Is there bug in my code, or has anyone seen this behaviour before?

Below is sample o/p from my tests and the test program

Vclass : name: fred; dayage: 34427
Vclass : name: joe; dayage: 18730
Vclass : name: harry; dayage: 15382

Name: fred; DOB: 1917-11-10 12:00:00;
  Using VF Class:   Age (class): 15382; Age(Lazy); 15382; Age(Lazy 
Lambda): 15382
  Using New Style VFs: Age (new style): 34427; Age(new style (Lazy)); 
34427 

Name: joe; DOB: 1960-11-01 12:00:00;
  Using VF Class:   Age (class): 15382; Age(Lazy); 15382; Age(Lazy 
Lambda): 15382
  Using New Style VFs: Age (new style): 18730; Age(new style (Lazy)); 
18730 

Name: harry; DOB: 1970-01-01 12:00:00;
  Using VF Class:   Age (class): 15382; Age(Lazy); 15382; Age(Lazy 
Lambda): 15382
  Using New Style VFs: Age (new style): 15382; Age(new style (Lazy)); 
15382 


** Test Code **

import os, sys
sdir = '/home/web2py'
sys.path.append(sdir)

try:
from gluon import DAL, Field
except ImportError as err:
print('gluon path not found')

# target db - sqlite
db = DAL("sqlite://mydb.sqlite")

# define view/table
##
#
# db view testing
# define some virtual fields here (psa stale, fustale)
#
##
db.define_table('person',
Field('name', type='string'),
Field('dob', type='datetime'),
migrate=False)

import datetime
now = datetime.datetime.now()

# define new style virtual fields - age in days (aid)
db.person.virtual_aid =Field.Virtual(lambda row : (now - 
row.person.dob).days )
db.person.lazy_aid =Field.Lazy(lambda row : (now - row.person.dob).days )
 
# lambda version
class   MyVf(object):

# define a new virtual field value
def vfclass_aid(self):
self.daycount = (now - self.person.dob).days
print 'Vclass : dayage: %s' %self.daycount
return lambda : self.daycount

# define a lazy vf
def vfclass_lazy_aid(self):
def lazy(self=self):
return (now - self.person.dob).days
return lazy

# define a lazy lambda vf
def vfclass_lazy_lambda_aid(self):
return lambda self= self: (now - self.person.dob).days

if __name__ == "__main__":

import datetime
dtstart = datetime.datetime.now()
print '\nStarting at: %s \n' %dtstart.ctime()

# create virtual field (using a class)
db.person.virtualfields.append(MyVf())

for item in db(db.person).select():
print '\nName: %s; DOB: %s;'%(item.name, item.dob)
print '\t  Using VF Class:  \t\tAge (class): %s;\t\tAge(Lazy); 
%s;\t Age(Lazy Lambda): %s' \
%(item.vfclass_aid(), item.vfclass_lazy_aid(), 
item.vfclass_lazy_lambda_aid() )

print '\t  Using New Style VFs: \tAge (new style): %s; 
\tAge(new style (Lazy)); %s ' \
%(item.virtual_aid, item.lazy_aid())


dtend = datetime.datetime.now()
print '\nEnding at: %s \n' %dtend.ctime()






[web2py] Re: validators.py error in

2012-02-12 Thread Alan Etkin
I don't keep a list of version updates for my local repository (and I
see that it is a good idea for cases like this), but I pull the
repository frequently, about once a week. Is there any way in
mercurial to retrieve something like a command log?

On 12 feb, 17:16, Massimo Di Pierro 
wrote:
> Any chance you can tell us which versions broke it?
>
> On Feb 12, 8:30 am, Alan Etkin  wrote:
>
>
>
>
>
>
>
> > I have pulled the last mercurial version and get this new exception in
> > a query. This behavior is new, older versions of web2py don't return
> > this error:
>
> > Note: the app is a wxPython application that queries a PostgreSQL
> > database with web2py and gui2py:http://code.google.com/p/gestionlibre.gui
>
> > 
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > options
> >     self.options() #
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > options
> >     self.options() #
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > options
> >     self.options() #
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > options
> >     self.options() #
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > options
> >     self.options() #
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 463, in
> > options
> >     self.build_set()
> >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 451, in
> > build_set
> >     records = self.dbset.select(*fields, **dd)
> >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 7379, in
> > select
> >     return adapter.select(self.query,fields,attributes)
> >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1301, in
> > select
> >     sql = self._select(query, fields, attributes)
> >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> > _select
> >     sql_t = ', '.join(alias(t) for t in tablenames)
> >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> > 
> >     sql_t = ', '.join(alias(t) for t in tablenames)
> > RuntimeError: maximum recursion depth exceeded while calling a Python
> > object
>
> > Here is a part of the model wich I suppose is relevant
>
> >     # Source Document (transactions records)
> >     db.define_table('operation',
> >         Field('operation_id', 'id', label = T("id")),
> >         Field('code', unique = True, label = T("code")),
> >         Field('description', label = T("description")),
> >         Field('customer_id', 'reference customer', label =
> > T("customer")), # reference
> >         Field('supplier_id', 'reference supplier', label =
> > T("supplier")), # reference
> >         Field('detail', type='string', length=60,
> > comment=T('Observations'), label = T("detail")),
> >         Field('payment_terms_id', 'reference payment_terms',
> > comment=T('Terms of payment'), label = T("payment terms")), #
> > reference
> >         Field('term', type='string', length=50, label = T("term")),
> >         Field('amount', type='double', label = T("amount")),
> >         Field('balance', type='double', label = T("balance")),
> >         Field('posted', type='datetime', default = now, label =
> > T("posted")),
> >         Field('issue', type='datetime', label = T("issue")),
> >         Field('document_id', 'reference document', comment=T('Points
> > to order / invoice / packingslips'), label = T("document")), #
> > reference
> >         Field('branch', label = T("branch")),
> >         Field('number', type='integer', default=0, label =
> > T("number")),
> >         Field('due_date', type='datetime', label = T("due date")),
> >         Field('type', type='string', length=1,
> > requires=IS_IN_SET({'T': 'Stock','S': 'Sales','P': 'Purchases'}),
> > label = T("type")), # reference? types: T: Stock, S: Sales, P:
> > Purchases
> >         Field('canceled', type='boolean', default=False,
> > comment=T('False if deferred payment (df), True if paid with cash, ch
> > (check) or current account'), label = T("canceled")),
> >         Field('processed', type='boolean', default=False, label =
> > T("processed")),
> >         Field('voided', type='boolean', default=False, label =
> > T("voided")), # ¿anulado?
> >         Field('fund_id', 'reference fund', label = T("fund")), #
> > reference
> >         Field('cost_center_id', 'reference cost_center', label =
> > T("cost center")), # reference
> >         Field('module', type='integer', default=0,
> > comment=T('Referenced table'), label = T("module")), # reference?
> >         Field('observations', type='string', length=50, label =
> > T("observations")),
> >         Field('cancellation', type='boolean', default=False, label =
> > T("cancellation")),
> >         Field('avoidance', type='boolean', default=False, label =
> > T("avoidance")), # ¿anulación?
> >         Field('file_id', 'reference file', label = T("file")), #
> > ¿legajo? # reference
> >         Field('payroll_id', 'reference payroll', label =
> > T("

[web2py] Re: Dedicated IDE

2012-02-12 Thread Francisco Costa
at tymr we use gEdit + plugins

On Feb 12, 4:17 pm, Anthony  wrote:
> > I am also comfortable with the web based IDE. However even with youadworld
> > there was over 5000 files to port over. (Most didn't have to be ported
> > because web2py added the same features required). It is very hard to work
> > with a large amount of files with the built in web based IDE. Now if it
> > would have a folder tree panel like most standalone IDE's that would help
> > greatly.
>
> Note, the web-based IDE isn't really intended as the main editing interface
> for large projects. It's more of a convenience for moderate editing needs,
> as well as an interface for other application management tasks.
>
> With the latest trunk, if you do "from gluon import *" in a file, you
> should get code completion for all of the web2py API (works for me in
> Aptana).
>
> Anthony


[web2py] Re: Virtual Field Issue - Possible Bug with old style/class definitions?

2012-02-12 Thread pbreit
I wonder if there is a problem with when "now" is being calculated. Maybe 
put now = in the function or class?

[web2py] Re: Dedicated IDE

2012-02-12 Thread pbreit
You should not be using the web-based editor for anything beyond quick 
edits or testing,

I always steer people away from IDEs and to just use a good text editor 
(for Mac, TextMate) and version control (I like MacHG better than 
SourceTree).


[web2py] Re: Web2py session has me really confused now

2012-02-12 Thread pbreit
Since session is already a Storage object, can't you skip this: 
session[request.controller] 
= Storage()?




[web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-12 Thread pbreit
I suggest, if possible, using auth_user as the user table. You can easily 
add fields: http://web2py.com/books/default/chapter/29/9#Customizing-Auth

[web2py] PURE, a JS templating engine

2012-02-12 Thread Francisco Costa
http://beebole.com/pure/ has anyone give it a try?
Get started: http://beebole.com/pure/documentation/get-started/


Re: [web2py] Re: Dedicated IDE

2012-02-12 Thread Bruce Wade
IDE's are good when you are working on large projects, and or on medium to
large teams. Also by dedicated IDE I mean more then just typing text. Think
more like an environment that can handle all your planing tasks, profiling,
design layouts etc but in more of a visual way.

I am all for vim when I want to do something with a single file however
when I am going to be coding all day it becomes a pain to always have to
type commands just to edit text etc..

I also come from a background of game development so I kind of prefer the
custom tools that are developed for making them kinds of projects.

On Sun, Feb 12, 2012 at 3:04 PM, pbreit  wrote:

> You should not be using the web-based editor for anything beyond quick
> edits or testing,
>
> I always steer people away from IDEs and to just use a good text editor
> (for Mac, TextMate) and version control (I like MacHG better than
> SourceTree).
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Re: validators.py error in

2012-02-12 Thread Bruce Wade
I know git has "git log" I am sure mercurial has something similar.

On Sun, Feb 12, 2012 at 2:07 PM, Alan Etkin  wrote:

> I don't keep a list of version updates for my local repository (and I
> see that it is a good idea for cases like this), but I pull the
> repository frequently, about once a week. Is there any way in
> mercurial to retrieve something like a command log?
>
> On 12 feb, 17:16, Massimo Di Pierro 
> wrote:
> > Any chance you can tell us which versions broke it?
> >
> > On Feb 12, 8:30 am, Alan Etkin  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I have pulled the last mercurial version and get this new exception in
> > > a query. This behavior is new, older versions of web2py don't return
> > > this error:
> >
> > > Note: the app is a wxPython application that queries a PostgreSQL
> > > database with web2py and gui2py:
> http://code.google.com/p/gestionlibre.gui
> >
> > > 
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > options
> > > self.options() #
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > options
> > > self.options() #
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > options
> > > self.options() #
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > options
> > > self.options() #
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > options
> > > self.options() #
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 463, in
> > > options
> > > self.build_set()
> > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 451, in
> > > build_set
> > > records = self.dbset.select(*fields, **dd)
> > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 7379, in
> > > select
> > > return adapter.select(self.query,fields,attributes)
> > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1301, in
> > > select
> > > sql = self._select(query, fields, attributes)
> > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> > > _select
> > > sql_t = ', '.join(alias(t) for t in tablenames)
> > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> > > 
> > > sql_t = ', '.join(alias(t) for t in tablenames)
> > > RuntimeError: maximum recursion depth exceeded while calling a Python
> > > object
> >
> > > Here is a part of the model wich I suppose is relevant
> >
> > > # Source Document (transactions records)
> > > db.define_table('operation',
> > > Field('operation_id', 'id', label = T("id")),
> > > Field('code', unique = True, label = T("code")),
> > > Field('description', label = T("description")),
> > > Field('customer_id', 'reference customer', label =
> > > T("customer")), # reference
> > > Field('supplier_id', 'reference supplier', label =
> > > T("supplier")), # reference
> > > Field('detail', type='string', length=60,
> > > comment=T('Observations'), label = T("detail")),
> > > Field('payment_terms_id', 'reference payment_terms',
> > > comment=T('Terms of payment'), label = T("payment terms")), #
> > > reference
> > > Field('term', type='string', length=50, label = T("term")),
> > > Field('amount', type='double', label = T("amount")),
> > > Field('balance', type='double', label = T("balance")),
> > > Field('posted', type='datetime', default = now, label =
> > > T("posted")),
> > > Field('issue', type='datetime', label = T("issue")),
> > > Field('document_id', 'reference document', comment=T('Points
> > > to order / invoice / packingslips'), label = T("document")), #
> > > reference
> > > Field('branch', label = T("branch")),
> > > Field('number', type='integer', default=0, label =
> > > T("number")),
> > > Field('due_date', type='datetime', label = T("due date")),
> > > Field('type', type='string', length=1,
> > > requires=IS_IN_SET({'T': 'Stock','S': 'Sales','P': 'Purchases'}),
> > > label = T("type")), # reference? types: T: Stock, S: Sales, P:
> > > Purchases
> > > Field('canceled', type='boolean', default=False,
> > > comment=T('False if deferred payment (df), True if paid with cash, ch
> > > (check) or current account'), label = T("canceled")),
> > > Field('processed', type='boolean', default=False, label =
> > > T("processed")),
> > > Field('voided', type='boolean', default=False, label =
> > > T("voided")), # ¿anulado?
> > > Field('fund_id', 'reference fund', label = T("fund")), #
> > > reference
> > > Field('cost_center_id', 'reference cost_center', label =
> > > T("cost center")), # reference
> > > Field('module', type='integer', default=0,
> > > comment=T('Referenced table'), label = T("module")), # reference?
> > > Field('observations', type='string', length=50, label =
> > > T("observations")),
> > > Field('c

[web2py] Re: validators.py error in

2012-02-12 Thread Alan Etkin
Thank you Bruce. It is possible to do hg log, it shows the complete
commit list until the last pulled code (I think), and it supposedly
includes instances not updated locally, so that method doesn't allow
me to see what versions I really downloaded. However, the update seems
to have been found by Carlos already.

On 12 feb, 21:11, Bruce Wade  wrote:
> I know git has "git log" I am sure mercurial has something similar.
>
>
>
>
>
>
>
>
>
> On Sun, Feb 12, 2012 at 2:07 PM, Alan Etkin  wrote:
> > I don't keep a list of version updates for my local repository (and I
> > see that it is a good idea for cases like this), but I pull the
> > repository frequently, about once a week. Is there any way in
> > mercurial to retrieve something like a command log?
>
> > On 12 feb, 17:16, Massimo Di Pierro 
> > wrote:
> > > Any chance you can tell us which versions broke it?
>
> > > On Feb 12, 8:30 am, Alan Etkin  wrote:
>
> > > > I have pulled the last mercurial version and get this new exception in
> > > > a query. This behavior is new, older versions of web2py don't return
> > > > this error:
>
> > > > Note: the app is a wxPython application that queries a PostgreSQL
> > > > database with web2py and gui2py:
> >http://code.google.com/p/gestionlibre.gui
>
> > > > 
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > > options
> > > >     self.options() #
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > > options
> > > >     self.options() #
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > > options
> > > >     self.options() #
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > > options
> > > >     self.options() #
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 469, in
> > > > options
> > > >     self.options() #
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 463, in
> > > > options
> > > >     self.build_set()
> > > >   File "/home/alan/web2py/web2py-hg/gluon/validators.py", line 451, in
> > > > build_set
> > > >     records = self.dbset.select(*fields, **dd)
> > > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 7379, in
> > > > select
> > > >     return adapter.select(self.query,fields,attributes)
> > > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1301, in
> > > > select
> > > >     sql = self._select(query, fields, attributes)
> > > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> > > > _select
> > > >     sql_t = ', '.join(alias(t) for t in tablenames)
> > > >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 1265, in
> > > > 
> > > >     sql_t = ', '.join(alias(t) for t in tablenames)
> > > > RuntimeError: maximum recursion depth exceeded while calling a Python
> > > > object
>
> > > > Here is a part of the model wich I suppose is relevant
>
> > > >     # Source Document (transactions records)
> > > >     db.define_table('operation',
> > > >         Field('operation_id', 'id', label = T("id")),
> > > >         Field('code', unique = True, label = T("code")),
> > > >         Field('description', label = T("description")),
> > > >         Field('customer_id', 'reference customer', label =
> > > > T("customer")), # reference
> > > >         Field('supplier_id', 'reference supplier', label =
> > > > T("supplier")), # reference
> > > >         Field('detail', type='string', length=60,
> > > > comment=T('Observations'), label = T("detail")),
> > > >         Field('payment_terms_id', 'reference payment_terms',
> > > > comment=T('Terms of payment'), label = T("payment terms")), #
> > > > reference
> > > >         Field('term', type='string', length=50, label = T("term")),
> > > >         Field('amount', type='double', label = T("amount")),
> > > >         Field('balance', type='double', label = T("balance")),
> > > >         Field('posted', type='datetime', default = now, label =
> > > > T("posted")),
> > > >         Field('issue', type='datetime', label = T("issue")),
> > > >         Field('document_id', 'reference document', comment=T('Points
> > > > to order / invoice / packingslips'), label = T("document")), #
> > > > reference
> > > >         Field('branch', label = T("branch")),
> > > >         Field('number', type='integer', default=0, label =
> > > > T("number")),
> > > >         Field('due_date', type='datetime', label = T("due date")),
> > > >         Field('type', type='string', length=1,
> > > > requires=IS_IN_SET({'T': 'Stock','S': 'Sales','P': 'Purchases'}),
> > > > label = T("type")), # reference? types: T: Stock, S: Sales, P:
> > > > Purchases
> > > >         Field('canceled', type='boolean', default=False,
> > > > comment=T('False if deferred payment (df), True if paid with cash, ch
> > > > (check) or current account'), label = T("canceled")),
> > > >         Field('processed', type='boolean', default=False, label =
> > > > T("processed")),
> > > >         Field('voided', ty

Re: [web2py] Re: Dedicated IDE

2012-02-12 Thread Jim Steil

I'm an Aptana user.  Works great for me.

-Jim

On 2/12/2012 6:08 PM, Bruce Wade wrote:
IDE's are good when you are working on large projects, and or 
on medium to large teams. Also by dedicated IDE I mean more then just 
typing text. Think more like an environment that can handle all your 
planing tasks, profiling, design layouts etc but in more of a 
visual way.


I am all for vim when I want to do something with a single file 
however when I am going to be coding all day it becomes a pain to 
always have to type commands just to edit text etc..


I also come from a background of game development so I kind of prefer 
the custom tools that are developed for making them kinds of projects.


On Sun, Feb 12, 2012 at 3:04 PM, pbreit > wrote:


You should not be using the web-based editor for anything beyond
quick edits or testing,

I always steer people away from IDEs and to just use a good text
editor (for Mac, TextMate) and version control (I like MacHG
better than SourceTree).




--
--
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com

No virus found in this message.
Checked by AVG - www.avg.com 
Version: 2012.0.1913 / Virus Database: 2112/4806 - Release Date: 02/12/12



--
Jim Steil
VP of Information Technology
Quality Liquid Feeds, Inc.
608.935.2345 office
608.341.9896 cell


[web2py] Re: Single error message for radio group

2012-02-12 Thread Massimo Di Pierro
INPUT(,hideerror=True)

On Feb 12, 6:33 pm, Bruce Wade  wrote:
> Hi,
>
> Is it possible to show a single error message for a group of radio buttons.
> See screen shot
>
> FORM(
>             FIELDSET(
>                 H4(self.T('Personal Questions')),
>                 UL(
>                     LI(
>                         H5(self.T('What is your Age?')),
>                         INPUT( _type='radio', _name='age', _value='1',
> _id='age1', requires = IS_NOT_EMPTY(error_message=self.T('missing your
> age'))),
>                         LABEL(SPAN(self.T('Less than 20')), _for='age1'),
>                         INPUT( _type='radio', _name='age',
> _value='2',_id='age2'),
>                         LABEL(SPAN(self.T('20-35')), _for='age2'),
>                         INPUT( _type='radio', _name='age', _value='3',
> _id='age3'),
>                         LABEL(SPAN(self.T('35-50')), _for='age3'),
>                         INPUT( _type='radio', _name='age', _value='4',
> _id='age4'), LABEL(SPAN(self.T('50-65')), _for='age4'),
>                         INPUT( _type='radio', _name='age', _value='5',
> _id='age5'), LABEL(SPAN(self.T('65 and never too old')), _for='age5'),
>                     ),
>                ),
>            )
> )
>
> --
> --
> Regards,
> Bruce 
> Wadehttp://ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com
>
>  fit_errors.png
> 371KViewDownload


Re: [web2py] Re: Single error message for radio group

2012-02-12 Thread Bruce Wade
Thanks.

On Sun, Feb 12, 2012 at 5:57 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> INPUT(,hideerror=True)
>
> On Feb 12, 6:33 pm, Bruce Wade  wrote:
> > Hi,
> >
> > Is it possible to show a single error message for a group of radio
> buttons.
> > See screen shot
> >
> > FORM(
> > FIELDSET(
> > H4(self.T('Personal Questions')),
> > UL(
> > LI(
> > H5(self.T('What is your Age?')),
> > INPUT( _type='radio', _name='age', _value='1',
> > _id='age1', requires = IS_NOT_EMPTY(error_message=self.T('missing your
> > age'))),
> > LABEL(SPAN(self.T('Less than 20')), _for='age1'),
> > INPUT( _type='radio', _name='age',
> > _value='2',_id='age2'),
> > LABEL(SPAN(self.T('20-35')), _for='age2'),
> > INPUT( _type='radio', _name='age', _value='3',
> > _id='age3'),
> > LABEL(SPAN(self.T('35-50')), _for='age3'),
> > INPUT( _type='radio', _name='age', _value='4',
> > _id='age4'), LABEL(SPAN(self.T('50-65')), _for='age4'),
> > INPUT( _type='radio', _name='age', _value='5',
> > _id='age5'), LABEL(SPAN(self.T('65 and never too old')), _for='age5'),
> > ),
> >),
> >)
> > )
> >
> > --
> > --
> > Regards,
> > Bruce Wadehttp://
> ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com
> >
> >  fit_errors.png
> > 371KViewDownload




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


[web2py] Can this be improved?

2012-02-12 Thread Lewis
In the controller below, I display a list of jokes for visitors to the
site.  They can choose to sort by author or category.  They can also
filter the list to a single category and/or a single author.   The
view includes a form with select/option drop downs for each choice.
Then, I'll change the queries to reflect the visitor's choices
(haven't implemented that below, yet).

For just presenting the choices, the controller below works.  It just
seems like it's a bit clunky--like I am not doing this in the most
compact way that web2py makes possible.  I've queried for only those
categories and authors for which there are jokes.  Then, the list
comprehension "pulls" out the part of the rows that appear in the
options of the form.  Seems like too many steps somehow...

Then, I'll need an "if form.process().accepts...: " to process the
user's choices and then sort and re-present the list of jokes.  Seems
like there should be some slick way to get the user's choices into the
request.vars so that I can do one of those slick web2py things like
"...orderby=request.args(1) or )".

If this is fine, I'm happy but seems like this is a sort of common
thing to do--let user's pick sort field and filter values...

most of the applicable controller:  (funny wrapping because of width
of this text box)

sort_choices=['Category','Author']
sort_ctrl = FORM(SELECT(sort_choices))
#
category_choices =
jodb(jodb.joke_category.category==jodb.category.id).select(jodb.category.name,jodb.category.id,
orderby = jodb.category.name, distinct=True).as_list()
category_choices = [OPTION(i['name'],_value=i['id']) for i in
category_choices]
cat_ctrl = FORM(SELECT(category_choices))
#
author_choices =
jodb(jodb.joke.created_by==jodb.auth_user.id).select(jodb.auth_user.first_name,
jodb.auth_user.last_name, jodb.auth_user.id, orderby =
jodb.auth_user.last_name, distinct=True).as_list()
author_choices = [OPTION(i['first_name'],' ',
i['last_name'],_value=i['id']) for i in author_choices]
author_ctrl = FORM(SELECT(author_choices))
#
query1 = ((jodb.joke.id==jodb.joke_category.joke) &
(jodb.joke_category.category == jodb.category.id) &
(jodb.joke.created_by == jodb.auth_user.id))
jokes_cats = jodb(query1).select(jodb.joke.joketext,
jodb.joke.created_by,
jodb.auth_user.first_name, jodb.auth_user.last_name,
jodb.category.name,orderby = jodb.category.name)
return
dict(jokes=jokes_cats,sort_ctrl=sort_ctrl,author_ctrl=author_ctrl,
cat_ctrl = cat_ctrl)


[web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-12 Thread Rahul
All,
   I am sorry for my late reply. @Anthony, you are a genius -

Problem 1 in this thread got resolved with  -

db.reguser.email.requires= [IS_NOT_EMPTY(), IS_EMAIL() ,
IS_NOT_IN_DB(db, 'reguser.email')]
db.reguser.unique_code.requires = IS_NOT_IN_DB(db, 'reguser.email')

Problem 3 got resolved with - ( if the limit I wanted is 256kb )
  Field('attach_file','upload', default='',
requires=IS_LENGTH(262144))


I am working on Problem No2 - [Suggested Solution by Anthony below- ]

If it is OK for the images to be publicly accessible, you could upload
them
to the /static folder instead of /uploads -- in that case, once
initially
loaded by the browser, the browser should cache them for subsequent
displays. Otherwise, if you are using the download() function to
download
from the /uploads folder, you could add some logic to the download
function
to have it set the response headers to tell the browser to cache the
images
(i.e., same as static files) -- you could use a URL arg or var as a
flag to
tell the download function to do that.

I think both solutions look good, I am figuring out how to go with
either. Thanks

@Pbreit - I am actually not using Auth to setup this user thing. I've
written my own Auth for custom handling of code. Thanks

Thanks & Regards,

Rahul D (www.flockbird.com) - Currently working on Build Connect a
controlled website for posting updates, projects and socializing
---

On Feb 13, 4:35 am, pbreit  wrote:
> I suggest, if possible, using auth_user as the user table. You can easily
> add fields:http://web2py.com/books/default/chapter/29/9#Customizing-Auth


[web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-12 Thread Rahul
Sorry ... I accidently clicked on Report Span link.. How do I revert
this?


On Feb 13, 4:35 am, pbreit  wrote:
> I suggest, if possible, using auth_user as the user table. You can easily
> add fields:http://web2py.com/books/default/chapter/29/9#Customizing-Auth


[web2py] Create indices from DAL

2012-02-12 Thread Michael Toomim
Here's an improved way to create indices in the DAL. Works only with
postgresql and sqlite.

def create_indices(*fields):
'''
Creates a set of indices if they do not exist
Use like:
   create_indices(db.posts.created_at,
  db.users.first_name,
  etc...)
'''
for field in fields:

table = field.tablename
column = field.name
db = field.db

if db._uri.startswith('sqlite:'):
db.executesql('create index if not exists %s_%s_index on
%s (%s);'
  % (table, column, table, column))
elif db._uri.startswith('postgres:'):
# Our indexes end with "_index", but web2py autogenerates
# one named "_key" for fields created with unique=True.
# So let's check to see if one exists of either form.
index_exists = \
db.executesql("select count(*) from pg_class where
relname='%s_%s_index' or relname='%s_%s_key';"
  % (table, column, table, column))[0][0]
== 1

if not index_exists:
db.executesql('create index %s_%s_index on %s (%s);'
  % (table, column, table, column))
db.commit()

This improves on this one I posted a while back:
  
http://groups.google.com/group/web2py/browse_thread/thread/8f6179915a6df8ee/cb58f509ae0a478d?lnk=gst&q=create+index#cb58f509ae0a478d


[web2py] Re: Dedicated IDE

2012-02-12 Thread Rahul
+1 for Aptana, Eclipse (my personal favorite for all languages) and
ide2py/read2py - looks promising too.

Rahul D

On Feb 13, 6:00 am, Jim Steil  wrote:
> I'm an Aptana user.  Works great for me.
>
>      -Jim
>
> On 2/12/2012 6:08 PM, Bruce Wade wrote:
>
>
>
>
>
>
>
>
>
> > IDE's are good when you are working on large projects, and or
> > on medium to large teams. Also by dedicated IDE I mean more then just
> > typing text. Think more like an environment that can handle all your
> > planing tasks, profiling, design layouts etc but in more of a
> > visual way.
>
> > I am all for vim when I want to do something with a single file
> > however when I am going to be coding all day it becomes a pain to
> > always have to type commands just to edit text etc..
>
> > I also come from a background of game development so I kind of prefer
> > the custom tools that are developed for making them kinds of projects.
>
> > On Sun, Feb 12, 2012 at 3:04 PM, pbreit  > > wrote:
>
> >     You should not be using the web-based editor for anything beyond
> >     quick edits or testing,
>
> >     I always steer people away from IDEs and to just use a good text
> >     editor (for Mac, TextMate) and version control (I like MacHG
> >     better than SourceTree).
>
> > --
> > --
> > Regards,
> > Bruce Wade
> >http://ca.linkedin.com/in/brucelwade
> >http://www.wadecybertech.com
> >http://www.warplydesigned.com
> >http://www.fitnessfriendsfinder.com
>
> > No virus found in this message.
> > Checked by AVG -www.avg.com
> > Version: 2012.0.1913 / Virus Database: 2112/4806 - Release Date: 02/12/12
>
> --
> Jim Steil
> VP of Information Technology
> Quality Liquid Feeds, Inc.
> 608.935.2345 office
> 608.341.9896 cell


[web2py] Mixing Internationalisation and Business Idiom

2012-02-12 Thread chris_g
I have a conceptual issue about how I design some aspects of an
application.
I need to make my app customisable with respect to business idiom and
in the longer term, I would like my app to embrace
internationalisation.

I'm curious to know if anyone has ever tackled the issue of business
idiom in a systematic way like internationalisation.
AN example would be if I deploy my app at three different
multinational companies.


CompanyA likes to call their stores "Stores".

CompanyB likes to call their stores "Sites".

CompanyC likes to call their stores "Shops".


I'd ideally like to do something like have an en-gb.py , en-us.py and
then also have a 2ndary set of idiomatic translations such as en-
companya.py en-companyb.py and en-companyc.py .

Of course this isn't standard practice and I would have to write my
own custom version of T . I'm curious to find out what solutions other
developers may have had for this kind of problem.




[web2py] How to Change the date format

2012-02-12 Thread Sanjeet Kumar
Hi to all,

I want to change the date format during the insertion in database
default is YYY-MM-DD but i want to insert in database by using the DD-
MM- and Month should be in the 'jan' format .

Please help me


[web2py] Problem with update

2012-02-12 Thread weheh
I'm running Version 1.99.2.

# model
db.define_table('test',
 
Field('user_id',db.auth_user,requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))),
  Field('session_id',default=resposne.session_id),
...
)


# at some point, the following would be executed:

test_id=db.test.insert(
  user_id=auth.user.id if auth.is_logged_in() else None,
)


# in the index controller there is the following test condition
def index():
...
if auth.is_logged_in():
db((db.test.user_id==None) &
(db.test.session_id==response.session_id)).update(user_id=auth.user.id,session_id=None)

...

Here's the problem. db.test.user_id is getting properly updated to the
logged in auth.user.id. However, session_id is not getting set to
None. Anybody see what I could be doing wrong?


Re: [web2py] How to Change the date format

2012-02-12 Thread Manuele Pesenti

Il 13/02/2012 08:40, Sanjeet Kumar ha scritto:

Hi to all,

I want to change the date format during the insertion in database
default is YYY-MM-DD but i want to insert in database by using the DD-
MM- and Month should be in the 'jan' format .

Please help me

have a look here

http://web2py.com/books/default/chapter/29/7

and here

http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior

:)

M.