[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-17 Thread annet

> This error makes sense, promobox is an empty list and
> any attempt to index it (as in promobox[0]) will give the error.
> Note that is different from the error in your first post.

Yes, but I had hoped that this function:

@auth.requires_login()
def index():
if auth.user.account!='1':
redirect(URL(r=request,c='view',f='index'))
else:
response.functionname='Business Card'
return dict()

.. and this view:

{{if 'promobox' in globals():}}
  
{{if promobox[0].kop:}}
  {{=promobox[0].kop}}
{{pass}}
{{=XML(promobox[0].tekst)}}
   
{{pass}}

.. would, in case of re-using views, prevent me from returning empty
lists to the view for every variable in the view I do not assign a
value to in the function.

I solved the problem using the last function, but I was curious why
the function and view in the first post result in: TypeError:
'function' object is unsubscriptable.


Kind regards,

Annet.


[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-17 Thread ron_m
As a test remove the promobox=box item from the dict returned from the
controller and put this

{{print globals().keys()}}

in the view file before the failure and check the output on the
console. This is also assuming you are running in developer mode with
the rocket web server.

You will likely find 'promobox' in the list printed out, probably
defined somewhere in the module or model files. The assignment
promobox=box inside the dict constructor in the controller is covering
up an already existing global dictionary item that has key 'promobox'.
It will also likely be a function definition. This causes the if
'promobox' in globals(): to always pass the test as true and an
attempt to take the index gives you the error.

On Oct 17, 12:16 am, annet  wrote:
> > This error makes sense, promobox is an empty list and
> > any attempt to index it (as in promobox[0]) will give the error.
> > Note that is different from the error in your first post.
>
> Yes, but I had hoped that this function:
>
> @auth.requires_login()
> def index():
>     if auth.user.account!='1':
>         redirect(URL(r=request,c='view',f='index'))
>     else:
>         response.functionname='Business Card'
>         return dict()
>
> .. and this view:
>
> {{if 'promobox' in globals():}}
>   
>     {{if promobox[0].kop:}}
>       {{=promobox[0].kop}}
>     {{pass}}
>     {{=XML(promobox[0].tekst)}}
>    
> {{pass}}
>
> .. would, in case of re-using views, prevent me from returning empty
> lists to the view for every variable in the view I do not assign a
> value to in the function.
>
> I solved the problem using the last function, but I was curious why
> the function and view in the first post result in: TypeError:
> 'function' object is unsubscriptable.
>
> Kind regards,
>
> Annet.


[web2py] Re: make two queries into one [need help]

2010-10-17 Thread ron_m
After rereading the posts I realize you might be running the db calls
in the view so the controller comment would be incorrect. Bottom line,
there is no data to display from what you are telling me about the
result of the last test. Is it possible to check the database and look
at the data in the tables for a particular product id you are using
for testing to be sure all the foreign keys are in place in the
related tables. What environment are you running on? OS, Python
version, database used? It is difficult to figure out the problem
without seeing more of the application.

Ron

On Oct 16, 11:02 am, Andrew Evans  wrote:
> Hello ty for the continued help. I did as you suggested and I saw the table
> headers but none of the Data. I tried the function you suggested also.
>
> Does that mean its a controller problem
>
> Any ideas
>
> *cheers
>
> On Sat, Oct 16, 2010 at 12:14 AM, ron_m  wrote:
> > A couple of things
>
> > Put this in for the view html file temporarily
>
> > {{extend 'layout.html'}}
> > 
> > {{=H2('Results')}}
> > {{=SQLTABLE(user_products,
> >   headers='fieldname:capitalize',
> >   truncate=100)
> > }}
>
> > and you should see a nicely formatted table of the results of the
> > query with the column names in the table header.
>
> > This will prove whether or not you are getting data in user_products.
> > If you see the expected results in the table then it is a view
> > problem. If the table is blank it is a controller problem.
>
> > Did you put a {{pass}} line at the point where the {{for row in
> > user_products:}} iteration loop should end? Indentation follows HTML
> > not Python rules in the {{}} code segments so pass is used to signal
> > the end of a block in this case "for".
>
> >http://web2py.com/book/default/chapter/05
>
> > Ron
>
> > On Oct 15, 11:29 pm, Andrew Evans  wrote:
> > > Hi ty for replying to my problem but I am a bit confused. I tried doing
> > the
> > > query you suggested and tried doing it another way
>
> > > it seems my loop is never executed cause what appears there is a blank
> > page.
>
> > > Not sure what I am doing wrong
>
> > > Those are the two I tried
>
> > > def indv_product():
> > >     this_page = request.args(0)
>
> > >     user_products = db((db.product.id == this_page) &
> > > (db.product_extended.product == this_page) & (db.user_extended.userinfo
> > ==
> > > db.product.userinfo)).select()
> > >     return dict(user_products=user_products)
>
> > > def indv_product():
> > >     this_page = request.args(0)
> > >     user_products = db((db.product.id == this_page) & (db.product.id ==
> > > db.product_extended.product) & (db.product.userinfo ==
> > > db.user_extended.userinfo)).select()
> > >     return dict(user_products=user_products)
>
> > > But it seems the loop doesn't work any idea
>
> > > this is what I am using
>
> > > {{for row in user_products:}}
>
> > > and an example of how I am using row
> > >  > > alt="{{=row.product_name}}" width="400" height="425"
> > > />{{=row.description}}
>
> > > The html doesn't even appear in the view source of my browser so I am
> > doing
> > > something wrong
>
> > > *cheers
>
>


[web2py] Re: Packaging web2py for Debian

2010-10-17 Thread José L .


On 16 oct, 15:40, LightDot  wrote:
> I have written an internal Fedora RPM for web2py a while ago and tried
> to follow Fedora's packaging guidelines. I'm a RHEL/CentOS sysadmin
> and take care of quite a few hosting servers, my main objective was to
> easily use it on our RHEL/CentOS servers with Cherokee.
>

Great

> I don't want to "steal" the Debian related thread, but I'd like to
> comment and discuss some of the proposed changes since they are
> relevant to any OS packages, not only Debian.
>


Sure

> I found the following difficulties/questions when I created our RPMs:
>
> - web2py has a very rapid release cycle. That makes it difficult to
> get it in EPEL repository properly (for RHEL and CentOS), perhaps
> RPMFusion would be a better choice. If it gets in Fedora directly,
> CentOS and RHEL admins won't have optimal access to the package
> - I guess one should take a "stable" release and package it, than
> follow the changelog and make a new package every month or so. A new
> release every couple of days isn't going to work with distribution
> repositories, since packages go trough a prolonged testing phase.
> Backwards compatibility helps (great!) but still, one release per
> month is probably the best one can hope for


I totally agree


>
> - it must be possible to use a separate applications folder (in a sane
> manner, perhaps as ~/.web2py/applications in a user home folder and
> other places)
> - several locations of applications folder should coexist and get used
> by different end users, depending on how one starts web2py


We depend on Massimo and other web2py developers to achieve this.
Massimo said he's working on it. So we should think this is going to
happen.

> - these application folders belong to users, RPM doesn't touch them
>

Of course



> - does admin count as a regular application?

I think it does


- How to update it?

With its package
> Should
> there be a single admin app per physical server?

I think so

>How to protect it and
> how to separate users?


One option would be adding a new system group (or using www-data) and
all users in that group will have the same access.
Another option would be symlinking the only admin application to the
home directory of the user, so any user would be able to run it in his
own environment.


> How to adjust this for different web servers?

In my opinion, we have to options: not do it, and giving examples and
documentation on how to do it. Or doing it with different packages for
every server.

> - how to disable updating and version checking from a web interface?
> It shouldn't happen when using an RPM (or .deb). I guess one could
> remove this functionality with a patch


Yes


> - all relevant web2py .py files should be compiled as .pyc at
> packaging stage since end users won't be able to achieve this. It also
> makes RPM upgrade and removal stages cleaner


Not in Debian packages. The package should contain only the .py files.
In Debian and its derivatives, when a python package in installed, it
will compile the .py files with the user Python version, and place
the .pyc files in different directories depending on the user python
version.



> - RPM (or .deb, etc.) should not interfere with hosting customers who
> upload their own complete web2py

Of course, but I don't think this is a problem if we don't set it up
with a web server.

> - should there be a startup script that starts web2py with internal
> server or...? This isn't going to get used in an enterprise
> environment


In the raw version (without web server setup) I think it shouldn't. it
should be started manually by the user.



> - how to deal with the choice of Apache, Cherokee, etc.
>

Not doing it at all, or doing it with different packages.


> I also don't see why gluon and other core files should be separated
> one from another, perhaps I'm missing something. Just the
> applications, documentation and perhaps the contributed scripts must
> be separated from the core/gluon. And what should be done with the
> admin app?
>
> I packaged web2py as:
> web2py-core
> we2py-admin
> web2py-examples
>


I think this is a very smart division. I'd only add a python-web2py
metapackage with dependencies on all of the above. So if the user
installs python-web2py, all the packages are automagically installed.



> The applications folder issues remained. Admin app was enabled for
> server administrator only, overwritten with upgrades. Example apps
> were overwritten with upgrades. The RPMs were closely linked with
> Cherokee but that was just for our internal use. I also made a
> separate README, provided sample scripts (conf, xml, etc.) for Apache
> mod_wsgi and Cherokee with uwsgi and let the admin set it up with a
> web server of his choice.
>
> I'd be glad to hear any comments and could maintain the RPM part of
> packaging if the issues get ironed out. Or I can just provide my .spec
> files to give a head start to a future RPM maintainer, it really
> doesn't matter.



I'd l

[web2py] Re: web2py 1.87.3 is OUT

2010-10-17 Thread Zphen
I saw that the relevant operations are performed on first run in
widget.console(), so I suggest we execute this function in the script
too:

--- setup-web2py-ubuntu.sh  2010-10-13 01:22:51.0 +1100
+++ setup-web2py-ubuntu.sh.new  2010-10-17 22:49:52.258486749 +1100
@@ -163,5 +163,6 @@

 /etc/init.d/apache2 restart
 cd /home/www-data/web2py
+sudo -u www-data python -c "from gluon.widget import console;
console();"
 sudo -u www-data python -c "from gluon.main import save_password;
save_password(raw_input('admin password: '),443)"
 echo "done!"

Simon


On Oct 17, 1:58 am, mdipierro  wrote:
> How do you suggest change the installation script to get this done
> automatically?
>
> On Oct 15, 3:38 pm, Zphen  wrote:
>
> > > I upgraded to version 1.87.3, the problem I am facing is that I cannot
> > > upload and install packed applications via the admin web interface.
> > > The flash message: unable to install application "init".
>
> > I had the same problem when setting up an Ubuntu 10.04 AMI with web2py
> > 1.87.3 on EC2 yesterday using the setup-web2py-ubuntu.sh install
> > script as described in the book. Fortunately the first solution that I
> > tried solved it for me, which was from the WebFaction Forum 
> > athttp://forum.webfaction.com/viewtopic.php?pid=18401
>
> > mkdir web2py/deposit
> > touch web2py/applications/__init__.py
>
> > Simon
>
>


[web2py] Default Authentication has problem

2010-10-17 Thread Amit Ambardekar
I am some public page. Not [app]/default/index

And when I log in. I am supposed to be redirected to that page not
home page. It always redirects to home page. How to set the referrer?

Amit


Re: [web2py] Re: 2 problems, taskbar icon and windows service

2010-10-17 Thread Tom Atkins
I have the same problem as Youngblood: I've just tried to install web2py as
a windows service and get the error below (Windows 7 32bit, Python 2.7,
pywin installed, latest web2py source from mercurial):

c:\path\to\web2py>python web2py.py -W install
No handlers could be found for logger "web2py"
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.87.3 (2010-10-13 09:45:16)
Database drivers available: SQLite3
Starting hardcron...
WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking
Traceback (most recent call last):
  File "web2py.py", line 23, in 
gluon.widget.start(cron=True)
  File "c:\path\to\web2py\gluon\widget.py", line 787, in
 start
web2py_windows_service_handler(['', options.winservice],
NameError: global name 'web2py_windows_service_handler' is not defined

any suggestions gratefully received.


On 12 October 2010 19:17, mdipierro  wrote:

> If you run from source, do you Mark hammond win32 extensions
> insatlled?
>
> On Oct 12, 12:49 pm, Youngblood  wrote:
> > I am running web2py from source (version 1.87.2) in a windows os. When
> > I try to start web2py with the -t option I get the following error:
> >
> > Traceback (most recent call last):
> >   File "web2py.py", line 23, in 
> > gluon.widget.start(cron=True)
> >   File "C:\web2py\gluon\widget.py", line 826, in start
> > master = web2pyDialog(root, options)
> >   File "C:\web2py\gluon\widget.py", line 266, in __init__
> > self.tb = contrib.taskbar_widget.TaskBarIcon()
> > NameError: global name 'contrib' is not defined
> >
> > I've also tried to install web2py as a service, but when I run
> > "python.exe web2py.py -W install" I get the following error:
> >
> > Traceback (most recent call last):
> >   File "web2py.py", line 23, in 
> > gluon.widget.start(cron=True)
> >   File "C:\web2py\gluon\widget.py", line 787, in start
> > web2py_windows_service_handler(['', options.winservice],
> > NameError: global name 'web2py_windows_service_handler' is not defined
> >
> > Is there a solution to these 2 problems?
>


[web2py] Re: Default Authentication has problem

2010-10-17 Thread Martin.Mulone
auth.settings.login_next = URL('index')

http://web2py.com/book/default/chapter/08?search=login_next

On 17 oct, 09:03, Amit Ambardekar  wrote:
> I am some public page. Not [app]/default/index
>
> And when I log in. I am supposed to be redirected to that page not
> home page. It always redirects to home page. How to set the referrer?
>
> Amit


[web2py] Re: Databases problem

2010-10-17 Thread Neveen Adel
Dear mdipierro,

I faced the previous problem again when i tried to deploy the
application into another machine has old version of my application,

so i followed the previous steps , in sql log

ALTER TABLE member ADD degree INT;
faked!

then

ALTER TABLE member DROP COLUMN degree;


so by this it is created permanently and then dropped again.


Could u please tell me how can i fix this problem?


Thanks in Advance






[web2py] SQLFORM.factory and autocomplete widget

2010-10-17 Thread david.waldrop
I have a form created with SQLFORM.factory containing a single field

addform = SQLFORM.factory(Field('item_cat'))

Is there a way to use the autocomplete widget.  I have searched and
seen examples where I set the widget in the model, but do cannot find
an example of how to associate the autocomplete widget with a field
when using SQLFORM.factory.

I did get it to work in the model bu using something like the
following: db.itemcat.cat_ref.widget =
SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)

I am sure someone has done this and very much would love to see an
example.


[web2py] Re: 2 problems, taskbar icon and windows service

2010-10-17 Thread mdipierro
you need to install mark hammond win32 extensions

On Oct 17, 7:13 am, Tom Atkins  wrote:
> I have the same problem as Youngblood: I've just tried to install web2py as
> a windows service and get the error below (Windows 7 32bit, Python 2.7,
> pywin installed, latest web2py source from mercurial):
>
> c:\path\to\web2py>python web2py.py -W install
> No handlers could be found for logger "web2py"
> web2py Enterprise Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2010
> Version 1.87.3 (2010-10-13 09:45:16)
> Database drivers available: SQLite3
> Starting hardcron...
> WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking
> Traceback (most recent call last):
>   File "web2py.py", line 23, in 
>     gluon.widget.start(cron=True)
>   File "c:\path\to\web2py\gluon\widget.py", line 787, in
>  start
>     web2py_windows_service_handler(['', options.winservice],
> NameError: global name 'web2py_windows_service_handler' is not defined
>
> any suggestions gratefully received.
>
> On 12 October 2010 19:17, mdipierro  wrote:
>
> > If you run from source, do you Mark hammond win32 extensions
> > insatlled?
>
> > On Oct 12, 12:49 pm, Youngblood  wrote:
> > > I am running web2py from source (version 1.87.2) in a windows os. When
> > > I try to start web2py with the -t option I get the following error:
>
> > > Traceback (most recent call last):
> > >   File "web2py.py", line 23, in 
> > >     gluon.widget.start(cron=True)
> > >   File "C:\web2py\gluon\widget.py", line 826, in start
> > >     master = web2pyDialog(root, options)
> > >   File "C:\web2py\gluon\widget.py", line 266, in __init__
> > >     self.tb = contrib.taskbar_widget.TaskBarIcon()
> > > NameError: global name 'contrib' is not defined
>
> > > I've also tried to install web2py as a service, but when I run
> > > "python.exe web2py.py -W install" I get the following error:
>
> > > Traceback (most recent call last):
> > >   File "web2py.py", line 23, in 
> > >     gluon.widget.start(cron=True)
> > >   File "C:\web2py\gluon\widget.py", line 787, in start
> > >     web2py_windows_service_handler(['', options.winservice],
> > > NameError: global name 'web2py_windows_service_handler' is not defined
>
> > > Is there a solution to these 2 problems?
>
>


[web2py] Crud validation

2010-10-17 Thread oneroler
I have the following tables defined and want to make sure that when I
use crud.create(db.firmstrat) I stop duplicate strategies for the same
firm.  What I have below works when firmstrat.firm_id is writable, but
not when writable=False.  It looks like the request.vars.firm_id =
none when the field isn't writable for the crud form.  Is there
another way to access the information?  Other thing I have tried that
work are request.args(0) but I'm worried this may be an issue later if
I'm trying to write to the table when args(0) isn't the firm_id.

def show():
this_firm = db.firm(request.args(0)) or redirect(URL('index'))
db.firmstrat.firm_id.default = this_firm.id
form = crud.create(db.firmstrat)
strats = db(db.firmstrat.firm_id==this_firm.id).select()
return dict(strats=strats, firm=this_firm, form=form)

db.define_table('firm',
Field('name', unique=True, required=True))

db.define_table('lkfirmstrat',
Field('name', unique=True))

db.define_table('firmstrat',
Field('firm_id', db.firm, readable=False, writable=False),
Field('strat_id',db.lkfirmstrat))

check = db(db.firmstrat.firm_id==request.vars.firm_id)
db.firmstrat.strat_id.requires = IS_IN_DB(db, db.lkfirmstrat.id, '%
(name)s',
   _and=IS_NOT_IN_DB(check,
'firmstrat.strat_id'))

Thanks,
Sam


[web2py] Re: web2py 1.87.3 is OUT

2010-10-17 Thread mart
Would writing an installer be useful? there are many possibilities,
and not that huge of a deal to get something out there and that can be
expanded with richer/better features with time... Besides, the
benefits are well worth it...

1) give the user options @ install/update/upgrade time is always a
good thing
   * upgrading without overwriting existing application is often
desirable and is always appreciated from the user perspective where
doing it through an installer (which is viewed as the competent
authority by many) does in fact inspire confidence, specially with the
more novice.
   * updates (as opposed to upgrades) can be much quicker and more
seamless
   * gives the user a good sense cmd & control when provided with the
choice of well targeted configuration options (reminds me of the story
about WHY the Duncan Hines people decided that adding an egg to the
recipe was better than not where, previously they had a much better
and easier product to use (just add water)... because the mommies
needed to feel better about baking a cake)
   * sometimes, all it takes to fix a problem either introduced by the
software provider or a problem cause by well meaning but accident
prone user, is with an installer with a nice big blue check box
labeled "yes, I just did something silly and I and would like the
installer to fix my screw up?" - something I have used MANY times
before and was glad for the chance to choose "fix" and not "re-
install" (or upgrade)
   * many users feel better looked after with an installer that tells
him/her what is hapening (i.e. "oh, it backs up my previous install
and I can revert! :)" )
   * the user can send the software provider known logs back to the
provider about a particular configuration with things an installer can
record (where it was installed, OS, disk space, previous version, ...
what is needed)
   * the list goes on...

2) * from the distribution side, this provides a very good first
contact with the user... you rarely get more of the users attention
then @ install time (unless you're that big of a fan that you follow
threads on google groups ;))
   * with good use of such tings as well chosen panels, you get this
"free of charge publicity time slot" - one on one time with the user
(specially new ones),
   * give the provider (in this case Massimo) an open window to reach
his/her users at chosen times (i.e. @ update time, the user chooses
"update form the web",  where Massimo can have messages displayed,
flashing panels with target information, why not take the opportunity
to survey the users (Eg. how well know is it, the number if people who
install web2py? do they get stumped and discouraged? does everybody
know about the web2py google group?, I would assume that there are
more of the "won't look any further than the install" type of people
out there, than there are of the "keep at this until it works" type of
people...
   * there are many more good reasons to go the install way... more
than I could possibly come up here with this quick blurb... besides,
it doesn't mean you don't keep the current install/update/upgrade
methods you have, just means you provide more opportunities...

anyways, just my cents and would be glad to help if needed

Mart :)

On Oct 17, 7:56 am, Zphen  wrote:
> I saw that the relevant operations are performed on first run in
> widget.console(), so I suggest we execute this function in the script
> too:
>
> --- setup-web2py-ubuntu.sh      2010-10-13 01:22:51.0 +1100
> +++ setup-web2py-ubuntu.sh.new  2010-10-17 22:49:52.258486749 +1100
> @@ -163,5 +163,6 @@
>
>  /etc/init.d/apache2 restart
>  cd /home/www-data/web2py
> +sudo -u www-data python -c "from gluon.widget import console;
> console();"
>  sudo -u www-data python -c "from gluon.main import save_password;
> save_password(raw_input('admin password: '),443)"
>  echo "done!"
>
> Simon
>
> On Oct 17, 1:58 am, mdipierro  wrote:
>
> > How do you suggest change the installation script to get this done
> > automatically?
>
> > On Oct 15, 3:38 pm, Zphen  wrote:
>
> > > > I upgraded to version 1.87.3, the problem I am facing is that I cannot
> > > > upload and install packed applications via the admin web interface.
> > > > The flash message: unable to install application "init".
>
> > > I had the same problem when setting up an Ubuntu 10.04 AMI with web2py
> > > 1.87.3 on EC2 yesterday using the setup-web2py-ubuntu.sh install
> > > script as described in the book. Fortunately the first solution that I
> > > tried solved it for me, which was from the WebFaction Forum 
> > > athttp://forum.webfaction.com/viewtopic.php?pid=18401
>
> > > mkdir web2py/deposit
> > > touch web2py/applications/__init__.py
>
> > > Simon
>
>


[web2py] Translation of the navbar

2010-10-17 Thread Mr. Electronic
Hi

I trying to create my first web2py web site with login and because the
page will be in danish. I'm working with the languages files. The only
thing I have not been able to translate at the moment is the Welcome
in the navbar. The rest logout, login, profile, password, etc.
translates without any problems at all but I can't translate the
Welcome.

The word Welcome does not show up in the languages files, I have tried
to add the line 'Welcome':'Velkommen' but that didn't solve the
problem.

Is the Welcome missing a T('Welcome') in the auth module?

Br.
Mr. Electronic


[web2py] Re: Translation of the navbar

2010-10-17 Thread mdipierro
did you try edit the layout and replace it with

{{=auth.navbar(prefix=T("Welcome")}}

On Oct 17, 11:55 am, "Mr. Electronic"  wrote:
> Hi
>
> I trying to create my first web2py web site with login and because the
> page will be in danish. I'm working with the languages files. The only
> thing I have not been able to translate at the moment is the Welcome
> in the navbar. The rest logout, login, profile, password, etc.
> translates without any problems at all but I can't translate the
> Welcome.
>
> The word Welcome does not show up in the languages files, I have tried
> to add the line 'Welcome':'Velkommen' but that didn't solve the
> problem.
>
> Is the Welcome missing a T('Welcome') in the auth module?
>
> Br.
> Mr. Electronic


[web2py] Re: Simple self-reference doesn't work; probable noob error...

2010-10-17 Thread BigBaaadBob
I realized at the grocery store last night that entering 0 (which I
assume is an invalid ID) instead of nothing (equal to '') would
resolve the problem because:

>>> x = int('')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: invalid literal for int() with base 10: ''

But what I don't understand is why the examples in the book don't have
that problem:

http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases

And, of course, I'm too noob to know what the code web2py code should
actually do.

On Oct 16, 3:54 pm, mdipierro  wrote:
> this should now be default behavior in trunk.No need for
> db.test.referes_to.requires=IS_EMPTY_OR(IS_IN_DB(db,'test.refers_to'))
>
> please check it.
>

I still get pretty much the same exception:

Traceback (most recent call last):
  File "/home/witr/Desktop/web2pytrunk/gluon/restricted.py", line 188,
in restricted
exec ccode in environment
  File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
default.py", line 59, in 
  File "/home/witr/Desktop/web2pytrunk/gluon/globals.py", line 96, in

self._caller = lambda f: f()
  File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
default.py", line 12, in create
form = crud.create(db.test, next = URL('index'))
  File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2864, in
create
deletable=False,
  File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2807, in
update
hideerror=self.settings.hideerror):
  File "/home/witr/Desktop/web2pytrunk/gluon/sqlhtml.py", line 1074,
in accepts
fields[fieldname] = int(fields[fieldname])
ValueError: invalid literal for int() with base 10: ''


[web2py] Re: Translation of the navbar

2010-10-17 Thread Mr. Electronic
Hi

Thanks, that solved the problem. Still a beginner in web2py.

Br.
Mr. Electronic

On 17 Okt., 18:59, mdipierro  wrote:
> did you try edit the layout and replace it with
>
> {{=auth.navbar(prefix=T("Welcome")}}
>
> On Oct 17, 11:55 am, "Mr. Electronic"  wrote:
>
> > Hi
>
> > I trying to create my first web2py web site with login and because the
> > page will be in danish. I'm working with the languages files. The only
> > thing I have not been able to translate at the moment is the Welcome
> > in the navbar. The rest logout, login, profile, password, etc.
> > translates without any problems at all but I can't translate the
> > Welcome.
>
> > The word Welcome does not show up in the languages files, I have tried
> > to add the line 'Welcome':'Velkommen' but that didn't solve the
> > problem.
>
> > Is the Welcome missing a T('Welcome') in the auth module?
>
> > Br.
> > Mr. Electronic
>
>


[web2py] Re: Simple self-reference doesn't work; probable noob error...

2010-10-17 Thread mdipierro
Somehow you got a string in a field that is supposed to be a
reference. My guess is that you inserted the data and than you changed
the field type.

On Oct 17, 11:59 am, BigBaaadBob  wrote:
> I realized at the grocery store last night that entering 0 (which I
> assume is an invalid ID) instead of nothing (equal to '') would
> resolve the problem because:
>
> >>> x = int('')
>
> Traceback (most recent call last):
>   File "", line 1, in 
> ValueError: invalid literal for int() with base 10: ''
>
> But what I don't understand is why the examples in the book don't have
> that problem:
>
> http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases
>
> And, of course, I'm too noob to know what the code web2py code should
> actually do.
>
> On Oct 16, 3:54 pm, mdipierro  wrote:
>
> > this should now be default behavior in trunk.No need for
> > db.test.referes_to.requires=IS_EMPTY_OR(IS_IN_DB(db,'test.refers_to'))
>
> > please check it.
>
> I still get pretty much the same exception:
>
> Traceback (most recent call last):
>   File "/home/witr/Desktop/web2pytrunk/gluon/restricted.py", line 188,
> in restricted
>     exec ccode in environment
>   File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
> default.py", line 59, in 
>   File "/home/witr/Desktop/web2pytrunk/gluon/globals.py", line 96, in
> 
>     self._caller = lambda f: f()
>   File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
> default.py", line 12, in create
>     form = crud.create(db.test, next = URL('index'))
>   File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2864, in
> create
>     deletable=False,
>   File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2807, in
> update
>     hideerror=self.settings.hideerror):
>   File "/home/witr/Desktop/web2pytrunk/gluon/sqlhtml.py", line 1074,
> in accepts
>     fields[fieldname] = int(fields[fieldname])
> ValueError: invalid literal for int() with base 10: ''


Re: [web2py] Re: 2 problems, taskbar icon and windows service

2010-10-17 Thread Tom Atkins
Thanks for the quick reply Massimo.  I had installed the
win32 extensions already.  But just tried again to be sure and noticed an
error at the end of the installation process that I didn't spot before.  So
you are correct - lack of properly installed win32 extensions is the
problem.

The error I got is described here:
http://sourceforge.net/tracker/index.php?func=detail&aid=3084013&group_id=78018&atid=551954

I'm looking for where the fix is and will update here if I find out any
more.

Tip for others: installing win32 extensions for Python 2.7 is a pain! You
need a lot of windows SDK stuff to get anywhere).  When I previously
installed the extensions for Python 2.5 it all went fine... that'll teach me
to upgade (or to be using Windows)!

On 17 October 2010 16:23, mdipierro  wrote:

> you need to install mark hammond win32 extensions
>
> On Oct 17, 7:13 am, Tom Atkins  wrote:
> > I have the same problem as Youngblood: I've just tried to install web2py
> as
> > a windows service and get the error below (Windows 7 32bit, Python 2.7,
> > pywin installed, latest web2py source from mercurial):
> >
> > c:\path\to\web2py>python web2py.py -W install
> > No handlers could be found for logger "web2py"
> > web2py Enterprise Web Framework
> > Created by Massimo Di Pierro, Copyright 2007-2010
> > Version 1.87.3 (2010-10-13 09:45:16)
> > Database drivers available: SQLite3
> > Starting hardcron...
> > WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking
> > Traceback (most recent call last):
> >   File "web2py.py", line 23, in 
> > gluon.widget.start(cron=True)
> >   File "c:\path\to\web2py\gluon\widget.py", line 787, in
> >  start
> > web2py_windows_service_handler(['', options.winservice],
> > NameError: global name 'web2py_windows_service_handler' is not defined
> >
> > any suggestions gratefully received.
>


Re: [web2py] Re: make two queries into one [need help]

2010-10-17 Thread Andrew Evans
what more of the application do you need to see, which parts?

OS is Debian Lenny, Python 2.5 and the database is the default with web2py
SQLite I believe.

Will post my controller and views maybe that will help solve this

Controller

###Display.py###
###
# Display Indiviual Product
###

#def indv_product():
#this_page = request.args(0)

#user_products = db((db.product.id == this_page) &
(db.product_extended.product == this_page) & #(db.user_extended.userinfo ==
db.product.userinfo)).select()
#return dict(user_products=user_products)


def indv_product():
this_page = request.args(0)
user_products = db((db.product.id == this_page) & (db.product.id ==
db.product_extended.product) & (db.product.userinfo ==
db.user_extended.userinfo)).select()
#product_e=db(db.product_extended.product ==
this_page).select(db.product_extended.ALL)
return dict(user_products=user_products)


This is my view index.html where I pass args to where I am calling the
function... I never posted the whole html file

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

and here is the is the indv_ptrdouct.html

{{for row in user_products:}}

and example of data


 
{{=row.logo}}
 

{{pass}}

You can see the site @ www.em-ecommerce.com/Working/display/index to see
whats happening

*cheers


Andrew


On Sun, Oct 17, 2010 at 1:58 AM, ron_m  wrote:

> After rereading the posts I realize you might be running the db calls
> in the view so the controller comment would be incorrect. Bottom line,
> there is no data to display from what you are telling me about the
> result of the last test. Is it possible to check the database and look
> at the data in the tables for a particular product id you are using
> for testing to be sure all the foreign keys are in place in the
> related tables. What environment are you running on? OS, Python
> version, database used? It is difficult to figure out the problem
> without seeing more of the application.
>
> Ron
>
> On Oct 16, 11:02 am, Andrew Evans  wrote:
> > Hello ty for the continued help. I did as you suggested and I saw the
> table
> > headers but none of the Data. I tried the function you suggested also.
> >
> > Does that mean its a controller problem
> >
> > Any ideas
> >
> > *cheers
> >
> > On Sat, Oct 16, 2010 at 12:14 AM, ron_m  wrote:
> > > A couple of things
> >
> > > Put this in for the view html file temporarily
> >
> > > {{extend 'layout.html'}}
> > > 
> > > {{=H2('Results')}}
> > > {{=SQLTABLE(user_products,
> > >   headers='fieldname:capitalize',
> > >   truncate=100)
> > > }}
> >
> > > and you should see a nicely formatted table of the results of the
> > > query with the column names in the table header.
> >
> > > This will prove whether or not you are getting data in user_products.
> > > If you see the expected results in the table then it is a view
> > > problem. If the table is blank it is a controller problem.
> >
> > > Did you put a {{pass}} line at the point where the {{for row in
> > > user_products:}} iteration loop should end? Indentation follows HTML
> > > not Python rules in the {{}} code segments so pass is used to signal
> > > the end of a block in this case "for".
> >
> > >http://web2py.com/book/default/chapter/05
> >
> > > Ron
> >
> > > On Oct 15, 11:29 pm, Andrew Evans  wrote:
> > > > Hi ty for replying to my problem but I am a bit confused. I tried
> doing
> > > the
> > > > query you suggested and tried doing it another way
> >
> > > > it seems my loop is never executed cause what appears there is a
> blank
> > > page.
> >
> > > > Not sure what I am doing wrong
> >
> > > > Those are the two I tried
> >
> > > > def indv_product():
> > > > this_page = request.args(0)
> >
> > > > user_products = db((db.product.id == this_page) &
> > > > (db.product_extended.product == this_page) &
> (db.user_extended.userinfo
> > > ==
> > > > db.product.userinfo)).select()
> > > > return dict(user_products=user_products)
> >
> > > > def indv_product():
> > > > this_page = request.args(0)
> > > > user_products = db((db.product.id == this_page) & (db.product.id==
> > > > db.product_extended.product) & (db.product.userinfo ==
> > > > db.user_extended.userinfo)).select()
> > > > return dict(user_products=user_products)
> >
> > > > But it seems the loop doesn't work any idea
> >
> > > > this is what I am using
> >
> > > > {{for row in user_products:}}
> >
> > > > and an example of how I am using row
> > > >  > > > alt="{{=row.product_name}}" width="400" height="425"
> > > > />{{=row.description}}
> >
> > > > The html doesn't even appear in the view source of my browser so I am
> > > doing
> > > > something wrong
> >
> > > > *cheers
> >
> >
>


[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread david.waldrop
I have now tried this

addform =
SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
db.cat.name, id_field=db.cat.id) )

but it doesn't work either.

On Oct 17, 10:58 am, "david.waldrop"  wrote:
> I have a form created with SQLFORM.factory containing a single field
>
>     addform = SQLFORM.factory(Field('item_cat'))
>
> Is there a way to use the autocomplete widget.  I have searched and
> seen examples where I set the widget in the model, but do cannot find
> an example of how to associate the autocomplete widget with a field
> when using SQLFORM.factory.
>
> I did get it to work in the model bu using something like the
> following: db.itemcat.cat_ref.widget =
> SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> I am sure someone has done this and very much would love to see an
> example.


[web2py] Re: Default Authentication has problem

2010-10-17 Thread Amit Ambardekar
Found answer

set _next parameter

Amit

On Sun, Oct 17, 2010 at 5:03 AM, Amit Ambardekar  wrote:

> I am some public page. Not [app]/default/index
>
> And when I log in. I am supposed to be redirected to that page not
> home page. It always redirects to home page. How to set the referrer?
>
> Amit


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
Logovote upload still not working. Ticket issued when upload button is
clicked.

On Oct 14, 12:32 pm, Bruno Rocha  wrote:
> One more time we could use reddishhttp://web2py.appspot.com/with some
> modifications.
>
> 2010/10/14 Jonathan Lundell 
>
>
>
> > On Oct 14, 2010, at 8:52 AM, Bruno Rocha wrote:
>
> > I am working to have ordering options [ number of votes - date submitted ]
> > I will hide the name of the voters, and show only the vote counter
> > Include a box for comment on every logo
> > and possibility to the user for edit or delete uploades logos.
>
> > Voting is an interesting problem. Since this is something of an informal
> > beauty contest, it can be fairly casual, but done right, it could be a
> > useful plugin.
>
> > One refinement that would be useful in such a plugin is to allow voters to
> > rank their choices, or otherwise express something more than a single vote
> > for a single candidate.
>
> > At the moment, #8 and #17 have one vote each. But it's reasonable to assume
> > that those voters would also like #5, on which 8 & 17 are based. I'm partial
> > to my own design, but I have definite preferences among the others. Some of
> > the logos are slight variations on a theme, and a voter might like to
> > express a preference for the theme rather than any specific logo. Etc.
>
> > A minor point: when the voters become anonymous, there should be some
> > indication to a logged-in user whether they've voted, and if so for what.
>
> > As I have few free time during my work day, If anyone could help with that,
> > I am putting the source on BitBucket.
>
> > 2010/10/14 weheh 
>
> >> Thadeus - I disagree with the randomization. Submissions should be
> >> sortable by vote count, date submitted, or submitter. Voter anonymity
> >> is probably a good idea.
>
> > --
>
> >http://rochacbruno.com.br
>
> --
>
> http://rochacbruno.com.br


Re: [web2py] Re: Vote for a new logo

2010-10-17 Thread Jonathan Lundell
On Oct 17, 2010, at 11:43 AM, weheh wrote:
> 
> Logovote upload still not working. Ticket issued when upload button is
> clicked.

I just did a successful upload, fwiw. Haven't seen any tickets. 

> 
> On Oct 14, 12:32 pm, Bruno Rocha  wrote:
>> One more time we could use reddishhttp://web2py.appspot.com/with some
>> modifications.
>> 
>> 2010/10/14 Jonathan Lundell 
>> 
>> 
>> 
>>> On Oct 14, 2010, at 8:52 AM, Bruno Rocha wrote:
>> 
>>> I am working to have ordering options [ number of votes - date submitted ]
>>> I will hide the name of the voters, and show only the vote counter
>>> Include a box for comment on every logo
>>> and possibility to the user for edit or delete uploades logos.
>> 
>>> Voting is an interesting problem. Since this is something of an informal
>>> beauty contest, it can be fairly casual, but done right, it could be a
>>> useful plugin.
>> 
>>> One refinement that would be useful in such a plugin is to allow voters to
>>> rank their choices, or otherwise express something more than a single vote
>>> for a single candidate.
>> 
>>> At the moment, #8 and #17 have one vote each. But it's reasonable to assume
>>> that those voters would also like #5, on which 8 & 17 are based. I'm partial
>>> to my own design, but I have definite preferences among the others. Some of
>>> the logos are slight variations on a theme, and a voter might like to
>>> express a preference for the theme rather than any specific logo. Etc.
>> 
>>> A minor point: when the voters become anonymous, there should be some
>>> indication to a logged-in user whether they've voted, and if so for what.
>> 
>>> As I have few free time during my work day, If anyone could help with that,
>>> I am putting the source on BitBucket.
>> 
>>> 2010/10/14 weheh 
>> 
 Thadeus - I disagree with the randomization. Submissions should be
 sortable by vote count, date submitted, or submitter. Voter anonymity
 is probably a good idea.
>> 
>>> --
>> 
>>> http://rochacbruno.com.br
>> 
>> --
>> 
>> http://rochacbruno.com.br




[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
http://blouweb.com/logovote/default/upload

generates the following:

Ticket issued: logovote/
98.111.199.220.2010-10-17.14-35-18.b31075d8-6abf-4561-a51b-
a747cf2c9c95

On Oct 17, 2:49 pm, Jonathan Lundell  wrote:
> On Oct 17, 2010, at 11:43 AM, weheh wrote:
>
>
>
> > Logovote upload still not working. Ticket issued when upload button is
> > clicked.
>
> I just did a successful upload, fwiw. Haven't seen any tickets.
>
>
>
> > On Oct 14, 12:32 pm, Bruno Rocha  wrote:
> >> One more time we could use reddishhttp://web2py.appspot.com/withsome
> >> modifications.
>
> >> 2010/10/14 Jonathan Lundell 
>
> >>> On Oct 14, 2010, at 8:52 AM, Bruno Rocha wrote:
>
> >>> I am working to have ordering options [ number of votes - date submitted ]
> >>> I will hide the name of the voters, and show only the vote counter
> >>> Include a box for comment on every logo
> >>> and possibility to the user for edit or delete uploades logos.
>
> >>> Voting is an interesting problem. Since this is something of an informal
> >>> beauty contest, it can be fairly casual, but done right, it could be a
> >>> useful plugin.
>
> >>> One refinement that would be useful in such a plugin is to allow voters to
> >>> rank their choices, or otherwise express something more than a single vote
> >>> for a single candidate.
>
> >>> At the moment, #8 and #17 have one vote each. But it's reasonable to 
> >>> assume
> >>> that those voters would also like #5, on which 8 & 17 are based. I'm 
> >>> partial
> >>> to my own design, but I have definite preferences among the others. Some 
> >>> of
> >>> the logos are slight variations on a theme, and a voter might like to
> >>> express a preference for the theme rather than any specific logo. Etc.
>
> >>> A minor point: when the voters become anonymous, there should be some
> >>> indication to a logged-in user whether they've voted, and if so for what.
>
> >>> As I have few free time during my work day, If anyone could help with 
> >>> that,
> >>> I am putting the source on BitBucket.
>
> >>> 2010/10/14 weheh 
>
>  Thadeus - I disagree with the randomization. Submissions should be
>  sortable by vote count, date submitted, or submitter. Voter anonymity
>  is probably a good idea.
>
> >>> --
>
> >>>http://rochacbruno.com.br
>
> >> --
>
> >>http://rochacbruno.com.br
>
>


Re: [web2py] Re: Vote for a new logo

2010-10-17 Thread Jonathan Lundell
On Oct 17, 2010, at 12:36 PM, weheh wrote:
> 
> http://blouweb.com/logovote/default/upload
> 
> generates the following:
> 
> Ticket issued: logovote/
> 98.111.199.220.2010-10-17.14-35-18.b31075d8-6abf-4561-a51b-
> a747cf2c9c95

Just visiting the URL? Or later in the upload process?

Presumably some admin ought to have a look at the ticket

> 
> On Oct 17, 2:49 pm, Jonathan Lundell  wrote:
>> On Oct 17, 2010, at 11:43 AM, weheh wrote:
>> 
>> 
>> 
>>> Logovote upload still not working. Ticket issued when upload button is
>>> clicked.
>> 
>> I just did a successful upload, fwiw. Haven't seen any tickets.
>> 
>> 
>> 
>>> On Oct 14, 12:32 pm, Bruno Rocha  wrote:
 One more time we could use reddishhttp://web2py.appspot.com/withsome
 modifications.
>> 
 2010/10/14 Jonathan Lundell 
>> 
> On Oct 14, 2010, at 8:52 AM, Bruno Rocha wrote:
>> 
> I am working to have ordering options [ number of votes - date submitted ]
> I will hide the name of the voters, and show only the vote counter
> Include a box for comment on every logo
> and possibility to the user for edit or delete uploades logos.
>> 
> Voting is an interesting problem. Since this is something of an informal
> beauty contest, it can be fairly casual, but done right, it could be a
> useful plugin.
>> 
> One refinement that would be useful in such a plugin is to allow voters to
> rank their choices, or otherwise express something more than a single vote
> for a single candidate.
>> 
> At the moment, #8 and #17 have one vote each. But it's reasonable to 
> assume
> that those voters would also like #5, on which 8 & 17 are based. I'm 
> partial
> to my own design, but I have definite preferences among the others. Some 
> of
> the logos are slight variations on a theme, and a voter might like to
> express a preference for the theme rather than any specific logo. Etc.
>> 
> A minor point: when the voters become anonymous, there should be some
> indication to a logged-in user whether they've voted, and if so for what.
>> 
> As I have few free time during my work day, If anyone could help with 
> that,
> I am putting the source on BitBucket.
>> 
> 2010/10/14 weheh 
>> 
>> Thadeus - I disagree with the randomization. Submissions should be
>> sortable by vote count, date submitted, or submitter. Voter anonymity
>> is probably a good idea.
>> 
> --
>> 
> http://rochacbruno.com.br
>> 
 --
>> 
 http://rochacbruno.com.br
>> 
>> 




[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread mr.freeze
You need to pass the widget the the Field constructor, not the
SQLFORM.factory constructor.

On Oct 17, 1:24 pm, "david.waldrop"  wrote:
> I have now tried this
>
>     addform =
> SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
> db.cat.name, id_field=db.cat.id) )
>
> but it doesn't work either.
>
> On Oct 17, 10:58 am, "david.waldrop"  wrote:
>
> > I have a form created with SQLFORM.factory containing a single field
>
> >     addform = SQLFORM.factory(Field('item_cat'))
>
> > Is there a way to use the autocomplete widget.  I have searched and
> > seen examples where I set the widget in the model, but do cannot find
> > an example of how to associate the autocomplete widget with a field
> > when using SQLFORM.factory.
>
> > I did get it to work in the model bu using something like the
> > following: db.itemcat.cat_ref.widget =
> > SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> > I am sure someone has done this and very much would love to see an
> > example.
>
>


[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread david.waldrop
some minor progress.  The following now lets thge loaded component
work, but does not do the autocomplete .

addform =
SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(request,
db.cat.name, id_field=db.cat.id) )

Is there something special I need to do to get the autocomplete to
work inside a loaded component?


On Oct 17, 2:24 pm, "david.waldrop"  wrote:
> I have now tried this
>
>     addform =
> SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
> db.cat.name, id_field=db.cat.id) )
>
> but it doesn't work either.
>
> On Oct 17, 10:58 am, "david.waldrop"  wrote:
>
>
>
> > I have a form created with SQLFORM.factory containing a single field
>
> >     addform = SQLFORM.factory(Field('item_cat'))
>
> > Is there a way to use the autocomplete widget.  I have searched and
> > seen examples where I set the widget in the model, but do cannot find
> > an example of how to associate the autocomplete widget with a field
> > when using SQLFORM.factory.
>
> > I did get it to work in the model bu using something like the
> > following: db.itemcat.cat_ref.widget =
> > SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> > I am sure someone has done this and very much would love to see an
> > example.


[web2py] Re: make two queries into one [need help]

2010-10-17 Thread ron_m
Andrew,

I took what you gave me and built an application called ecomm. Three
table definitions were missing so I faked it to get it working then
loaded in a bit of data. I have something working displaying data in
the individual product view.

Things to check.
1) The user_products result passed to the view is the result of a join
in the db. To address an element in the result

{{for row in user_products:}}
{{=row.table_name.field_name}} is required e.g.
{{=row.product.description}} not just row.description in this case.

This avoids the possibility of name collisions on fields between
tables e.g. all tables have a field called id.

2) The controller name.py function_name() maps to view/name/
function_name.html

I blindly copied the content from the post to indv_ptrdouct.html as
noted in the message and then could not see anything change. Turns out
the generic html file was used because the view/display/
indv_product.html file could not be found. Oops. It had me fooled
because both had a generic response._vars output which shows the data
from the database result.

I presume the logo field is somewhere such as in the product_extended
table which I didn't have the definition for so I switched to a
different field name to display in the view.

Hope that helps, I can wrap up the app I have here and send it to you
but I don't think you will need it - if you do just let me know.

Ron

On Oct 17, 11:09 am, Andrew Evans  wrote:
> what more of the application do you need to see, which parts?
>
> OS is Debian Lenny, Python 2.5 and the database is the default with web2py
> SQLite I believe.
>
> Will post my controller and views maybe that will help solve this
>
> Controller
>
> ###Display.py###
> ###
> # Display Indiviual Product
> ###
>
> #def indv_product():
> #    this_page = request.args(0)
>
> #    user_products = db((db.product.id == this_page) &
> (db.product_extended.product == this_page) & #(db.user_extended.userinfo ==
> db.product.userinfo)).select()
> #    return dict(user_products=user_products)
>
> def indv_product():
>     this_page = request.args(0)
>     user_products = db((db.product.id == this_page) & (db.product.id ==
> db.product_extended.product) & (db.product.userinfo ==
> db.user_extended.userinfo)).select()
>     #product_e=db(db.product_extended.product ==
> this_page).select(db.product_extended.ALL)
>     return dict(user_products=user_products)
>
> This is my view index.html where I pass args to where I am calling the
> function... I never posted the whole html file
>
> {{=A(row.product_name,
> _href=URL('display', 'indv_product', args=row.id))}}
>
> and here is the is the indv_ptrdouct.html
>
> {{for row in user_products:}}
>
> and example of data
>
> 
>              
>             {{=row.logo}}
>  
>
> {{pass}}
>
> You can see the site @www.em-ecommerce.com/Working/display/indexto see
> whats happening
>
> *cheers
>
> Andrew
>
> On Sun, Oct 17, 2010 at 1:58 AM, ron_m  wrote:
> > After rereading the posts I realize you might be running the db calls
> > in the view so the controller comment would be incorrect. Bottom line,
> > there is no data to display from what you are telling me about the
> > result of the last test. Is it possible to check the database and look
> > at the data in the tables for a particular product id you are using
> > for testing to be sure all the foreign keys are in place in the
> > related tables. What environment are you running on? OS, Python
> > version, database used? It is difficult to figure out the problem
> > without seeing more of the application.
>
> > Ron
>
> > On Oct 16, 11:02 am, Andrew Evans  wrote:
> > > Hello ty for the continued help. I did as you suggested and I saw the
> > table
> > > headers but none of the Data. I tried the function you suggested also.
>
> > > Does that mean its a controller problem
>
> > > Any ideas
>
> > > *cheers
>
> > > On Sat, Oct 16, 2010 at 12:14 AM, ron_m  wrote:
> > > > A couple of things
>
> > > > Put this in for the view html file temporarily
>
> > > > {{extend 'layout.html'}}
> > > > 
> > > > {{=H2('Results')}}
> > > > {{=SQLTABLE(user_products,
> > > >   headers='fieldname:capitalize',
> > > >   truncate=100)
> > > > }}
>
> > > > and you should see a nicely formatted table of the results of the
> > > > query with the column names in the table header.
>
> > > > This will prove whether or not you are getting data in user_products.
> > > > If you see the expected results in the table then it is a view
> > > > problem. If the table is blank it is a controller problem.
>
> > > > Did you put a {{pass}} line at the point where the {{for row in
> > > > user_products:}} iteration loop should end? Indentation follows HTML
> > > > not Python rules in the {{}} code segments so pass is used to signal
> > > > the end of a block in this case "for".
>
> > > >http://web2py.com/book/default/chapter/05
>
> > > > Ron
>
> > > > On Oct 15, 11:29 pm, Andrew Evans  wrote:
> > > > > Hi ty fo

[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread mdipierro
SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(request,
db.cat.name))

or

SQLFORM.factory(Field('item_cat',db.cat),widget=SQLFORM.widget.autocomplete(request,
db.cat.name, id_field=db.cat.id) )

On Oct 17, 2:50 pm, "david.waldrop"  wrote:
> some minor progress.  The following now lets thge loaded component
> work, but does not do the autocomplete .
>
>     addform =
> SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(request,
> db.cat.name, id_field=db.cat.id) )
>
> Is there something special I need to do to get the autocomplete to
> work inside a loaded component?
>
> On Oct 17, 2:24 pm, "david.waldrop"  wrote:
>
> > I have now tried this
>
> >     addform =
> > SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
> > db.cat.name, id_field=db.cat.id) )
>
> > but it doesn't work either.
>
> > On Oct 17, 10:58 am, "david.waldrop"  wrote:
>
> > > I have a form created with SQLFORM.factory containing a single field
>
> > >     addform = SQLFORM.factory(Field('item_cat'))
>
> > > Is there a way to use the autocomplete widget.  I have searched and
> > > seen examples where I set the widget in the model, but do cannot find
> > > an example of how to associate the autocomplete widget with a field
> > > when using SQLFORM.factory.
>
> > > I did get it to work in the model bu using something like the
> > > following: db.itemcat.cat_ref.widget =
> > > SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> > > I am sure someone has done this and very much would love to see an
> > > example.
>
>


[web2py] Re: make two queries into one [need help]

2010-10-17 Thread mdipierro
Hi Andrew,

it is difficult to help you without an explanation in english of what
you want. Cannot figure out from your code:

  def indv_product():
      this_page = request.args(0)
      user_products = db((db.product.id == this_page) & \
 (db.product.id == db.product_extended.product) & \
 (db.product.userinfo == db.user_extended.userinfo)).select()
      product_e=db(db.product_extended.product ==
this_page).select(db.product_extended.ALL)
     return dict(user_products=user_products)

Here is why:
From
  this_page = request.args(0)
and
  (db.product.id == this_page)
I assume you want to display something about one specific product.

Yet the query seems to indicate that you want to display more than one
product (user_products)

What is product.userinfo? Is this the buyer or the seller of the
product?

Are you trying to display all products bought by one user, along with
detailed information about both the buyer and the product? Are you
trying to display detailed information about one single product?






[web2py] Re: Vote for a new logo

2010-10-17 Thread Carl
How about Web heart Py
with a '2' within the heart symbol

On Oct 13, 10:17 pm, Bruno Rocha  wrote:
> Martin Mulone made the logovote application.
>
> I am hosting at my server
>
> You can post logo ideas, and vote for you prefered logo.
>
> Better if you made an transparent canvas .gif or .png maximum 250x70
>
> Maximum of 10 uploads per user, Just one vote per user.
>
> Take a look:http://blouweb.com/logovote/


[web2py] Who made this? It is great!

2010-10-17 Thread mdipierro
http://vimeo.com/15886413

I can see lots of uses for it.

I have some questions: does it store meta-info in the db? Or does it
uses something like YAML? Where can we get it?

Some suggestions for improvement:
- a checkbox for [use auth]
- allow adding fields for auth_user
- have a checkbox [use janrain] and seup janrain key/domain
- use the same interface that you use to create tables to create
controller actions (even if initially empty) (perhaps allows adding
widgets from plugin_wiki)
- It would be nice to have a way to display graphically the structure
of an app as a tree. Two main branches: tables, pages
- merge with http://web2py.com/layouts/plugin_layouts/index (perhaps
just pick best layouts)


[web2py] Re: Vote for a new logo

2010-10-17 Thread mdipierro
match2geeks.com is available. Just a suggestion.

Massimo

On Oct 17, 4:13 pm, Carl  wrote:
> How about Web heart Py
> with a '2' within the heart symbol


[web2py] Re: Where's Errata Page for Web2py 3rd Edition

2010-10-17 Thread NetAdmin

Bruno,

Here are pictures of the Web2py Manual 3rd Edition.

I like it!

http://www.setbit.us/IMG_0107.JPG
http://www.setbit.us/IMG_0108.JPG
http://www.setbit.us/IMG_0109.JPG

Mr.NetAdmin

On Oct 14, 4:33 pm, Bruno Rocha  wrote:
> I think by now, the book have no option for doing that.
>
> (BTW: the source for the app used in book is available on /appliances, so if
> anybody has a good idea to implement a comment system there)
>
> you have to send it directly to the group (one of the editors can correct),
> or directly to Massimo.
>
> What I used to do is every time when I find something to correct I open one
> draf on my gmail, and note there. after colecting some notes, I correct ( or
> send to Massimo).
>
> @NetAdmin did you buy a printed version, or printed from the pdf? I bought
> the pdf, and I want a printed version.
> I dont know if I will print it in my printer, or if I will buy it printed by
> LuLu.
>
> If your copy is from LuLu, can you take a picture? I want to see if it is
> different or if it is equal to printing by my own.
>
> Tks
>
> 2010/10/14 NetAdmin 
>
>
>
> > That's good, but I like to read my printed edition on the train, and
> > would like to make corrections there.
>
> > I don't have any corrections at the moment.
>
> > Thanks!
>
> > On Oct 14, 4:08 pm, cjrh  wrote:
> > > On Oct 14, 10:53 pm, NetAdmin  wrote:
>
> > > > I'd like to make notes of  any typos / errors in my printed edition.
>
> > > Send me all errors and typos, I'll fix them (almost) immediately in
> > > the online book.
>
> --
>
> http://rochacbruno.com.br


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
Just visiting the URL. Can't even reach the upload form.

On Oct 17, 3:47 pm, Jonathan Lundell  wrote:
> On Oct 17, 2010, at 12:36 PM, weheh wrote:
>
>
>
> >http://blouweb.com/logovote/default/upload
>
> > generates the following:
>
> > Ticket issued: logovote/
> > 98.111.199.220.2010-10-17.14-35-18.b31075d8-6abf-4561-a51b-
> > a747cf2c9c95
>
> Just visiting the URL? Or later in the upload process?
>
> Presumably some admin ought to have a look at the ticket
>
>
>
> > On Oct 17, 2:49 pm, Jonathan Lundell  wrote:
> >> On Oct 17, 2010, at 11:43 AM, weheh wrote:
>
> >>> Logovote upload still not working. Ticket issued when upload button is
> >>> clicked.
>
> >> I just did a successful upload, fwiw. Haven't seen any tickets.
>
> >>> On Oct 14, 12:32 pm, Bruno Rocha  wrote:
>  One more time we could use reddishhttp://web2py.appspot.com/withsome
>  modifications.
>
>  2010/10/14 Jonathan Lundell 
>
> > On Oct 14, 2010, at 8:52 AM, Bruno Rocha wrote:
>
> > I am working to have ordering options [ number of votes - date 
> > submitted ]
> > I will hide the name of the voters, and show only the vote counter
> > Include a box for comment on every logo
> > and possibility to the user for edit or delete uploades logos.
>
> > Voting is an interesting problem. Since this is something of an informal
> > beauty contest, it can be fairly casual, but done right, it could be a
> > useful plugin.
>
> > One refinement that would be useful in such a plugin is to allow voters 
> > to
> > rank their choices, or otherwise express something more than a single 
> > vote
> > for a single candidate.
>
> > At the moment, #8 and #17 have one vote each. But it's reasonable to 
> > assume
> > that those voters would also like #5, on which 8 & 17 are based. I'm 
> > partial
> > to my own design, but I have definite preferences among the others. 
> > Some of
> > the logos are slight variations on a theme, and a voter might like to
> > express a preference for the theme rather than any specific logo. Etc.
>
> > A minor point: when the voters become anonymous, there should be some
> > indication to a logged-in user whether they've voted, and if so for 
> > what.
>
> > As I have few free time during my work day, If anyone could help with 
> > that,
> > I am putting the source on BitBucket.
>
> > 2010/10/14 weheh 
>
> >> Thadeus - I disagree with the randomization. Submissions should be
> >> sortable by vote count, date submitted, or submitter. Voter anonymity
> >> is probably a good idea.
>
> > --
>
> >http://rochacbruno.com.br
>
>  --
>
> http://rochacbruno.com.br
>
>


[web2py] Re: Where's Errata Page for Web2py 3rd Edition

2010-10-17 Thread mdipierro
I do not know if I ever mentioned this but the book is 100% generated
from the markdown in the wiki. Not one line of manual editing.

On Oct 17, 4:20 pm, NetAdmin  wrote:
> Bruno,
>
> Here are pictures of the Web2py Manual 3rd Edition.
>
> I like it!
>
> http://www.setbit.us/IMG_0107.JPGhttp://www.setbit.us/IMG_0108.JPGhttp://www.setbit.us/IMG_0109.JPG
>
> Mr.NetAdmin
>
> On Oct 14, 4:33 pm, Bruno Rocha  wrote:
>
> > I think by now, the book have no option for doing that.
>
> > (BTW: the source for the app used in book is available on /appliances, so if
> > anybody has a good idea to implement a comment system there)
>
> > you have to send it directly to the group (one of the editors can correct),
> > or directly to Massimo.
>
> > What I used to do is every time when I find something to correct I open one
> > draf on my gmail, and note there. after colecting some notes, I correct ( or
> > send to Massimo).
>
> > @NetAdmin did you buy a printed version, or printed from the pdf? I bought
> > the pdf, and I want a printed version.
> > I dont know if I will print it in my printer, or if I will buy it printed by
> > LuLu.
>
> > If your copy is from LuLu, can you take a picture? I want to see if it is
> > different or if it is equal to printing by my own.
>
> > Tks
>
> > 2010/10/14 NetAdmin 
>
> > > That's good, but I like to read my printed edition on the train, and
> > > would like to make corrections there.
>
> > > I don't have any corrections at the moment.
>
> > > Thanks!
>
> > > On Oct 14, 4:08 pm, cjrh  wrote:
> > > > On Oct 14, 10:53 pm, NetAdmin  wrote:
>
> > > > > I'd like to make notes of  any typos / errors in my printed edition.
>
> > > > Send me all errors and typos, I'll fix them (almost) immediately in
> > > > the online book.
>
> > --
>
> >http://rochacbruno.com.br
>
>


[web2py] Special characters being inserted during AJAX call

2010-10-17 Thread weheh
Issue 1: I have some simple text input fields, INPUT(_name='xyz' ...)
whose values I pass as arguments to a controller via an ajax call. The
values that arrive at the controller have been encoded: spaces
replaced by "_" (underscore). How to decode the args on the controller
side, replacing the "_" with " "?

Issue 2: If one of the fields getting passed as an arg is blank, the
ajax routine fails because the URL looks something like this:
  my_ajax_routine///foobar
Blank fields are OK by me and will be caught by my ajax controller.
But ajax fails before getting to the controller. What to do?


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
Somethink like this is posted already (by me). If you take 2 and place
it next to its mirror image, it makes a heart. I discovered this years
ago on my 2nd wedding anniversary as I was making a card for my wife.

On Oct 17, 5:13 pm, Carl  wrote:
> How about Web heart Py
> with a '2' within the heart symbol
>
> On Oct 13, 10:17 pm, Bruno Rocha  wrote:
>
> > Martin Mulone made the logovote application.
>
> > I am hosting at my server
>
> > You can post logo ideas, and vote for you prefered logo.
>
> > Better if you made an transparent canvas .gif or .png maximum 250x70
>
> > Maximum of 10 uploads per user, Just one vote per user.
>
> > Take a look:http://blouweb.com/logovote/
>
>


Re: [web2py] Who made this? It is great!

2010-10-17 Thread rochacbruno
He is brazilian, Lucas. I know him from web and brazilian group.

Enviado via iPhone

Em 17/10/2010, às 19:14, mdipierro  escreveu:

> http://vimeo.com/15886413
> 
> I can see lots of uses for it.
> 
> I have some questions: does it store meta-info in the db? Or does it
> uses something like YAML? Where can we get it?
> 
> Some suggestions for improvement:
> - a checkbox for [use auth]
> - allow adding fields for auth_user
> - have a checkbox [use janrain] and seup janrain key/domain
> - use the same interface that you use to create tables to create
> controller actions (even if initially empty) (perhaps allows adding
> widgets from plugin_wiki)
> - It would be nice to have a way to display graphically the structure
> of an app as a tree. Two main branches: tables, pages
> - merge with http://web2py.com/layouts/plugin_layouts/index (perhaps
> just pick best layouts)


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
LOL. Seems like an infinitely deep market -- geeks looking for love.

On Oct 17, 5:20 pm, mdipierro  wrote:
> match2geeks.com is available. Just a suggestion.
>
> Massimo
>
> On Oct 17, 4:13 pm, Carl  wrote:
>
> > How about Web heart Py
> > with a '2' within the heart symbol
>
>


[web2py] Re: Vote for a new logo

2010-10-17 Thread Anthony
So, what's happening with the voting method? As already discussed at
length, the one-vote-per-person method isn't a good idea with so many
entries (particularly with sets of similar logos). For example, #5 and
#17 are probably splitting votes.

We really should implement one of the other suggested methods:
* Approval Voting (vote for as many logos as you want): Probably the
easiest to implement, and should handle the "clone" problem. (Still
need the ability to change one's vote(s)).
* Ratings: Though for this to work, either everyone has to rate every
logo, or for each voter, each un-rated logo has to be assigned the
lowest possible value (e.g., 1 star).
* Ranking: Preferably using the Schulze method for tallying. Probably
the most complex to implement.

If we're not going to do any of the above, then at the very least, we
should go back to showing the _number_ of votes for each logo (no need
to show the names -- they should remain anonymous). That way, at least
we could see if we are splitting (and possibly wasting) our votes and
then shift our support to a logo we like that has a chance of winning.

If we stick with the current voting method, with 50+ logos, we could
easily end up with a "winner" that gets the support of only a small
percentage of the voters.

Also, is the voting deadline still Oct. 19?

Thanks.

Anthony

On Oct 13, 5:17 pm, Bruno Rocha  wrote:
> Martin Mulone made the logovote application.
>
> I am hosting at my server
>
> You can post logo ideas, and vote for you prefered logo.
>
> Better if you made an transparent canvas .gif or .png maximum 250x70
>
> Maximum of 10 uploads per user, Just one vote per user.
>
> Take a look:http://blouweb.com/logovote/


[web2py] DAL -> not in list

2010-10-17 Thread Joergi
Hello,

I'm playing around with web2py and I'm very happy to find a tool/
framwork like that. It is exactly what I'm looking for since years.

One open question from my site.

Is there a way to do a db query and check that an id is not in a given
range or list.

something like that:
db(db.table.id.IS_NOT_IN(list)).select()

Best regards,
Joerg


[web2py] Re: DAL -> not in list

2010-10-17 Thread mdipierro
Thanks. Yes

db(~db.table.id.belongs(list)).select()


On Oct 17, 4:11 pm, Joergi  wrote:
> Hello,
>
> I'm playing around with web2py and I'm very happy to find a tool/
> framwork like that. It is exactly what I'm looking for since years.
>
> One open question from my site.
>
> Is there a way to do a db query and check that an id is not in a given
> range or list.
>
> something like that:
> db(db.table.id.IS_NOT_IN(list)).select()
>
> Best regards,
> Joerg


[web2py] Re: Who made this? It is great!

2010-10-17 Thread mdipierro
How about using this for the wizard:
http://thecodemine.org/

And this to build tables and or pages:
http://www.jstree.com/demo



On Oct 17, 4:28 pm, rochacbruno  wrote:
> He is brazilian, Lucas. I know him from web and brazilian group.
>
> Enviado via iPhone
>
> Em 17/10/2010, às 19:14, mdipierro  escreveu:
>
> >http://vimeo.com/15886413
>
> > I can see lots of uses for it.
>
> > I have some questions: does it store meta-info in the db? Or does it
> > uses something like YAML? Where can we get it?
>
> > Some suggestions for improvement:
> > - a checkbox for [use auth]
> > - allow adding fields for auth_user
> > - have a checkbox [use janrain] and seup janrain key/domain
> > - use the same interface that you use to create tables to create
> > controller actions (even if initially empty) (perhaps allows adding
> > widgets from plugin_wiki)
> > - It would be nice to have a way to display graphically the structure
> > of an app as a tree. Two main branches: tables, pages
> > - merge withhttp://web2py.com/layouts/plugin_layouts/index(perhaps
> > just pick best layouts)
>
>


[web2py] Apache wsgi virtualhost configuration for multiple web2py sites

2010-10-17 Thread Tom Atkins
I know this has been asked before but I've been unable to find a clear
answer. (Apologies to Graham Dumpleton who must have answered this kind of
question many times for Django etc but I can't work out how to do it for
web2py)

I have a Debian server set up and running web2py with mod_wsgi using the
instructions in the book.  All works great.

The file /etc/apache2/sites-available/default has the virtualhost directives
as shown in the book. So at the moment any request to the server simply
shows the welcome app.

I have 3 domain names which resolve to the IP address of the server:

- domain1.com
- domain2.com
- domain3.com

I have a web2py application for each of these.  They are in
/var/www/web2py/applications/domain1 etc.

So now I want to create 3 files in /etc/apache2/sites-available that will
get apache to serve up the appropriate application for each domain.

The key is that it should not require another instance of web2py for each
application.

Can someone suggest how the virtualhost files should look please?  Many
thanks in advance.


[web2py] Re: Vote for a new logo

2010-10-17 Thread Anthony
Also, although ordering the logos randomly by default is a good idea,
it would also be helpful to allow the user to select ordering by most
recently submitted (and possibly by number of votes). At this point, I
have seen all the logos submitted so far, so when I check the site, I
just want to see the most recent submissions, which is difficult with
the logos ordered randomly (the random ordering is also a hassle when
returning from viewing/submitting comments because it re-randomizes
the list on each re-load).

Thanks.

Anthony

On Oct 17, 5:40 pm, Anthony  wrote:
> So, what's happening with the voting method? As already discussed at
> length, the one-vote-per-person method isn't a good idea with so many
> entries (particularly with sets of similar logos). For example, #5 and
> #17 are probably splitting votes.
>
> We really should implement one of the other suggested methods:
> * Approval Voting (vote for as many logos as you want): Probably the
> easiest to implement, and should handle the "clone" problem. (Still
> need the ability to change one's vote(s)).
> * Ratings: Though for this to work, either everyone has to rate every
> logo, or for each voter, each un-rated logo has to be assigned the
> lowest possible value (e.g., 1 star).
> * Ranking: Preferably using the Schulze method for tallying. Probably
> the most complex to implement.
>
> If we're not going to do any of the above, then at the very least, we
> should go back to showing the _number_ of votes for each logo (no need
> to show the names -- they should remain anonymous). That way, at least
> we could see if we are splitting (and possibly wasting) our votes and
> then shift our support to a logo we like that has a chance of winning.
>
> If we stick with the current voting method, with 50+ logos, we could
> easily end up with a "winner" that gets the support of only a small
> percentage of the voters.
>
> Also, is the voting deadline still Oct. 19?
>
> Thanks.
>
> Anthony
>
> On Oct 13, 5:17 pm, Bruno Rocha  wrote:
>
>
>
> > Martin Mulone made the logovote application.
>
> > I am hosting at my server
>
> > You can post logo ideas, and vote for you prefered logo.
>
> > Better if you made an transparent canvas .gif or .png maximum 250x70
>
> > Maximum of 10 uploads per user, Just one vote per user.
>
> > Take a look:http://blouweb.com/logovote/- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: Simple self-reference doesn't work; probable noob error...

2010-10-17 Thread BigBaaadBob
Incidenntally, adding the requires you mention above makes everything
work fine.  Thanks!

On Oct 17, 10:26 am, mdipierro  wrote:
> Somehow you got a string in a field that is supposed to be a
> reference. My guess is that you inserted the data and than you changed
> the field type.

No, but without the requires the crud form didn't contain a drop-down
with references.  Instead I got a box and if I didn't enter something
I would get the exception.


[web2py] Re: Apache wsgi virtualhost configuration for multiple web2py sites

2010-10-17 Thread mdipierro
You can handle this at the web2py level with a single catch-all
virtualhsost.

create a web2py/routes.py that contains:

routes_in=(
('/robots.txt','/welcome/static/robots.txt'),
('/admin$anything','/admin$anything'),

('.*:https?://(www.)?domain1.com:$method /','/app1/default/
index'),
('.*:https?://(www.)?domain1.com:$method /$app/$anything','/
app1/$anything'),


('.*:https?://(www.)?domain2.com:$method /','/app2/default/
index'),
('.*:https?://(www.)?domain2.com:$method /$app/$anything','/
app2/$anything'),

('.*:https?://(www.)?domain3.com:$method /','/app3/default/
index'),
('.*:https?://(www.)?domain3.com:$method /$app/$anything','/
app3/$anything'),
)


On Oct 17, 5:21 pm, Tom Atkins  wrote:
> I know this has been asked before but I've been unable to find a clear
> answer. (Apologies to Graham Dumpleton who must have answered this kind of
> question many times for Django etc but I can't work out how to do it for
> web2py)
>
> I have a Debian server set up and running web2py with mod_wsgi using the
> instructions in the book.  All works great.
>
> The file /etc/apache2/sites-available/default has the virtualhost directives
> as shown in the book. So at the moment any request to the server simply
> shows the welcome app.
>
> I have 3 domain names which resolve to the IP address of the server:
>
> - domain1.com
> - domain2.com
> - domain3.com
>
> I have a web2py application for each of these.  They are in
> /var/www/web2py/applications/domain1 etc.
>
> So now I want to create 3 files in /etc/apache2/sites-available that will
> get apache to serve up the appropriate application for each domain.
>
> The key is that it should not require another instance of web2py for each
> application.
>
> Can someone suggest how the virtualhost files should look please?  Many
> thanks in advance.


[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread david.waldrop
Thanks for the suggestions. I tried both, but I still cannot get it to
work.  I think I have it isolated to the fact that the textbox i am
trying to use autocomplete on is loaded in a view using the LOAD
command.  In fact it is the technique I am using is identical to the
tagging widget.  IS it possible to use the autocomplete widget in this
manner?

On Oct 17, 4:13 pm, mdipierro  wrote:
> SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(reques t,
> db.cat.name))
>
> or
>
> SQLFORM.factory(Field('item_cat',db.cat),widget=SQLFORM.widget.autocomplete 
> (request,
> db.cat.name, id_field=db.cat.id) )
>
> On Oct 17, 2:50 pm, "david.waldrop"  wrote:
>
>
>
> > some minor progress.  The following now lets thge loaded component
> > work, but does not do the autocomplete .
>
> >     addform =
> > SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(reques 
> > t,
> > db.cat.name, id_field=db.cat.id) )
>
> > Is there something special I need to do to get the autocomplete to
> > work inside a loaded component?
>
> > On Oct 17, 2:24 pm, "david.waldrop"  wrote:
>
> > > I have now tried this
>
> > >     addform =
> > > SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
> > > db.cat.name, id_field=db.cat.id) )
>
> > > but it doesn't work either.
>
> > > On Oct 17, 10:58 am, "david.waldrop"  wrote:
>
> > > > I have a form created with SQLFORM.factory containing a single field
>
> > > >     addform = SQLFORM.factory(Field('item_cat'))
>
> > > > Is there a way to use the autocomplete widget.  I have searched and
> > > > seen examples where I set the widget in the model, but do cannot find
> > > > an example of how to associate the autocomplete widget with a field
> > > > when using SQLFORM.factory.
>
> > > > I did get it to work in the model bu using something like the
> > > > following: db.itemcat.cat_ref.widget =
> > > > SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> > > > I am sure someone has done this and very much would love to see an
> > > > example.


[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread mdipierro
Probably not. ajax calls do not execute JS embedded in loaded content.

On Oct 17, 5:59 pm, "david.waldrop"  wrote:
> Thanks for the suggestions. I tried both, but I still cannot get it to
> work.  I think I have it isolated to the fact that the textbox i am
> trying to use autocomplete on is loaded in a view using the LOAD
> command.  In fact it is the technique I am using is identical to the
> tagging widget.  IS it possible to use the autocomplete widget in this
> manner?
>
> On Oct 17, 4:13 pm, mdipierro  wrote:
>
> > SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(reques 
> > t,
> > db.cat.name))
>
> > or
>
> > SQLFORM.factory(Field('item_cat',db.cat),widget=SQLFORM.widget.autocomplete 
> > (request,
> > db.cat.name, id_field=db.cat.id) )
>
> > On Oct 17, 2:50 pm, "david.waldrop"  wrote:
>
> > > some minor progress.  The following now lets thge loaded component
> > > work, but does not do the autocomplete .
>
> > >     addform =
> > > SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(reques
> > >  t,
> > > db.cat.name, id_field=db.cat.id) )
>
> > > Is there something special I need to do to get the autocomplete to
> > > work inside a loaded component?
>
> > > On Oct 17, 2:24 pm, "david.waldrop"  wrote:
>
> > > > I have now tried this
>
> > > >     addform =
> > > > SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
> > > > db.cat.name, id_field=db.cat.id) )
>
> > > > but it doesn't work either.
>
> > > > On Oct 17, 10:58 am, "david.waldrop"  wrote:
>
> > > > > I have a form created with SQLFORM.factory containing a single field
>
> > > > >     addform = SQLFORM.factory(Field('item_cat'))
>
> > > > > Is there a way to use the autocomplete widget.  I have searched and
> > > > > seen examples where I set the widget in the model, but do cannot find
> > > > > an example of how to associate the autocomplete widget with a field
> > > > > when using SQLFORM.factory.
>
> > > > > I did get it to work in the model bu using something like the
> > > > > following: db.itemcat.cat_ref.widget =
> > > > > SQLFORM.widgets.autocomplete(request, db.cat.name, id_field=db.cat.id)
>
> > > > > I am sure someone has done this and very much would love to see an
> > > > > example.
>
>


[web2py] Re: SQLFORM.factory and autocomplete widget

2010-10-17 Thread david.waldrop
do you have any suggestions I can research/try for another approach to
get the needed functionality?

On Oct 17, 7:03 pm, mdipierro  wrote:
> Probably not. ajax calls do not execute JS embedded in loaded content.
>
> On Oct 17, 5:59 pm, "david.waldrop"  wrote:
>
>
>
> > Thanks for the suggestions. I tried both, but I still cannot get it to
> > work.  I think I have it isolated to the fact that the textbox i am
> > trying to use autocomplete on is loaded in a view using the LOAD
> > command.  In fact it is the technique I am using is identical to the
> > tagging widget.  IS it possible to use the autocomplete widget in this
> > manner?
>
> > On Oct 17, 4:13 pm, mdipierro  wrote:
>
> > > SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(reques
> > >  t,
> > > db.cat.name))
>
> > > or
>
> > > SQLFORM.factory(Field('item_cat',db.cat),widget=SQLFORM.widget.autocomplete
> > >  (request,
> > > db.cat.name, id_field=db.cat.id) )
>
> > > On Oct 17, 2:50 pm, "david.waldrop"  wrote:
>
> > > > some minor progress.  The following now lets thge loaded component
> > > > work, but does not do the autocomplete .
>
> > > >     addform =
> > > > SQLFORM.factory(Field('item_cat'),widget=SQLFORM.widget.autocomplete(reques
> > > >  t,
> > > > db.cat.name, id_field=db.cat.id) )
>
> > > > Is there something special I need to do to get the autocomplete to
> > > > work inside a loaded component?
>
> > > > On Oct 17, 2:24 pm, "david.waldrop"  wrote:
>
> > > > > I have now tried this
>
> > > > >     addform =
> > > > > SQLFORM.factory(Field('item_cat'),widget=autocomplete(request,
> > > > > db.cat.name, id_field=db.cat.id) )
>
> > > > > but it doesn't work either.
>
> > > > > On Oct 17, 10:58 am, "david.waldrop"  wrote:
>
> > > > > > I have a form created with SQLFORM.factory containing a single field
>
> > > > > >     addform = SQLFORM.factory(Field('item_cat'))
>
> > > > > > Is there a way to use the autocomplete widget.  I have searched and
> > > > > > seen examples where I set the widget in the model, but do cannot 
> > > > > > find
> > > > > > an example of how to associate the autocomplete widget with a field
> > > > > > when using SQLFORM.factory.
>
> > > > > > I did get it to work in the model bu using something like the
> > > > > > following: db.itemcat.cat_ref.widget =
> > > > > > SQLFORM.widgets.autocomplete(request, db.cat.name, 
> > > > > > id_field=db.cat.id)
>
> > > > > > I am sure someone has done this and very much would love to see an
> > > > > > example.


Re: [web2py] Re: Apache wsgi virtualhost configuration for multiple web2py sites

2010-10-17 Thread Tom Atkins
Thank you very much for the super quick reply Massimo! Your solution works
perfectly.

I will study the routes section of the book more carefully now!

On 17 October 2010 23:32, mdipierro  wrote:

> You can handle this at the web2py level with a single catch-all
> virtualhsost.
>
> create a web2py/routes.py that contains:
>
> routes_in=(
>('/robots.txt','/welcome/static/robots.txt'),
>('/admin$anything','/admin$anything'),
>
>('.*:https?://(www.)?domain1.com:$method /','/app1/default/
> index'),
>('.*:https?://(www.)?domain1.com:$method /$app/$anything','/
> app1/$anything'),
>
>
>('.*:https?://(www.)?domain2.com:$method /','/app2/default/
> index'),
>('.*:https?://(www.)?domain2.com:$method /$app/$anything','/
> app2/$anything'),
>
>('.*:https?://(www.)?domain3.com:$method /','/app3/default/
> index'),
>('.*:https?://(www.)?domain3.com:$method /$app/$anything','/
> app3/$anything'),
> )
>
>
> On Oct 17, 5:21 pm, Tom Atkins  wrote:
> > I know this has been asked before but I've been unable to find a clear
> > answer. (Apologies to Graham Dumpleton who must have answered this kind
> of
> > question many times for Django etc but I can't work out how to do it for
> > web2py)
> >
> > I have a Debian server set up and running web2py with mod_wsgi using the
> > instructions in the book.  All works great.
> >
> > The file /etc/apache2/sites-available/default has the virtualhost
> directives
> > as shown in the book. So at the moment any request to the server simply
> > shows the welcome app.
> >
> > I have 3 domain names which resolve to the IP address of the server:
> >
> > - domain1.com
> > - domain2.com
> > - domain3.com
> >
> > I have a web2py application for each of these.  They are in
> > /var/www/web2py/applications/domain1 etc.
> >
> > So now I want to create 3 files in /etc/apache2/sites-available that will
> > get apache to serve up the appropriate application for each domain.
> >
> > The key is that it should not require another instance of web2py for each
> > application.
> >
> > Can someone suggest how the virtualhost files should look please?  Many
> > thanks in advance.
>


[web2py] Need help installing MySQLdb in Mac OSX

2010-10-17 Thread Franklin Freitas
Has anyone been able to install MySQLdb in Mac OSX ???

I want to use it with Web2py but haven't been able to make it work.
I've read a whole bunch of forums saying how hard it is, I've done
everything I've reead about it without any results. I even used
macports as recommended by my Web2py teacher but it didn't work
either.

If anyone knows a sure way on how to achieve this I would appreciate
it.

Thanks for your time


Re: [web2py] Commenting WSDLs under web2py SOAP

2010-10-17 Thread David Mitchell
Cool, thanks Mariano.

On 17 October 2010 05:33, Mariano Reingart  wrote:

> On Thu, Oct 14, 2010 at 9:58 PM, David Mitchell 
> wrote:
> > Hello group,
> > I'm having a lot of fun working with web2py's SOAP functionality - thanks
> to
> > Massimo and Mariano Reingart for doing the work to put this together.
> > However, there's one point I'm struggling with right now:
> > HOW TO PUT SOME HELPFUL HINTS IN THE WSDL
> > I'd really like it if the published WSDL for my SOAP services included a
> few
> > helpful hints.  For example, I'd like the current fragment in the WSDL
> >
> > 
> >   
> >
> > 
> > 
> >   
> > 
> >
> > to look something like
> >
> > 
> >   
> > 
> > 
> >   
> >
> > 
> >
> > Is there a relatively straightforward way I can present comments in the
> > WSDL?
>
> Dave, sorry but there isn't a easy way to do that now, and, in fact, I
> think I haven't seen any WSDL with that comments.
>
> But you can use the html documentation generated by
> web2py/pysimplesoap, where comments are output in sample xml messages:
>
> http://code.google.com/p/pysimplesoap/wiki/Web2Py
>
> You could even edit the wsdl with an xml editor and use it, it should
> work either.
>
> Best regards,
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>


[web2py] [marked for deletion]

2010-10-17 Thread weheh
No wonder this hasn't been responded to. I'm doing things wrong and
have gone back to the doc. Yarko, if you're watching, please delete
this thread.


[web2py] Re: Need help installing MySQLdb in Mac OSX

2010-10-17 Thread mart
you can throw in in the installed python/lib folder, or in site-
packages folder (sibling to the applications folder of the web2py root
dir, or do an export within your scripts (controller?),or my
favorite, I usually do web2py stuff with Aptana,so, i throw of copy of
all dependencies within my project and reference it there... so, many
possibilities, depends how you prefer to reference it

Hope it helps,
Mart :)

On Oct 17, 7:11 pm, Franklin Freitas 
wrote:
> Has anyone been able to install MySQLdb in Mac OSX ???
>
> I want to use it with Web2py but haven't been able to make it work.
> I've read a whole bunch of forums saying how hard it is, I've done
> everything I've reead about it without any results. I even used
> macports as recommended by my Web2py teacher but it didn't work
> either.
>
> If anyone knows a sure way on how to achieve this I would appreciate
> it.
>
> Thanks for your time


[web2py] Re: Vote for a new logo

2010-10-17 Thread Anthony
Ordering by most recent comments would be great too.

On Oct 17, 6:29 pm, Anthony  wrote:
> Also, although ordering the logos randomly by default is a good idea,
> it would also be helpful to allow the user to select ordering by most
> recently submitted (and possibly by number of votes). At this point, I
> have seen all the logos submitted so far, so when I check the site, I
> just want to see the most recent submissions, which is difficult with
> the logos ordered randomly (the random ordering is also a hassle when
> returning from viewing/submitting comments because it re-randomizes
> the list on each re-load).
>
> Thanks.
>
> Anthony
>
> On Oct 17, 5:40 pm, Anthony  wrote:
>
>
>
> > So, what's happening with the voting method? As already discussed at
> > length, the one-vote-per-person method isn't a good idea with so many
> > entries (particularly with sets of similar logos). For example, #5 and
> > #17 are probably splitting votes.
>
> > We really should implement one of the other suggested methods:
> > * Approval Voting (vote for as many logos as you want): Probably the
> > easiest to implement, and should handle the "clone" problem. (Still
> > need the ability to change one's vote(s)).
> > * Ratings: Though for this to work, either everyone has to rate every
> > logo, or for each voter, each un-rated logo has to be assigned the
> > lowest possible value (e.g., 1 star).
> > * Ranking: Preferably using the Schulze method for tallying. Probably
> > the most complex to implement.
>
> > If we're not going to do any of the above, then at the very least, we
> > should go back to showing the _number_ of votes for each logo (no need
> > to show the names -- they should remain anonymous). That way, at least
> > we could see if we are splitting (and possibly wasting) our votes and
> > then shift our support to a logo we like that has a chance of winning.
>
> > If we stick with the current voting method, with 50+ logos, we could
> > easily end up with a "winner" that gets the support of only a small
> > percentage of the voters.
>
> > Also, is the voting deadline still Oct. 19?
>
> > Thanks.
>
> > Anthony
>
> > On Oct 13, 5:17 pm, Bruno Rocha  wrote:
>
> > > Martin Mulone made the logovote application.
>
> > > I am hosting at my server
>
> > > You can post logo ideas, and vote for you prefered logo.
>
> > > Better if you made an transparent canvas .gif or .png maximum 250x70
>
> > > Maximum of 10 uploads per user, Just one vote per user.
>
> > > Take a look:http://blouweb.com/logovote/-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


[web2py] cache.ram Name error

2010-10-17 Thread Andrew Evans
having problems using the cache feature in my code and can't figure out how
to import it

  File "applications/Working/modules/logging.py", line 20, in 
NameError: name 'cache' is not defined


this is in a Module file I created any ideas how to import it?


[web2py] Re: cache.ram Name error

2010-10-17 Thread mdipierro
You cannot import it. You have to pass it to the functions that need
it.

massimo

On Oct 17, 7:15 pm, Andrew Evans  wrote:
> having problems using the cache feature in my code and can't figure out how
> to import it
>
>   File "applications/Working/modules/logging.py", line 20, in 
> NameError: name 'cache' is not defined
>
> this is in a Module file I created any ideas how to import it?


Re: [web2py] Re: make two queries into one [need help]

2010-10-17 Thread Andrew Evans
Hi ty for all your help ron and sorry I couldn't explain myself better
mdipierro

Ron if you could attach that file that would be great just so I can see what
your getting at.. maybe I am to tired to understand it right now haha anyway

if you get a chance attach the file

*cheers

and ty for your continued help

*cheers



On Sun, Oct 17, 2010 at 1:25 PM, mdipierro  wrote:

> Hi Andrew,
>
> it is difficult to help you without an explanation in english of what
> you want. Cannot figure out from your code:
>
>  def indv_product():
>  this_page = request.args(0)
>  user_products = db((db.product.id == this_page) & \
> (db.product.id == db.product_extended.product) & \
> (db.product.userinfo == db.user_extended.userinfo)).select()
>  product_e=db(db.product_extended.product ==
> this_page).select(db.product_extended.ALL)
>  return dict(user_products=user_products)
>
> Here is why:
> From
>   this_page = request.args(0)
> and
>   (db.product.id == this_page)
> I assume you want to display something about one specific product.
>
> Yet the query seems to indicate that you want to display more than one
> product (user_products)
>
> What is product.userinfo? Is this the buyer or the seller of the
> product?
>
> Are you trying to display all products bought by one user, along with
> detailed information about both the buyer and the product? Are you
> trying to display detailed information about one single product?
>
>
>
>
>


Re: [web2py] Re: cache.ram Name error

2010-10-17 Thread Andrew Evans
I was following some information trying to figure out this logging system

please explain how to do it with this code

import logging
from logging.handlers import SysLogHandler

def _init_log():
logger = logging.getLogger(request.application)
logger.setLevel(logging.DEBUG)
handler = SysLogHandler(address='/dev/log')
handler.setLevel(logging.DEBUG)
handler.setFormatter(logging.Formatter('%s' % request.application +
'[%(process)d]: %(levelname)s: %(filename)s at line %(lineno)d:
%(message)s'))
logger.addHandler(handler)
return logger

app_logging=cache.ram('once',lambda:_init_log(),time_expire=)


[web2py] Re: cache.ram Name error

2010-10-17 Thread mdipierro
logger is another variable that is app-dependent. You cannot import
it. You must pass it to the functions that need it.

On Oct 17, 7:21 pm, Andrew Evans  wrote:
> I was following some information trying to figure out this logging system
>
> please explain how to do it with this code
>
> import logging
> from logging.handlers import SysLogHandler
>
> def _init_log():
>     logger = logging.getLogger(request.application)
>     logger.setLevel(logging.DEBUG)
>     handler = SysLogHandler(address='/dev/log')
>     handler.setLevel(logging.DEBUG)
>     handler.setFormatter(logging.Formatter('%s' % request.application +
> '[%(process)d]: %(levelname)s: %(filename)s at line %(lineno)d:
> %(message)s'))
>     logger.addHandler(handler)
>     return logger
>
> app_logging=cache.ram('once',lambda:_init_log(),time_expire=)


[web2py] Re: Vote for a new logo

2010-10-17 Thread Martin.Mulone
I think "Approval Voting" is better way than the current, easy to
implement and I ready to do so what the others think?. Random is very
annoying, and i dont believe that change anything in matter of votes.
How about that after deadline for sending ideas (1 day after or two)
have the 5 or 6 most votes logos, delete (hide) the others and reset
votes.

On 17 oct, 21:08, Anthony  wrote:
> Ordering by most recent comments would be great too.
>
> On Oct 17, 6:29 pm, Anthony  wrote:
>
>
>
> > Also, although ordering the logos randomly by default is a good idea,
> > it would also be helpful to allow the user to select ordering by most
> > recently submitted (and possibly by number of votes). At this point, I
> > have seen all the logos submitted so far, so when I check the site, I
> > just want to see the most recent submissions, which is difficult with
> > the logos ordered randomly (the random ordering is also a hassle when
> > returning from viewing/submitting comments because it re-randomizes
> > the list on each re-load).
>
> > Thanks.
>
> > Anthony
>
> > On Oct 17, 5:40 pm, Anthony  wrote:
>
> > > So, what's happening with the voting method? As already discussed at
> > > length, the one-vote-per-person method isn't a good idea with so many
> > > entries (particularly with sets of similar logos). For example, #5 and
> > > #17 are probably splitting votes.
>
> > > We really should implement one of the other suggested methods:
> > > * Approval Voting (vote for as many logos as you want): Probably the
> > > easiest to implement, and should handle the "clone" problem. (Still
> > > need the ability to change one's vote(s)).
> > > * Ratings: Though for this to work, either everyone has to rate every
> > > logo, or for each voter, each un-rated logo has to be assigned the
> > > lowest possible value (e.g., 1 star).
> > > * Ranking: Preferably using the Schulze method for tallying. Probably
> > > the most complex to implement.
>
> > > If we're not going to do any of the above, then at the very least, we
> > > should go back to showing the _number_ of votes for each logo (no need
> > > to show the names -- they should remain anonymous). That way, at least
> > > we could see if we are splitting (and possibly wasting) our votes and
> > > then shift our support to a logo we like that has a chance of winning.
>
> > > If we stick with the current voting method, with 50+ logos, we could
> > > easily end up with a "winner" that gets the support of only a small
> > > percentage of the voters.
>
> > > Also, is the voting deadline still Oct. 19?
>
> > > Thanks.
>
> > > Anthony
>
> > > On Oct 13, 5:17 pm, Bruno Rocha  wrote:
>
> > > > Martin Mulone made the logovote application.
>
> > > > I am hosting at my server
>
> > > > You can post logo ideas, and vote for you prefered logo.
>
> > > > Better if you made an transparent canvas .gif or .png maximum 250x70
>
> > > > Maximum of 10 uploads per user, Just one vote per user.
>
> > > > Take a look:http://blouweb.com/logovote/-Hidequoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -


Re: [web2py] Re: cache.ram Name error

2010-10-17 Thread Andrew Evans
is there already a logging system in place I can use form the looks of it
there is...

Forgive my noobishness


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
Good.

On Oct 17, 8:45 pm, "Martin.Mulone"  wrote:
> I think "Approval Voting" is better way than the current, easy to
> implement and I ready to do so what the others think?. Random is very
> annoying, and i dont believe that change anything in matter of votes.
> How about that after deadline for sending ideas (1 day after or two)
> have the 5 or 6 most votes logos, delete (hide) the others and reset
> votes.
>
> On 17 oct, 21:08, Anthony  wrote:
>
> > Ordering by most recent comments would be great too.
>
> > On Oct 17, 6:29 pm, Anthony  wrote:
>
> > > Also, although ordering the logos randomly by default is a good idea,
> > > it would also be helpful to allow the user to select ordering by most
> > > recently submitted (and possibly by number of votes). At this point, I
> > > have seen all the logos submitted so far, so when I check the site, I
> > > just want to see the most recent submissions, which is difficult with
> > > the logos ordered randomly (the random ordering is also a hassle when
> > > returning from viewing/submitting comments because it re-randomizes
> > > the list on each re-load).
>
> > > Thanks.
>
> > > Anthony
>
> > > On Oct 17, 5:40 pm, Anthony  wrote:
>
> > > > So, what's happening with the voting method? As already discussed at
> > > > length, the one-vote-per-person method isn't a good idea with so many
> > > > entries (particularly with sets of similar logos). For example, #5 and
> > > > #17 are probably splitting votes.
>
> > > > We really should implement one of the other suggested methods:
> > > > * Approval Voting (vote for as many logos as you want): Probably the
> > > > easiest to implement, and should handle the "clone" problem. (Still
> > > > need the ability to change one's vote(s)).
> > > > * Ratings: Though for this to work, either everyone has to rate every
> > > > logo, or for each voter, each un-rated logo has to be assigned the
> > > > lowest possible value (e.g., 1 star).
> > > > * Ranking: Preferably using the Schulze method for tallying. Probably
> > > > the most complex to implement.
>
> > > > If we're not going to do any of the above, then at the very least, we
> > > > should go back to showing the _number_ of votes for each logo (no need
> > > > to show the names -- they should remain anonymous). That way, at least
> > > > we could see if we are splitting (and possibly wasting) our votes and
> > > > then shift our support to a logo we like that has a chance of winning.
>
> > > > If we stick with the current voting method, with 50+ logos, we could
> > > > easily end up with a "winner" that gets the support of only a small
> > > > percentage of the voters.
>
> > > > Also, is the voting deadline still Oct. 19?
>
> > > > Thanks.
>
> > > > Anthony
>
> > > > On Oct 13, 5:17 pm, Bruno Rocha  wrote:
>
> > > > > Martin Mulone made the logovote application.
>
> > > > > I am hosting at my server
>
> > > > > You can post logo ideas, and vote for you prefered logo.
>
> > > > > Better if you made an transparent canvas .gif or .png maximum 250x70
>
> > > > > Maximum of 10 uploads per user, Just one vote per user.
>
> > > > > Take a look:http://blouweb.com/logovote/-Hidequotedtext -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
>


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
Upload link still causes ticket. Anybody else see this?


[web2py] Re: cache.ram Name error

2010-10-17 Thread mdipierro
The OS a logging system. Python has interface to it in the logging
module.

Web2py implements also app level logging by using the python logging
module. The difference is that each app has the option to log in a
different file. When you import a module, you either use Python level
logging or, if you want per app log, you specify which one by passing
the logger object.

On Oct 17, 7:46 pm, Andrew Evans  wrote:
> is there already a logging system in place I can use form the looks of it
> there is...
>
> Forgive my noobishness


[web2py] Re: Who made this? It is great!

2010-10-17 Thread weheh
There is a theme among systems for collecting information via forms
which lends itself to recursion. I built a form processing system 30
years ago that called itself to specify and process the forms that it
then used to build new forms for new apps. The forms comprised fields
in a db and the form engine supported real-time spreadsheet
functionality like Excel. This system by Lucas, which uses web2py to
build apps to build web2py apps, reminds me of that a lot. It's cool.


[web2py] tip of the day. The power of routes

2010-10-17 Thread mdipierro
Replace your web2py/routes.py with this:

- begin routes.py---
try: config=open('routes.conf','r').read()
except: config=''
def auto_in(apps):
routes=[
('/robots.txt','/welcome/static/robots.txt'),
('/favicon.ico','/welcome/static/favicon.ico'),
('/admin$a','/admin$a'),
]
for a,b in [x.strip().split() for x in apps.split('\n') \
if x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
('.*:https?://(.*\.)?%s:$method /static/$a' % a,'%s/static/
$a' % app),
('.*:https?://(.*\.)?%s:$method /appadmin/$a' % a,'%s/
appadmin/$a' % app),
('.*:https?://(.*\.)?%s:$method /$a' % a,'%s/$a' % b),
]
return routes

def auto_out(apps):
routes=[]
for a,b in [x.strip().split() for x in apps.split('\n') \
if x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('%s/static/$a' % app,'static/$a'),
('%s/appadmin/$a' % app, '/appadmin/$a'),
('%s/$a' % b, '/$a'),
]
return routes

routes_in=auto_in(config)
routes_out=auto_out(config)
--- END ---

what does it do? It writes routes for you based on a simpler routing
configuration file called routes.conf. here is an example:

- BEGIN routes.conf---
127.0.0.1   /examples/default
domain1.com /app1/default
domain2.com /app2/default
domain3.com /app3/default
- END --

It maps a domain (the left had side) into an app and it shortens the
URLs for the app, by removing the listed path prefix. That means

http://domain1.com/index will be mapped into  /app1/default/index
http://domain2.com/index will be mapped into  /app2/default/index

It is safe in that it preserves admin, appadmin, static files,
favicon.ico and robots.txt.

http://domain1.com/favicon.ico
http://domain1.com/robots.txt
http://domain1.com/admin/...   /admin/...
http://domain1.com/appadmin/...  /app1/appadmin/...
http://domain1.com/static/...  /app1/static/...

and vice-versa.

It does assume one app per domain.

I think something like this should be default since lots of people
find routes.py hard to work with.
Comments? Suggestions?

Massimo


[web2py] Re: tip of the day. The power of routes

2010-10-17 Thread mdipierro
I put the script in trunk under scripts/autoroutes.py
to use it

cp scripts/autoroutes.py routes.py

then edit routes.conf

as explained below:

On Oct 17, 9:03 pm, mdipierro  wrote:
> Replace your web2py/routes.py with this:
>
> - begin routes.py---
> try: config=open('routes.conf','r').read()
> except: config=''
> def auto_in(apps):
>     routes=[
>         ('/robots.txt','/welcome/static/robots.txt'),
>         ('/favicon.ico','/welcome/static/favicon.ico'),
>         ('/admin$a','/admin$a'),
>         ]
>     for a,b in [x.strip().split() for x in apps.split('\n') \
>         if x.strip() and not x.strip().startswith('#')]:
>         if not b.startswith('/'): b='/'+b
>         if b.endswith('/'): b=b[:-1]
>         app = b.split('/')[1]
>         routes+=[
>             ('.*:https?://(.*\.)?%s:$method /' % a,'%s' % b),
>             ('.*:https?://(.*\.)?%s:$method /static/$a' % a,'%s/static/
> $a' % app),
>             ('.*:https?://(.*\.)?%s:$method /appadmin/$a' % a,'%s/
> appadmin/$a' % app),
>             ('.*:https?://(.*\.)?%s:$method /$a' % a,'%s/$a' % b),
>             ]
>     return routes
>
> def auto_out(apps):
>     routes=[]
>     for a,b in [x.strip().split() for x in apps.split('\n') \
>         if x.strip() and not x.strip().startswith('#')]:
>         if not b.startswith('/'): b='/'+b
>         if b.endswith('/'): b=b[:-1]
>         app = b.split('/')[1]
>         routes+=[
>             ('%s/static/$a' % app,'static/$a'),
>             ('%s/appadmin/$a' % app, '/appadmin/$a'),
>             ('%s/$a' % b, '/$a'),
>             ]
>     return routes
>
> routes_in=auto_in(config)
> routes_out=auto_out(config)
> --- END ---
>
> what does it do? It writes routes for you based on a simpler routing
> configuration file called routes.conf. here is an example:
>
> - BEGIN routes.conf---
> 127.0.0.1       /examples/default
> domain1.com /app1/default
> domain2.com /app2/default
> domain3.com /app3/default
> - END --
>
> It maps a domain (the left had side) into an app and it shortens the
> URLs for the app, by removing the listed path prefix. That means
>
> http://domain1.com/indexwill be mapped into  
> /app1/default/indexhttp://domain2.com/indexwill be mapped into  
> /app2/default/index
>
> It is safe in that it preserves admin, appadmin, static files,
> favicon.ico and robots.txt.
>
> http://domain1.com/favicon.icohttp://domain1.com/robots.txthttp://domain1.com/admin/...
>    /admin/...http://domain1.com/appadmin/...  
> /app1/appadmin/...http://domain1.com/static/...  /app1/static/...
>
> and vice-versa.
>
> It does assume one app per domain.
>
> I think something like this should be default since lots of people
> find routes.py hard to work with.
> Comments? Suggestions?
>
> Massimo


Re: [web2py] Re: Vote for a new logo

2010-10-17 Thread Bruno Rocha
I solved the problem with upload link, that was a typo,

there is a function clalled pretty_exception, and upload was calling
pretty_expeptions

But, that was called because you already uploades 10 logos, the system
allows just 10 by user.

2010/10/17 weheh 

> Upload link still causes ticket. Anybody else see this?




-- 

http://rochacbruno.com.br


Re: [web2py] Re: Vote for a new logo

2010-10-17 Thread Bruno Rocha
The Dealine is still 19 for send logos, and 21 for vote.

That is the round 1, we can have round 2 with the 10 best voted, one week
more for the second round, No uploads just votes.

For the second round we can change rules and implement some new ideas as
commented here.

--

BTW: I keep the track of "web2py" in twitter, identica, orkut, facebook,
reddit, googleAlerts, etc..
99% of the people, when talking about web2py, are talking about the new
visual stylle.

Everyone likes that, and that already is the new face of web2py, I think if
we have to change, dont have to change too much ( I like this idea
http://blouweb.com/logovote/default/index?logoid=17 )  It keeps the actual
style and gives us an Icon (that could be improved). I think it is clean,
beauty, soothing enought and enterprise as well.

There are other important things about this logo (17 or 5), it is nice with
any background, the main idea came from Massimo, it differs web2py from
web.py, It is easy to draw, easy to print, easy to remember.

The upper case in that is more closer to WEB2PY (because we have DAL, DIV,
FORM..)

In the beggining it is strange to switch from web2py to WEB2PY, but IMO
UPPER case fits better in for logo, and everyone will differ web.py form
WEB2PY.









2010/10/17 Anthony 

> So, what's happening with the voting method? As already discussed at
> length, the one-vote-per-person method isn't a good idea with so many
> entries (particularly with sets of similar logos). For example, #5 and
> #17 are probably splitting votes.
>
> We really should implement one of the other suggested methods:
> * Approval Voting (vote for as many logos as you want): Probably the
> easiest to implement, and should handle the "clone" problem. (Still
> need the ability to change one's vote(s)).
> * Ratings: Though for this to work, either everyone has to rate every
> logo, or for each voter, each un-rated logo has to be assigned the
> lowest possible value (e.g., 1 star).
> * Ranking: Preferably using the Schulze method for tallying. Probably
> the most complex to implement.
>
> If we're not going to do any of the above, then at the very least, we
> should go back to showing the _number_ of votes for each logo (no need
> to show the names -- they should remain anonymous). That way, at least
> we could see if we are splitting (and possibly wasting) our votes and
> then shift our support to a logo we like that has a chance of winning.
>
> If we stick with the current voting method, with 50+ logos, we could
> easily end up with a "winner" that gets the support of only a small
> percentage of the voters.
>
> Also, is the voting deadline still Oct. 19?
>
> Thanks.
>
> Anthony
>
> On Oct 13, 5:17 pm, Bruno Rocha  wrote:
> > Martin Mulone made the logovote application.
> >
> > I am hosting at my server
> >
> > You can post logo ideas, and vote for you prefered logo.
> >
> > Better if you made an transparent canvas .gif or .png maximum 250x70
> >
> > Maximum of 10 uploads per user, Just one vote per user.
> >
> > Take a look:http://blouweb.com/logovote/
>



-- 

http://rochacbruno.com.br


Re: [web2py] Who made this? It is great!

2010-10-17 Thread Bruno Rocha
That could be a good start to a Killer CMS built with WEB2PY.

I think he uses YAML to generate the models, but I am going to check with
him, and try to get the source.

2010/10/17 mdipierro 

> http://vimeo.com/15886413
>
> I can see lots of uses for it.
>
> I have some questions: does it store meta-info in the db? Or does it
> uses something like YAML? Where can we get it?
>
> Some suggestions for improvement:
> - a checkbox for [use auth]
> - allow adding fields for auth_user
> - have a checkbox [use janrain] and seup janrain key/domain
> - use the same interface that you use to create tables to create
> controller actions (even if initially empty) (perhaps allows adding
> widgets from plugin_wiki)
> - It would be nice to have a way to display graphically the structure
> of an app as a tree. Two main branches: tables, pages
> - merge with http://web2py.com/layouts/plugin_layouts/index (perhaps
> just pick best layouts)
>



-- 

http://rochacbruno.com.br


Re: [web2py] Re: Where's Errata Page for Web2py 3rd Edition

2010-10-17 Thread Bruno Rocha
WOW, I need that!

It is very difficult to get this in Brazil (too much taxes for import), and
very hard to deal with payment methods, and a very very expensive ship.

But, I will try to purchase one copy for me!

2010/10/17 NetAdmin 

>
> Bruno,
>
> Here are pictures of the Web2py Manual 3rd Edition.
>
> I like it!
>
> http://www.setbit.us/IMG_0107.JPG
> http://www.setbit.us/IMG_0108.JPG
> http://www.setbit.us/IMG_0109.JPG
>
> Mr.NetAdmin
>
> On Oct 14, 4:33 pm, Bruno Rocha  wrote:
> > I think by now, the book have no option for doing that.
> >
> > (BTW: the source for the app used in book is available on /appliances, so
> if
> > anybody has a good idea to implement a comment system there)
> >
> > you have to send it directly to the group (one of the editors can
> correct),
> > or directly to Massimo.
> >
> > What I used to do is every time when I find something to correct I open
> one
> > draf on my gmail, and note there. after colecting some notes, I correct (
> or
> > send to Massimo).
> >
> > @NetAdmin did you buy a printed version, or printed from the pdf? I
> bought
> > the pdf, and I want a printed version.
> > I dont know if I will print it in my printer, or if I will buy it printed
> by
> > LuLu.
> >
> > If your copy is from LuLu, can you take a picture? I want to see if it is
> > different or if it is equal to printing by my own.
> >
> > Tks
> >
> > 2010/10/14 NetAdmin 
> >
> >
> >
> > > That's good, but I like to read my printed edition on the train, and
> > > would like to make corrections there.
> >
> > > I don't have any corrections at the moment.
> >
> > > Thanks!
> >
> > > On Oct 14, 4:08 pm, cjrh  wrote:
> > > > On Oct 14, 10:53 pm, NetAdmin  wrote:
> >
> > > > > I'd like to make notes of  any typos / errors in my printed
> edition.
> >
> > > > Send me all errors and typos, I'll fix them (almost) immediately in
> > > > the online book.
> >
> > --
> >
> > http://rochacbruno.com.br
>



-- 

http://rochacbruno.com.br


Re: [web2py] Re: Vote for a new logo

2010-10-17 Thread Bruno Rocha
Note that in book cover: http://www.setbit.us/IMG_0108.JPG

WEB2PY is UPPER CASE too!

2010/10/18 Bruno Rocha 

> The Dealine is still 19 for send logos, and 21 for vote.
>
> That is the round 1, we can have round 2 with the 10 best voted, one week
> more for the second round, No uploads just votes.
>
> For the second round we can change rules and implement some new ideas as
> commented here.
>
> --
>
> BTW: I keep the track of "web2py" in twitter, identica, orkut, facebook,
> reddit, googleAlerts, etc..
> 99% of the people, when talking about web2py, are talking about the new
> visual stylle.
>
> Everyone likes that, and that already is the new face of web2py, I think if
> we have to change, dont have to change too much ( I like this idea
> http://blouweb.com/logovote/default/index?logoid=17 )  It keeps the actual
> style and gives us an Icon (that could be improved). I think it is clean,
> beauty, soothing enought and enterprise as well.
>
> There are other important things about this logo (17 or 5), it is nice with
> any background, the main idea came from Massimo, it differs web2py from
> web.py, It is easy to draw, easy to print, easy to remember.
>
> The upper case in that is more closer to WEB2PY (because we have DAL, DIV,
> FORM..)
>
> In the beggining it is strange to switch from web2py to WEB2PY, but IMO
> UPPER case fits better in for logo, and everyone will differ web.py form
> WEB2PY.
>
>
>
>
>
>
>
>
>
> 2010/10/17 Anthony 
>
> So, what's happening with the voting method? As already discussed at
>> length, the one-vote-per-person method isn't a good idea with so many
>> entries (particularly with sets of similar logos). For example, #5 and
>> #17 are probably splitting votes.
>>
>> We really should implement one of the other suggested methods:
>> * Approval Voting (vote for as many logos as you want): Probably the
>> easiest to implement, and should handle the "clone" problem. (Still
>> need the ability to change one's vote(s)).
>> * Ratings: Though for this to work, either everyone has to rate every
>> logo, or for each voter, each un-rated logo has to be assigned the
>> lowest possible value (e.g., 1 star).
>> * Ranking: Preferably using the Schulze method for tallying. Probably
>> the most complex to implement.
>>
>> If we're not going to do any of the above, then at the very least, we
>> should go back to showing the _number_ of votes for each logo (no need
>> to show the names -- they should remain anonymous). That way, at least
>> we could see if we are splitting (and possibly wasting) our votes and
>> then shift our support to a logo we like that has a chance of winning.
>>
>> If we stick with the current voting method, with 50+ logos, we could
>> easily end up with a "winner" that gets the support of only a small
>> percentage of the voters.
>>
>> Also, is the voting deadline still Oct. 19?
>>
>> Thanks.
>>
>> Anthony
>>
>> On Oct 13, 5:17 pm, Bruno Rocha  wrote:
>> > Martin Mulone made the logovote application.
>> >
>> > I am hosting at my server
>> >
>> > You can post logo ideas, and vote for you prefered logo.
>> >
>> > Better if you made an transparent canvas .gif or .png maximum 250x70
>> >
>> > Maximum of 10 uploads per user, Just one vote per user.
>> >
>> > Take a look:http://blouweb.com/logovote/
>>
>
>
>
> --
>
> http://rochacbruno.com.br
>



-- 

http://rochacbruno.com.br


Re: [web2py] Re: Vote for a new logo

2010-10-17 Thread Bruno Rocha
Perfect! it is UPPER case in logo, but lower case in title. Just what we
have today in the main website!

2010/10/18 Bruno Rocha 

> Note that in book cover: http://www.setbit.us/IMG_0108.JPG
>
> WEB2PY is UPPER CASE too!
>
> 2010/10/18 Bruno Rocha 
>
> The Dealine is still 19 for send logos, and 21 for vote.
>>
>> That is the round 1, we can have round 2 with the 10 best voted, one week
>> more for the second round, No uploads just votes.
>>
>> For the second round we can change rules and implement some new ideas as
>> commented here.
>>
>> --
>>
>> BTW: I keep the track of "web2py" in twitter, identica, orkut, facebook,
>> reddit, googleAlerts, etc..
>> 99% of the people, when talking about web2py, are talking about the new
>> visual stylle.
>>
>> Everyone likes that, and that already is the new face of web2py, I think
>> if we have to change, dont have to change too much ( I like this idea
>> http://blouweb.com/logovote/default/index?logoid=17 )  It keeps the
>> actual style and gives us an Icon (that could be improved). I think it is
>> clean, beauty, soothing enought and enterprise as well.
>>
>> There are other important things about this logo (17 or 5), it is nice
>> with any background, the main idea came from Massimo, it differs web2py from
>> web.py, It is easy to draw, easy to print, easy to remember.
>>
>> The upper case in that is more closer to WEB2PY (because we have DAL, DIV,
>> FORM..)
>>
>> In the beggining it is strange to switch from web2py to WEB2PY, but IMO
>> UPPER case fits better in for logo, and everyone will differ web.py form
>> WEB2PY.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> 2010/10/17 Anthony 
>>
>> So, what's happening with the voting method? As already discussed at
>>> length, the one-vote-per-person method isn't a good idea with so many
>>> entries (particularly with sets of similar logos). For example, #5 and
>>> #17 are probably splitting votes.
>>>
>>> We really should implement one of the other suggested methods:
>>> * Approval Voting (vote for as many logos as you want): Probably the
>>> easiest to implement, and should handle the "clone" problem. (Still
>>> need the ability to change one's vote(s)).
>>> * Ratings: Though for this to work, either everyone has to rate every
>>> logo, or for each voter, each un-rated logo has to be assigned the
>>> lowest possible value (e.g., 1 star).
>>> * Ranking: Preferably using the Schulze method for tallying. Probably
>>> the most complex to implement.
>>>
>>> If we're not going to do any of the above, then at the very least, we
>>> should go back to showing the _number_ of votes for each logo (no need
>>> to show the names -- they should remain anonymous). That way, at least
>>> we could see if we are splitting (and possibly wasting) our votes and
>>> then shift our support to a logo we like that has a chance of winning.
>>>
>>> If we stick with the current voting method, with 50+ logos, we could
>>> easily end up with a "winner" that gets the support of only a small
>>> percentage of the voters.
>>>
>>> Also, is the voting deadline still Oct. 19?
>>>
>>> Thanks.
>>>
>>> Anthony
>>>
>>> On Oct 13, 5:17 pm, Bruno Rocha  wrote:
>>> > Martin Mulone made the logovote application.
>>> >
>>> > I am hosting at my server
>>> >
>>> > You can post logo ideas, and vote for you prefered logo.
>>> >
>>> > Better if you made an transparent canvas .gif or .png maximum 250x70
>>> >
>>> > Maximum of 10 uploads per user, Just one vote per user.
>>> >
>>> > Take a look:http://blouweb.com/logovote/
>>>
>>
>>
>>
>> --
>>
>> http://rochacbruno.com.br
>>
>
>
>
> --
>
> http://rochacbruno.com.br
>



-- 

http://rochacbruno.com.br


[web2py] Re: Vote for a new logo

2010-10-17 Thread weheh
I think logo really should be lower case. Anyway, my link logo won't
work as well upper case, I think.

On Oct 17, 11:01 pm, Bruno Rocha  wrote:
> Perfect! it is UPPER case in logo, but lower case in title. Just what we
> have today in the main website!
>
> 2010/10/18 Bruno Rocha 
>
>
>
> > Note that in book cover:http://www.setbit.us/IMG_0108.JPG
>
> > WEB2PY is UPPER CASE too!
>
> > 2010/10/18 Bruno Rocha 
>
> > The Dealine is still 19 for send logos, and 21 for vote.
>
> >> That is the round 1, we can have round 2 with the 10 best voted, one week
> >> more for the second round, No uploads just votes.
>
> >> For the second round we can change rules and implement some new ideas as
> >> commented here.
>
> >> --
>
> >> BTW: I keep the track of "web2py" in twitter, identica, orkut, facebook,
> >> reddit, googleAlerts, etc..
> >> 99% of the people, when talking about web2py, are talking about the new
> >> visual stylle.
>
> >> Everyone likes that, and that already is the new face of web2py, I think
> >> if we have to change, dont have to change too much ( I like this idea
> >>http://blouweb.com/logovote/default/index?logoid=17)  It keeps the
> >> actual style and gives us an Icon (that could be improved). I think it is
> >> clean, beauty, soothing enought and enterprise as well.
>
> >> There are other important things about this logo (17 or 5), it is nice
> >> with any background, the main idea came from Massimo, it differs web2py 
> >> from
> >> web.py, It is easy to draw, easy to print, easy to remember.
>
> >> The upper case in that is more closer to WEB2PY (because we have DAL, DIV,
> >> FORM..)
>
> >> In the beggining it is strange to switch from web2py to WEB2PY, but IMO
> >> UPPER case fits better in for logo, and everyone will differ web.py form
> >> WEB2PY.
>
> >> 2010/10/17 Anthony 
>
> >> So, what's happening with the voting method? As already discussed at
> >>> length, the one-vote-per-person method isn't a good idea with so many
> >>> entries (particularly with sets of similar logos). For example, #5 and
> >>> #17 are probably splitting votes.
>
> >>> We really should implement one of the other suggested methods:
> >>> * Approval Voting (vote for as many logos as you want): Probably the
> >>> easiest to implement, and should handle the "clone" problem. (Still
> >>> need the ability to change one's vote(s)).
> >>> * Ratings: Though for this to work, either everyone has to rate every
> >>> logo, or for each voter, each un-rated logo has to be assigned the
> >>> lowest possible value (e.g., 1 star).
> >>> * Ranking: Preferably using the Schulze method for tallying. Probably
> >>> the most complex to implement.
>
> >>> If we're not going to do any of the above, then at the very least, we
> >>> should go back to showing the _number_ of votes for each logo (no need
> >>> to show the names -- they should remain anonymous). That way, at least
> >>> we could see if we are splitting (and possibly wasting) our votes and
> >>> then shift our support to a logo we like that has a chance of winning.
>
> >>> If we stick with the current voting method, with 50+ logos, we could
> >>> easily end up with a "winner" that gets the support of only a small
> >>> percentage of the voters.
>
> >>> Also, is the voting deadline still Oct. 19?
>
> >>> Thanks.
>
> >>> Anthony
>
> >>> On Oct 13, 5:17 pm, Bruno Rocha  wrote:
> >>> > Martin Mulone made the logovote application.
>
> >>> > I am hosting at my server
>
> >>> > You can post logo ideas, and vote for you prefered logo.
>
> >>> > Better if you made an transparent canvas .gif or .png maximum 250x70
>
> >>> > Maximum of 10 uploads per user, Just one vote per user.
>
> >>> > Take a look:http://blouweb.com/logovote/
>
> >> --
>
> >>http://rochacbruno.com.br
>
> > --
>
> >http://rochacbruno.com.br
>
> --
>
> http://rochacbruno.com.br


[web2py] Re: Need help installing MySQLdb in Mac OSX

2010-10-17 Thread Franklin Freitas
Hi, the thing is that MySQLdb is not even working outside the Web2py
environment. I haven't been able to make it work in the regular Python
interpreter. I tried copying everything to the Web2py sites-packages
folder, but it didn't work

Thanks

Franklin


On Oct 17, 8:03 pm, mart  wrote:
> you can throw in in the installed python/lib folder, or in site-
> packages folder (sibling to the applications folder of the web2py root
> dir, or do an export within your scripts (controller?),or my
> favorite, I usually do web2py stuff with Aptana,so, i throw of copy of
> all dependencies within my project and reference it there... so, many
> possibilities, depends how you prefer to reference it
>
> Hope it helps,
> Mart :)
>
> On Oct 17, 7:11 pm, Franklin Freitas 
> wrote:
>
>
>
> > Has anyone been able to install MySQLdb in Mac OSX ???
>
> > I want to use it with Web2py but haven't been able to make it work.
> > I've read a whole bunch of forums saying how hard it is, I've done
> > everything I've reead about it without any results. I even used
> > macports as recommended by my Web2py teacher but it didn't work
> > either.
>
> > If anyone knows a sure way on how to achieve this I would appreciate
> > it.
>
> > Thanks for your time


[web2py] Re: Need help installing MySQLdb in Mac OSX

2010-10-17 Thread mart
hum.. let me check on my end to make sure I didn't miss mentioning
something. It has been a little while...

On Oct 18, 12:40 am, Franklin Freitas 
wrote:
> Hi, the thing is that MySQLdb is not even working outside the Web2py
> environment. I haven't been able to make it work in the regular Python
> interpreter. I tried copying everything to the Web2py sites-packages
> folder, but it didn't work
>
> Thanks
>
> Franklin
>
> On Oct 17, 8:03 pm, mart  wrote:
>
> > you can throw in in the installed python/lib folder, or in site-
> > packages folder (sibling to the applications folder of the web2py root
> > dir, or do an export within your scripts (controller?),or my
> > favorite, I usually do web2py stuff with Aptana,so, i throw of copy of
> > all dependencies within my project and reference it there... so, many
> > possibilities, depends how you prefer to reference it
>
> > Hope it helps,
> > Mart :)
>
> > On Oct 17, 7:11 pm, Franklin Freitas 
> > wrote:
>
> > > Has anyone been able to install MySQLdb in Mac OSX ???
>
> > > I want to use it with Web2py but haven't been able to make it work.
> > > I've read a whole bunch of forums saying how hard it is, I've done
> > > everything I've reead about it without any results. I even used
> > > macports as recommended by my Web2py teacher but it didn't work
> > > either.
>
> > > If anyone knows a sure way on how to achieve this I would appreciate
> > > it.
>
> > > Thanks for your time
>
>


[web2py] Newbie Parent/Child editing- The right way

2010-10-17 Thread Markandeya
Dear Friends of Web2py,
i am starting out with Web2py and Web Apps. I have a Parent Table of
Service Calls and a child table of Visits. When making an edit form
with both tables visible, one below the other, I need to be able to
click on a Parent (Service Calls) table cell or row and  have the
child (visits) table then filter or lookup the records for that Parent
Service Call Record. Then when a child record is edited or added it
needs to be shown in the child html table. This is a usual and
recurring situation in many webapps or pages. What is the best
practices way to do this? Bring in all 50-100 child records in a
dictionary or array and then have a function that displays them in the
Child Html table? or go to the database each time? And what event on
the page or in the html table can be used to show when a Cell or Row
is clicked by the user? Also if my Parent table has a field for number
of calls, then with each added or deleted call record the parent  db
and html table also has to be changed. How best to accomplish this.
  Maybe there is tutorial or example or simple web2py program/webapp
that might help.
  Thanks for putting up with beginners ignorance. Any guidance will be
welcome, Thanks Markandeya