[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-11 Thread Vineet
I will give a very simplified example of my task (pl. excuse me if it
is still verbose).

A form deals with Automobile Vehicle Models - Warranty Master.
It displays the model names (of vehicles).
User selects a model to modify warranty details.
The form displays : 1) select basic warranty and 2) select extended
warranty.

Vehicle model master--
db.define_table('mdl',
  Field('mdlid','id'),
  Field('mdlnm',unique=True),
  format='%(mdlnm)s')

Basic warranty master--
db.define_table('wr',
  Field('wrid', 'id'),
  Field('wrnm',unique=True),
  format='%(wrnm)s')

Extended warranty master--
db.define_table('extwr',
  Field('extwrid', 'id'),
  Field('extwrnm',unique=True),
  format='%(extwrnm)s')
(these tables are filled from separate forms)

In our form, the user may add/edit/delete data in these tables through
a single form--

Table for recording modelwise basic warranty--
db.define_table('mdlwr',
  Field('mdlwrid','id'),
  Field('mdlid',db.mdl),
  Field('wrid', db.wr)

Table for recording modelwise extended warranty--
db.define_table('mdlextwr',
  Field('mdlextwrid','id'),
  Field('mdlid',db.mdl),
  Field('extwrid', db.extwr)

(why 2 tables when 1 would be sufficient? because these are required
for normalizing MySQL table-structures)

If any further explanation of my task is required, pl. tell me.

Thanks,

Vineet
=

On May 11, 12:21 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Can you make a concrete example? to some extend you can do this but in
 order to be general, it requires some programming. Provide an example
 I can can show I would do it.

 On May 10, 12:26 pm, Vineet vineet.deod...@gmail.com wrote:


  Hi,
  I have a task related to the below-referred thread (but with a
  different requirement).
  I havemultipleMySQL tables to be tackled in one form.
  The user will make changes to certain fields.
  As a result,
  table1 might require : insert or update or delete or no operation;
  table2 might require : insert or update or delete or no operation;
  table3 might require : insert or update or delete or no operation;

  I can't predict as to whattablewill require which operation.
  So it's not possible to hardcode the operation like
  form[0].insert(2,TR...etc.

  (In VFP, I am using a class called as CursorAdaptor (a visual DAL tool
  out there), which monitors these operations on tables and executes
  them to the database).

  A similar functionality would be of a great value to me inweb2py.

  Is there any way to achieve this inweb2py?

  Thanks in advance for your advice.

  Vineet.
  

  On Nov 21 2008, 7:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   You have the option of using form=SQLFORM and then form[0].insert(2,TR
   (...)) the rows from the othertable.
   It may be easier to create the form using form_factory.

   Massimo

   On Nov 21, 12:34 am, mmstud mms...@gmail.com wrote:

Im thinking to create an insert and update form with fields taken from
   multipletables. Person has address, email and phone instances on
separate tables, but for simple interaction, they should be present on
same form view. What is the best way to solve this kind of situation
at the moment, does SQLFORM the job?

On update form there would be combobox with input and selectbox
combined. Input for new email, address, phone entries and select for
possible older entries.

-Marko


[web2py] doc bug report

2011-05-11 Thread Manuele Pesenti

Hi,

at this link
http://www.web2py.com/book/default/chapter/07#Validators-with-Dependencies

is still reported a wrong example that uses a not existent validator 
IS_SAME_AS instead of IS_EQUAL_TO


is it the right place to report this kind of stuff?

Thanks
Manuele


[web2py] dependent drop down list... sometimes they come back

2011-05-11 Thread Manuele Pesenti

Hi,
Reading past posts about this topic and the book I didn't realize how to 
solve it. Imagine to have the subsequent controller called bar


d = dict(
a=[1,2,3],
b=[4,5,6])
def foo(k):
if k in d:
return d[k]
else:
l = []
for i in d.values():
l += i
return l

def bar():
form = SQLFORM.factory(
Field('username', requires=IS_NOT_EMPTY()),
Field('key', requires=IS_IN_SET(d.keys())),
Field('value', requires=IS_IN_SET(foo(request.vars.key
if form.accepts(request.vars, session):
pass # or take some action
return dict(form=form)

What's the Ajax I have to add to my view in order to modify on the fly 
the drop down list of the value field?


Thank you very mutch in advance
Cheers
Manuele


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-11 Thread pbreit
Normalizing is not always the best approach. If the database has not yet 
been designed, perhaps reconsider. I still don't really understand what you 
are trying to do but 5 small tables might not be necessary.

I would suggest getting some code working with 2 tables an then go from 
there.

Some options:
http://web2py.com/book/default/chapter/07#One-form-for-multiple-tables
http://web2py.com/book/default/chapter/07#Multiple-forms-per-page

Another approach would to use FORM or SQLFORM.factory and then coding the 
database updates. You lose some of the Web2py features but it might still be 
the easiest way to do it.

But my first suggestion would be to try and simplify what you are intending 
to do.


Re: [web2py] Re: Autocomplete widget on same table

2011-05-11 Thread Johann Spies
On 9 May 2011 15:16, Massimo Di Pierro massimo.dipie...@gmail.com wrote:

 The widget take as argument the table itself which is not yet defined.
 you have to do it in two steps:

 db.define_table('doccenter', Field('doc_nr', type='string',
 length=50,
  requires=IS_NOT_IN_DB(db, 'doccenter.doc_nr'),
   )

 db.doccenter.doc_nr.widget =SQLFORM.widgets.autocomplete(
   request, db.doccenter.doc_nr, limitby=(0,20),min_length=2,
  id_field=db.doccenter.id))




While this works as far as the autocomplete widget is concerned another
problem has arised:

I get an error: 'Value already in database or empty' when the widget is used
with crud when used in the following way:

The user has to enter a doc_nr where the history of generating the document
references are so complex that it not worth while to try and write code to
do that automatically.  I want to use the autocomplete widget to show the
user what is already in the database as far as similar references are
concerned to enable him/her to type in a unique one.  I know this is not the
usual usage of the autocomplete widget, and I can continue to use it with
SQLFORM.factory but would like to know whether I can bypass this problem
using CRUD.

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


[web2py] Enabling logging

2011-05-11 Thread Ed Greenberg
Hi, I'd like to enable logging so I can see the various warnings that
web2py might be issuing.

I am running Version 1.91.6 (2011-01-03 17:55:14), using apache2 and
WSDL on Centos 5.5.

I copied logging.example.conf to logging.conf, and restarted apache.

I would expect to see logging on the system console.   I get nothing.
I tried enabling handler=linuxSysLogHandler (both in 'keys' and on
each logging stanza) but still no luck.

I have no clue what I might be doing wrong. Does anybody know?

I was led to this by the fact that web2py can't send email, but I'll
put that in a separate post.

Thanks,

Ed


[web2py] Re: Enabling logging

2011-05-11 Thread Ed Greenberg
I found my log messages. When using consoleHandler with apache/WSDL,
apparently, the logging messages go to the server error log, not the
console.


[web2py] Mail.send failure:login() takes exactly 3 arguments (2 given)

2011-05-11 Thread Ed Greenberg
When trying to send registration or lost password email, web2py
flashes that it cannot send email (so registration fails) and logs

[Wed May 11 10:07:31 2011] [error] 2011-05-11 10:07:31,049 - web2py -
WARNING - Mail.send failure:login() takes exactly 3 arguments (2
given)

My app's db.py says:
mail.settings.server = '127.0.0.1:25'  # your SMTP server
mail.settings.sender = 'nore...@xxx.com' # your email
mail.settings.login = None  # your credentials or None
mail.settings.tls = False

What might be wrong?


[web2py] login fails for ajax components

2011-05-11 Thread selecta
i have never botherd with this bug very much, but i think this could
be solved by giving the login form a proper action and the class
no_trap


[web2py] Re: login fails for ajax components

2011-05-11 Thread selecta
ok maybe a bit more info
if you have a component that has a @auth.requires_login() decorator
the login form shows if you are not logged in, however the login
fails,
this is i think due to trap_form of the component
and could be prevented if the login form gets a no_trap class

On May 11, 12:46 pm, selecta gr...@delarue-berlin.de wrote:
 i have never botherd with this bug very much, but i think this could
 be solved by giving the login form a proper action and the class
 no_trap


[web2py] Re: doc bug report

2011-05-11 Thread DenesL

Good catch, thank you.
Fixed.
(and yes, this is the place to report such things)


On May 11, 3:27 am, Manuele Pesenti manuele.pese...@gmail.com wrote:
 Hi,

 at this 
 linkhttp://www.web2py.com/book/default/chapter/07#Validators-with-Depende...

 is still reported a wrong example that uses a not existent validator
 IS_SAME_AS instead of IS_EQUAL_TO

 is it the right place to report this kind of stuff?

 Thanks
         Manuele


[web2py] Re: Why continue to use this obscure phrase 'enterprise'?

2011-05-11 Thread DenesL

LOL

On May 11, 1:30 am, mart msenecal...@gmail.com wrote:
 that's hilarious! I think it may be synonymous to enterprise

 as a note (just because my blood/caffeine ratio hit the roof)... @ my
 previous employment, my group was just an acquisition... no,no,no,...
 we were THE acquisition that kept loosing money, tones of money...
 (I.e. 2 years in, and IT would still ask... who? what group?... never
 heard of it! (no lie)). any way at some point, someone well paid had a
 flash of genius!: hey, let's add 'ES' (Enterprise Suite) at the end
 of of the product!... well... a year later, our  business unit name
 was actually mentioned at one of those all hands we had every now
 and then... and a little later after that, the product was selling
 like crazy, actually turning a huge profit!

 Anyways, Enterprise doesn't mean anything, unless 1) someone thinks
 it should and 2) someone else believes it.

 Mart


[web2py] Re: dependent drop down list... sometimes they come back

2011-05-11 Thread DenesL
Hi Manuele,

1) 'value' ultimately depends on a static dictionary (d)
2) web2py executes models/controllers on every request

then you would have to store the dictionary in the session (or in the
DB), as shown in
http://web2py.com/book/default/chapter/03#Let%27s-Count



On May 11, 4:22 am, Manuele Pesenti manuele.pese...@gmail.com wrote:
 Hi,
 Reading past posts about this topic and the book I didn't realize how to
 solve it. Imagine to have the subsequent controller called bar

 d = dict(
          a=[1,2,3],
          b=[4,5,6])
 def foo(k):
      if k in d:
          return d[k]
      else:
          l = []
          for i in d.values():
              l += i
          return l

 def bar():
      form = SQLFORM.factory(
          Field('username', requires=IS_NOT_EMPTY()),
          Field('key', requires=IS_IN_SET(d.keys())),
          Field('value', requires=IS_IN_SET(foo(request.vars.key
      if form.accepts(request.vars, session):
          pass # or take some action
      return dict(form=form)

 What's the Ajax I have to add to my view in order to modify on the fly
 the drop down list of the value field?

 Thank you very mutch in advance
 Cheers
         Manuele


[web2py] Re: Mail.send failure:login() takes exactly 3 arguments (2 given)

2011-05-11 Thread Massimo Di Pierro
gluon/tools.py contains this code:

if self.settings.login != None:
...
server.login(*self.settings.login.split(':',1))

I think you must have somewhere a statement like

auth.settings.login = ...

and the ... is missing a : separating username and password.


On May 11, 5:13 am, Ed Greenberg greenberg...@gmail.com wrote:
 When trying to send registration or lost password email, web2py
 flashes that it cannot send email (so registration fails) and logs

 [Wed May 11 10:07:31 2011] [error] 2011-05-11 10:07:31,049 - web2py -
 WARNING - Mail.send failure:login() takes exactly 3 arguments (2
 given)

 My app's db.py says:
 mail.settings.server = '127.0.0.1:25'  # your SMTP server
 mail.settings.sender = 'nore...@xxx.com'         # your email
 mail.settings.login = None      # your credentials or None
 mail.settings.tls = False

 What might be wrong?


[web2py] Re: Why continue to use this obscure phrase 'enterprise'?

2011-05-11 Thread Massimo Di Pierro
LOL

so how about web2py: rapid development platform for your enterprise?

On May 11, 12:30 am, mart msenecal...@gmail.com wrote:
 that's hilarious! I think it may be synonymous to enterprise

 as a note (just because my blood/caffeine ratio hit the roof)... @ my
 previous employment, my group was just an acquisition... no,no,no,...
 we were THE acquisition that kept loosing money, tones of money...
 (I.e. 2 years in, and IT would still ask... who? what group?... never
 heard of it! (no lie)). any way at some point, someone well paid had a
 flash of genius!: hey, let's add 'ES' (Enterprise Suite) at the end
 of of the product!... well... a year later, our  business unit name
 was actually mentioned at one of those all hands we had every now
 and then... and a little later after that, the product was selling
 like crazy, actually turning a huge profit!

 Anyways, Enterprise doesn't mean anything, unless 1) someone thinks
 it should and 2) someone else believes it.

 Mart

 On May 11, 12:09 am, Jason Brower encomp...@gmail.com wrote:







  :) Let the customer decide what it means. That's the beauty of it. :P

  On 05/10/2011 07:57 PM, Massimo Di Pierro wrote:

   I love this:

   web2py - ninja programming went bananas!

   whatever it means.

   On May 10, 11:55 am, Marek Mollinrog...@gmail.com  wrote:
   I apologise for lack of study.

   Any way I remembered it bugged me while ago... and I saw thetitle
   on web2py homepage since I lately returned to using it...

   web2py - ninja programming went bananas!

   anyway its good this has changes since as said before in my world
   'enterprise' = legacy

   M,

   On 10 Maj, 16:17, villasvilla...@gmail.com  wrote:

   Hi Marek
   We had a long discussion about dropping the word 'enterprise' and what
   might be used instead. We had a lot of thoughts but Ninja and Bananas
   never came up LOL.  See link here:
  http://groups.google.com/group/web2py/browse_thread/thread/5d4b6e38ea...
   Regards, D


[web2py] Re: Why continue to use this obscure phrase 'enterprise'?

2011-05-11 Thread Massimo Di Pierro
Mart has a valid point. We need a tagline that differentiates us from
the many toys out there. Where by toy I mean half baked, unstable,
hard to maintain, constantly breaking backward compatibility, glued
frameworks.

On May 11, 12:30 am, mart msenecal...@gmail.com wrote:
 that's hilarious! I think it may be synonymous to enterprise

 as a note (just because my blood/caffeine ratio hit the roof)... @ my
 previous employment, my group was just an acquisition... no,no,no,...
 we were THE acquisition that kept loosing money, tones of money...
 (I.e. 2 years in, and IT would still ask... who? what group?... never
 heard of it! (no lie)). any way at some point, someone well paid had a
 flash of genius!: hey, let's add 'ES' (Enterprise Suite) at the end
 of of the product!... well... a year later, our  business unit name
 was actually mentioned at one of those all hands we had every now
 and then... and a little later after that, the product was selling
 like crazy, actually turning a huge profit!

 Anyways, Enterprise doesn't mean anything, unless 1) someone thinks
 it should and 2) someone else believes it.

 Mart

 On May 11, 12:09 am, Jason Brower encomp...@gmail.com wrote:







  :) Let the customer decide what it means. That's the beauty of it. :P

  On 05/10/2011 07:57 PM, Massimo Di Pierro wrote:

   I love this:

   web2py - ninja programming went bananas!

   whatever it means.

   On May 10, 11:55 am, Marek Mollinrog...@gmail.com  wrote:
   I apologise for lack of study.

   Any way I remembered it bugged me while ago... and I saw thetitle
   on web2py homepage since I lately returned to using it...

   web2py - ninja programming went bananas!

   anyway its good this has changes since as said before in my world
   'enterprise' = legacy

   M,

   On 10 Maj, 16:17, villasvilla...@gmail.com  wrote:

   Hi Marek
   We had a long discussion about dropping the word 'enterprise' and what
   might be used instead. We had a lot of thoughts but Ninja and Bananas
   never came up LOL.  See link here:
  http://groups.google.com/group/web2py/browse_thread/thread/5d4b6e38ea...
   Regards, D


Re: [web2py] Re: dependent drop down list... sometimes they come back

2011-05-11 Thread Manuele Pesenti

On 11/05/2011 15:04, DenesL wrote:

Hi Manuele,

1) 'value' ultimately depends on a static dictionary (d)
2) web2py executes models/controllers on every request

then you would have to store the dictionary in the session (or in the
DB), as shown in
http://web2py.com/book/default/chapter/03#Let%27s-Count


what's for? and what about the ajax for the view?
maybe I didn't understant the replay sorry :)

Manuele



[web2py] response.menu in web2py

2011-05-11 Thread sheM

I have a scenario where there are 2 methods. A and B
A uses form1
and
B uses form2

Now,  I need to pass a dynamic value of a variable from A( using
form1 ) to B .
I want to pass this variable to a menu item. Once the menu is clicked
that particular form should have my dynamic variable.

Is there a way to do this without using response.menu.append(blah) or
response.menu+=(blah)  ?

Thank you for stopping by and reading my query. Awaiting for you
answers.

Thanks Again.



[web2py] Re: response.menu in web2py

2011-05-11 Thread blackthorne
It would become easier to understand if you brought your concrete
example but why don't consider to use a single form for both purposes?
Even if that form allows 2 difference use cases (which shall be
appropriately handled by the right controller) that could help...

Alternatively you could use response.yourform and define a new var or
list, since response.menu is intended by convention to be used to
define contextual menus on your app, not so much to pass dynamic vars
from one form to the other.

Best regards

On May 11, 2:47 pm, sheM sheetal@gmail.com wrote:
 I have a scenario where there are 2 methods. A and B
 A uses form1
 and
 B uses form2

 Now,  I need to pass a dynamic value of a variable from A( using
 form1 ) to B .
 I want to pass this variable to a menu item. Once the menu is clicked
 that particular form should have my dynamic variable.

 Is there a way to do this without using response.menu.append(blah) or
 response.menu+=(blah)  ?

 Thank you for stopping by and reading my query. Awaiting for you
 answers.

 Thanks Again.


[web2py] How to limit the number of database objects in DAL

2011-05-11 Thread Arbie Samong
Hello, I was wondering if there's a way to limit the allowed number of
insertable objects in the DAL, without the need to manually check it
in the controller? Suppose I have a table of pineapples that is owned
by a user, and I want the user to only be allowed three(3) pineapples?

Of course that could be manually checked in the controller but I was
wondering if there's a way to enforce it in the model layer so less
code clutter in my controller script (I think).

Thanks,
Arbie


[web2py] Re: Mail.send failure:login() takes exactly 3 arguments (2 given)

2011-05-11 Thread VP
This message shows up in my error log too, but I haven't had time to
look into it.  It might have something to do with the configuration of
auth in db.py in the scaffolding code created when you create a new
app (through admin panel).


On May 11, 8:23 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 gluon/tools.py contains this code:

                 if self.settings.login != None:
                     ...
                     server.login(*self.settings.login.split(':',1))

 I think you must have somewhere a statement like

 auth.settings.login = ...

 and the ... is missing a : separating username and password.

 On May 11, 5:13 am, Ed Greenberg greenberg...@gmail.com wrote:







  When trying to send registration or lost password email, web2py
  flashes that it cannot send email (so registration fails) and logs

  [Wed May 11 10:07:31 2011] [error] 2011-05-11 10:07:31,049 - web2py -
  WARNING - Mail.send failure:login() takes exactly 3 arguments (2
  given)

  My app's db.py says:
  mail.settings.server = '127.0.0.1:25'  # your SMTP server
  mail.settings.sender = 'nore...@xxx.com'         # your email
  mail.settings.login = None      # your credentials or None
  mail.settings.tls = False

  What might be wrong?


[web2py] Re: How to limit the number of database objects in DAL

2011-05-11 Thread pbreit
You can probably do it with a Validator. It may need to be custom:
http://web2py.com/book/default/chapter/07#Validators

But I wouldn't worry so much about cluttering your controller. That's what 
it's for!


[web2py] Re: Why continue to use this obscure phrase 'enterprise'?

2011-05-11 Thread pbreit
I thought we were leaning towards Rapid development that scales?

[web2py] Re: login fails for ajax components

2011-05-11 Thread pbreit
It works fine for me. I'm not sure I understand what you are reporting. Is 
your site publicly viewable so we can see the problem?

[web2py] Re: How to limit the number of database objects in DAL

2011-05-11 Thread Massimo Di Pierro
I think may be easier to skick an if statement in the action

if db(db.table.owner==auth.user.id).count()=3:
redirect(URL(...))

On May 11, 9:41 am, Arbie Samong phek...@gmail.com wrote:
 Hello, I was wondering if there's a way to limit the allowed number of
 insertable objects in the DAL, without the need to manually check it
 in the controller? Suppose I have a table of pineapples that is owned
 by a user, and I want the user to only be allowed three(3) pineapples?

 Of course that could be manually checked in the controller but I was
 wondering if there's a way to enforce it in the model layer so less
 code clutter in my controller script (I think).

 Thanks,
 Arbie


Re: [web2py] Re: login fails for ajax components

2011-05-11 Thread danto
2011/5/11 pbreit pbreitenb...@gmail.com:
 It works fine for me. I'm not sure I understand what you are reporting. Is
 your site publicly viewable so we can see the problem?


I can second what selecta says.

pbreit, try this:


controller:
---
@auth.requires_login()
def asdf():
return dict(msg='blabla')

def index():
asdf = LOAD(r=request,f='asdf.load')
return dict(asdf=asdf)
---

in view, the login form to access 'asdf' function from index will
always fail. The proposed solution should work (been asdf =
LOAD(r=request,f='asdf.load', ajax_trap=False)(althougth
ajax_trap=False appareantly also seems to do ajax=False for me, I need
to check)


Re: [web2py] jQuery styling plugin wich allows you to skin form elements.

2011-05-11 Thread danto
2011/5/11 Bruno Rocha rochacbr...@gmail.com:

 Automatic form styles
 http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/

 plus:
 http://www.dfc-e.com/metiers/multimedia/opensource/jquery-fancyzoom/

 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]



this is great, altougth I almost see no difference from the builtin
widgets in the gnome3 default's theme, LOL


Re: [web2py] jQuery styling plugin wich allows you to skin form elements.

2011-05-11 Thread danto
2011/5/11 danto web2py.n...@gmail.com:
 2011/5/11 Bruno Rocha rochacbr...@gmail.com:

 Automatic form styles
 http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/

 plus:
 http://www.dfc-e.com/metiers/multimedia/opensource/jquery-fancyzoom/

 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]



 this is great, altougth I almost see no difference from the builtin
 widgets in the gnome3 default's theme, LOL


I forgot to say, thank you Bruno! :)


[web2py] Re: Why continue to use this obscure phrase 'enterprise'?

2011-05-11 Thread mart
here's a thought...

enterprise  -- I think we had the word first, in French, then we
loaned it out ;) LOL

In English enterprise, same word but doesn't conjugate the same
because the monks made verbs of the 3rd group impossible to pronounce
for non-native speakers. English is undertake, etymologically its
same as French, but lexically native/germanic:

entre et prendre, to take, in between ('entre' has it own story), or
take under (undertake), german Unternehmen (unter [EN=under],nehmen
[EN=take])

enterprise, as an action verb has many meanings and is found popular
idioms, but interestingly enough he or she who undertakes is an
undertaker where in French (least in my corner of the world),
'entrepreneur' is someone who builds houses (or housing projects)
because a general contractor literally translated is an anglicism...

the point? yup, i think there is one. web2py was initiated, developed
and is maintained largely by someone of Italian descent (because now
he sounds like a native English speaker in his videos ;) ), used by
folks in all time zones, in a variety of languages and has i18n built-
in... but the code is understood by all (well, sometimes sometimes I
understand ;) ). Web2py is cross-boarder where projects are undertaken
on probably all continents where the targey audience is as varied as
there are Starbuck coffee shops in Montreal... Massimo tagged
'Enterprise' thinking 'social enterprise' (if I remember the previous
thread - although i retain the right to be absolutely wrong on that),
perhaps the cultural image of the word?.

Would it be interesting to agree on a set of key ideas (like those
that seem to resurface the most like rapid, development, ninja,
banana  yes, enterprise - would be a shame to loose the word
after so many discussions ;) ) and take an enterprise class
translator's approach and come up with a tag per group/community
(linguistically speaking, and perhaps not geographically speaking -
I.e. France and French canada may both have French, but the common
folk may not necessarily understand each other, let alone find one
another all that funny [I.e Homer Simpson in its original franco-
canadian version makes me howl every time i see an episode, but my
friend and neighbour born and raised in a suburb of Paris, is never,
ever amused])...

For example, I like the word enterprise, but I like it in English, not
in French ('entreprise' makes me think of small, medium and large
business, which is way to close to our dreaded taxation ministry for
my own comfort and amusement), so I would probably look for something
that has the word 'enterprise' but in the form of a verb, like:

entreprenez-vous avec web2py!

which probably loosely translates to web2py, undertake! - but
probably doesn't sound all that great in English...


alright, back to work for me! :(

Mart :)



On May 11, 9:47 am, Ross Peoples ross.peop...@gmail.com wrote:
 In the spirit of not messing around with half baked, unstable,
 hard to maintain, constantly breaking backward compatibility, glued
 frameworks:

 web2py - For serious developers
 web2py - Stop playing, start producing
 web2py - Upgrade your development
 web2py - Development for the professionals

 Thoughts on any of those taglines?


[web2py] Re: Protect or Encrypt Source Code

2011-05-11 Thread stefaan
As indicated by others, you could try out an obfuscator:
http://www.lysator.liu.se/~astrand/projects/pyobfuscate/

But to tell the truth: if secrecy is this important, python might not
be the best tool for the job.



[web2py] Re: Protect or Encrypt Source Code

2011-05-11 Thread Ross Peoples
From the responses I've gotten here, and research elsewhere, I think there 
are only two real options:

1. Obfuscate and compile
2. Use Cython to turn Python code files into C modules.

Other option could be to somehow use cx_Freeze or similar tool to wrap the 
entire web2py installation. However, I'm not sure this is even possible.

I think I'm going to go with obfuscate and compile, see how that goes, and 
if it's still too easy, then I'll see about using Cython.

Thanks for the responses.


[web2py] Re: How to limit the number of database objects in DAL

2011-05-11 Thread Ross Peoples
I can't say I've ever really tried this, but maybe you could do something 
like this in your model:

db.pineapple_insert(**kwargs):
if db(db.pineapple.id  0).count() = 3:
raise Exception('There are already 3 pineapples in this table.')
else:
db.pineapple.insert(**kwargs)

Then instead of calling db.pineapple.insert() in your controllers, you would 
call db.pineapple_insert() --- Notice the underscore instead of the dot. 
This function is just a wrapper around DAL's insert() method, but does the 
checking before actually calling the insert() method.


[web2py] Re: How to limit the number of database objects in DAL

2011-05-11 Thread Ross Peoples
I've really gotta start proofreading my responses. This is a better version 
that the one I just gave (goes at the bottom of the model):

def pineapple_insert(**kwargs):
if db(db.pineapple.owner == auth.user.id).count() = 3:
raise Exception('There are already 3 pineapples for this user.')
else:
db.pineapple.insert(**kwargs)

db.pineapple_insert = pineapple_insert

The last line attaches the method to the db object so that it can be used in 
all controllers. If you are looking use this in conjunction with SQLFORM or 
something, then you would also want to do what pbreit said and check into 
custom validators.


Re: [web2py] Re: login fails for ajax components

2011-05-11 Thread pbreit
Hmmm...I haven't seen that pattern. I always put the LOAD() in a view. And 
decorate the calling controller. I don't see why or when you'd ever want to 
protect an individual component.

[web2py] UPDATE information in the database from a form that is made from multiple tables

2011-05-11 Thread Vasil Petkov
Hello to all!

As a new user of web2py, i tried (successfully) to create a form that
uses SQLFORM.factory(db.table1, db.table2).

The information for that was found in Chapter 7 of the web2py Book,
Section One form for multiple tables.

But i can not find information how to UPDATE table1 AND table2 with
information from such a form.

Where could i read more about such an UPDATE-operation?

Thanks in advance for the answers!


[web2py] Re: IS_IN_DB ability to sort selections?

2011-05-11 Thread Ross Peoples
On Sunday, December 28, 2008 3:43:55 AM UTC-5, mdipierro wrote:

 in trunk now... IS_IN_DB(orderby=) 




I realize that this thread is like 2.5 years old, but this should be in the 
book. I was looking for this functionality and found it here.

[web2py] Re: How to limit the number of database objects in DAL

2011-05-11 Thread Arbie Samong
thanks for the replies guys, I eventually settled for a custom
validator. I tried to put it in the controller but somehow I can't
check if the form was submitted, and calling
form.accepts(request.vars, session) already inserts the value

MAX_ENTRIES = 3
class CAN_ADD(object):
def __init__(self, error_message='Cannot add more PINEAPPLES,
maximum (%d) reached' % MAX_ENTRIES):
self.e = error_message
def __call__(self, value):
if db(db.TABLE.owner==auth.user.id).count()=MAX_ENTRIES:
return (value, self.e)
return (value, None)


[web2py] Re: UPDATE information in the database from a form that is made from multiple tables

2011-05-11 Thread pbreit
You should be able to update or update_record using the form.vars
http://web2py.com/book/default/chapter/06#count,-delete,-update
http://web2py.com/book/default/chapter/06#update_record


[web2py] Re: Mail.send failure:login() takes exactly 3 arguments (2 given)

2011-05-11 Thread Ed Greenberg
I think VP is correct.  There is a confusion between mail.settings.*
in db.py and settings.* in 0.py.  I configured the mail.settings.*
lines in db.py, not realizing that further down below in db.py, they
redefine all those variables, based on the contents of settings that
are created in 0.py.

It's working now.

So if this happens to anybody else, look at your db.py and see if
mail.settings.login is defined twice.

Ed

On May 11, 9:23 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 gluon/tools.py contains this code:

                 if self.settings.login != None:
                     ...
                     server.login(*self.settings.login.split(':',1))

 I think you must have somewhere a statement like

 auth.settings.login = ...

 and the ... is missing a : separating username and password.

 On May 11, 5:13 am, Ed Greenberg greenberg...@gmail.com wrote:

  When trying to send registration or lost password email, web2py
  flashes that it cannot send email (so registration fails) and logs

  [Wed May 11 10:07:31 2011] [error] 2011-05-11 10:07:31,049 - web2py -
  WARNING - Mail.send failure:login() takes exactly 3 arguments (2
  given)

  My app's db.py says:
  mail.settings.server = '127.0.0.1:25'  # your SMTP server
  mail.settings.sender = 'nore...@xxx.com'         # your email
  mail.settings.login = None      # your credentials or None
  mail.settings.tls = False

  What might be wrong?


[web2py] Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread elffikk
http://projects.unbit.it/uwsgi/wiki/Example


[web2py] Handy HTTP traffic examination and interaction tool

2011-05-11 Thread ron_m
Ran across this in a blog, written in Python, 

http://mitmproxy.org/

from the web page:

*mitmproxy* is an SSL-capable, intercepting HTTP proxy. It provides a 
console interface that allows traffic flows to be inspected and edited on 
the fly. 

*mitmdump* is the command-line version of mitmproxy, with the same 
functionality but without the frills. Think tcpdump for HTTP.




[web2py] Insert blank record crashes in sqlite

2011-05-11 Thread Jim Karsten
I use the following line in a controller to add a blank record. 

record_id = db.mytable.insert() 

This works fine using MySQL but crashes with sqlite. The error is: 

File /root/staging/1.94.5/web2py/gluon/dal.py, line 4344, in insert 
  return self._db._adapter.insert(self,self._listify(fields)) 
File /root/staging/1.94.5/web2py/gluon/dal.py, line 763, in insert 
  raise e 
OperationalError: near ): syntax error 

The SQL is:   INSERT INTO mytable() VALUES (); 

I get a similar error in the sqlite console but it works fine in MySQL 

sqlite INSERT INTO mytable() VALUES (); 
Error: near ): syntax error 

Not sure if this is a bug or not. Some dal methods produce an syntax error 
if no fields are provided. 

db(db.mytable.id == 1).update()
SyntaxError: No fields to update 

Should insert() without fields be a syntax error? 

Regards, 
Jim Karsten 

[web2py] Re: Insert blank record crashes in sqlite

2011-05-11 Thread mattgorecki
I'm not able to find anything SQLite specific, but this is what the
MySQL docs say about empty rows:

If both the column list and the VALUES list are empty, INSERT creates
a row with each column set to its default value:
INSERT INTO tbl_name () VALUES();
In strict mode, an error occurs if any column doesn't have a default
value. Otherwise, MySQL uses the implicit default value for any column
that does not have an explicitly defined default.

Matt


On May 11, 6:50 pm, Jim Karsten iiijjj...@gmail.com wrote:
 I use the following line in a controller to add a blank record.

 record_id = db.mytable.insert()

 This works fine using MySQL but crashes with sqlite. The error is:

 File /root/staging/1.94.5/web2py/gluon/dal.py, line 4344, in insert
   return self._db._adapter.insert(self,self._listify(fields))
 File /root/staging/1.94.5/web2py/gluon/dal.py, line 763, in insert
   raise e
 OperationalError: near ): syntax error

 The SQL is:   INSERT INTO mytable() VALUES ();

 I get a similar error in the sqlite console but it works fine in MySQL

 sqlite INSERT INTO mytable() VALUES ();
 Error: near ): syntax error

 Not sure if this is a bug or not. Some dal methods produce an syntax error
 if no fields are provided.

     db(db.mytable.id == 1).update()
     SyntaxError: No fields to update

 Should insert() without fields be a syntax error?

 Regards,
 Jim Karsten


[web2py] Possible bug in 1.95.1: SQLFORM(..., deletable=True) does nothing

2011-05-11 Thread Vasil Petkov
Hello again!

I am using Web2py 1.95.1 on Windows XP, inside Internet Explorer 7.

While researching the capabilities of SQLFORM, i have stumbled upon
one strange thing:
when i used deletable=True in a SQLFORM, there was no checkbox
visible, while rendering the form.

The form renders fine. Just the 'Check to delete:' checkbox is
missing.

That is the code, in which the problem was exposed:

# model
# db.py
# -
db = DAL('sqlite://address.sqlite')

db.define_table('person',
Field('name', requires=IS_NOT_EMPTY())
   )

db.define_table('address',
Field('country'),
Field('city'),
Field('zip', requires=IS_INT_IN_RANGE(1000,,
error_message=T('please insert a
valid ZIP code'))),
Field('mainaddr', requires=IS_NOT_EMPTY())
)

# controller
# delete_data.py
# 
def delete():
delete_person=db.person(request.args(0))
form1=SQLFORM(db.person, delete_person, deletable=True)

delete_address=db.address(request.args(0))
form2=SQLFORM(db.address, delete_address, deletable=True)

return dict(form1=form1, form2=form2)

# view
# delete_data/delete.html
# -
{{=form1}}
br
{{=form2}}


[web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Massimo Di Pierro
I had to look this up:
http://en.wikipedia.org/wiki/One-man_band

On May 11, 3:29 pm, elffikk elff...@gmail.com wrote:
 http://projects.unbit.it/uwsgi/wiki/Example


[web2py] appengine 1.5

2011-05-11 Thread Plumo
http://googleappengine.blogspot.com/2011/05/app-engine-150-release.html

Massimo, if I remember correctly you had access to an early release of 
appengine so you could prepare web2y. Any developments?

[web2py] Re: Insert blank record crashes in sqlite

2011-05-11 Thread Massimo Di Pierro
I think if you have at least one column with a default value web2py
should not fail.

On May 11, 7:50 pm, Jim Karsten iiijjj...@gmail.com wrote:
 I use the following line in a controller to add a blank record.

 record_id = db.mytable.insert()

 This works fine using MySQL but crashes with sqlite. The error is:

 File /root/staging/1.94.5/web2py/gluon/dal.py, line 4344, in insert
   return self._db._adapter.insert(self,self._listify(fields))
 File /root/staging/1.94.5/web2py/gluon/dal.py, line 763, in insert
   raise e
 OperationalError: near ): syntax error

 The SQL is:   INSERT INTO mytable() VALUES ();

 I get a similar error in the sqlite console but it works fine in MySQL

 sqlite INSERT INTO mytable() VALUES ();
 Error: near ): syntax error

 Not sure if this is a bug or not. Some dal methods produce an syntax error
 if no fields are provided.

     db(db.mytable.id == 1).update()
     SyntaxError: No fields to update

 Should insert() without fields be a syntax error?

 Regards,
 Jim Karsten


[web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread JorgeRpo
So?

What did they mean?


[web2py] Re: appengine 1.5

2011-05-11 Thread Massimo Di Pierro
This:

http://code.google.com/p/web2py/source/detail?r=f86141197efa2caf5305d4c066c957077377948f

db=DAL('google:sql')

has been in stable for almost one month and I have tested it both with
the SDK and in production.
All the normal SQL features supported by web2py including migrations,
joins, transactions, expressions, etc. work as expected.

We are all waiting for google to release the feature public. It does
not work with normal gae accounts.

Massimo


On May 11, 9:30 pm, Plumo richar...@gmail.com wrote:
 http://googleappengine.blogspot.com/2011/05/app-engine-150-release.html

 Massimo, if I remember correctly you had access to an early release of
 appengine so you could prepare web2y. Any developments?


[web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Massimo Di Pierro
It is still not clear to me if they mean

a framework that does a little bit of everything (compliment)

or

a framework that does a little bit of everything (not compliment)

or

a framework with one developer
(which I do not think is the case because I trust they know better)

Anyway, perhaps you should ask them.

Massimo



[web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Massimo Di Pierro
Made me think of this...
http://www.youtube.com/watch?v=CiVlAevviq8

On May 11, 9:42 pm, JorgeRpo jorgeh...@gmail.com wrote:
 So?

 What did they mean?


[web2py] Re: update is not saved in the database??

2011-05-11 Thread niknok

I can't, there's no record instance... So it's .update for me.

On May 11, 12:53 am, Thadeus Burgess thade...@thadeusb.com wrote:
 Use ``update_record`` instead of ``update``.

 the ``update`` function comes from the dict parent class, and does not issue
 SQL.

 ``update_record`` is a web2py thing that will take any changes made to the
 record instance (by use of assignment or update function) and issue the
 appropriate SQL

 --
 Thadeus







 On Mon, May 9, 2011 at 9:37 PM, niknok nikolai...@gmail.com wrote:
  Yes, guys thanks. I realized that that was the culprit this morning.
  Hard to decode with beer fogging your thoughts... :P

  Reverted to the original and all is working again. I forgot I was
  testing that line from a code in the book.

  On May 9, 11:01 pm, Anthony abasta...@gmail.com wrote:
   On Monday, May 9, 2011 10:45:36 AM UTC-4, niknok wrote:

I have these lines that is supposed to update a record but it doesn't:

    db.card.validated.writable=True
    db.card.modified_by.writable=True

  db.card(db.card.alnum==c_hash).update(validated=True,modified_by=auth.user.
  id)

Is there anything I missed? I tried to include a manual db.commit(),
  but
that didn't work either.

   You can use the db.card(db.card.alnum==c_hash) notation to fetch a row
   (though I think you have to include the record ID as the first argument),
   but I'm not sure you can use it to update a record. For that, you may
  have
   to use the usual query notation: db(db.card.alum==c_hash).update(...).
  You
   might also be able to use your original notation along with
  update_record,
   but I don't see any reason to prefer that over the usual method.

   Anthony


Re: [web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Jason Brower

On 05/12/2011 05:42 AM, JorgeRpo wrote:

So?

What did they mean?

It takes both ways.
You can build your app with one program from top to bottom.  Editor and all.
Most if not all the tools you will need are built in.
You don't need to go and grab special stuff all over, the batteries are 
included.

BR,
Jason


[web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Jason Brower
Looked and looked but I couldn't fine where you place a file with 
methods and classes in the modules directory and then you can import them.

Could I see where that is in the book or perhaps some instruction here?
Best Regards,
Jason


[web2py] Re: using CRYPT in SQLFORM.factory doesn't work?

2011-05-11 Thread niknok
here's the code I used.
http://pastie.org/1891534

what's weird is that I know that CRYPT works in my other apps, it's
just in this particular controller that it isn't working right.

And in my case, my logical test is == and not !=. My problem is
the unecrypted
 variable...


On May 10, 10:54 pm, Anthony abasta...@gmail.com wrote:
 On Tuesday, May 10, 2011 2:10:07 AM UTC-4, niknok wrote:

  Anthony, sorry for the typo. I meant calling onvalidation=, and not
  onaccept

  That is the behavior I'm expecting, since I've seen that work like so
  before. Here's a stripped-down version of the function:

  def cnv():
      c_hash=request.args(0)
      form=SQLFORM.factory(
          Field('card_number','string'
                  ,label='Card number',comment='with dashes')
                  ,requires=CRYPT(auth.settings.hmac_key))
      if form.accepts(request.vars,session):
          #import ipdb;ipdb.set_trace()
          #if c_hash!= form.vars.card_number:     #-- does not work

 What do you mean the above does not work? Are you expecting
 form.vars.card_number to equal c_hash (if so, shouldn't '!=' be '==')? Where
 does c_hash come from (i.e., how does it get in request.args)?

          if CRYPT(auth.settings.hmac_key)(form.vars.card_number)
  [0]==c_hash:

 What is the purpose of the above line? form.vars.card_number should already
 be hashed (form.accepts should result in it being hashed), so this line
 appears to be double hashing the card number, which I assume wouldn't match
 c_hash (assuming c_hash is supposed to be the hashed card number).

 Anthony


Re: [web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Bruno Rocha
here:
http://web2py.com/book/default/chapter/04#Third-Party-Modules

--

web2py provides another way to import modules in such a way that the global
sys.path is not altered: by placing them in the modules folder of an
application. One side benefit is that the module will be automatically
copied and distributed with the application; however, there are certain
restrictions that apply. web2py provides alocal_import function that must be
used to import modules from the modules folder. Here is an example of
usage:


1.


mymodule = local_import
http://web2py.com/book/default/docstring/local_import('mymodule')

The function looks for mymodule in the app local modules folder and imports
it with the name on the left-hand side of equal.

This function takes three arguments: name, reload and app.
-

*but wait! there are updates coming*, now web2py hs gluon.current and custom
importer which is better than that old way.

http://web2py.com/book/default/chapter/04#Third-Party-Modules
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Thu, May 12, 2011 at 12:10 AM, Jason Brower encomp...@gmail.com wrote:

 Looked and looked but I couldn't fine where you place a file with methods
 and classes in the modules directory and then you can import them.
 Could I see where that is in the book or perhaps some instruction here?
 Best Regards,
 Jason



Re: [web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Stifan Kristi
when the updates come, bruno?
is it for web2py package or web2py books?

i'll wait for both, thank you so much for your info.


On Thu, May 12, 2011 at 10:35 AM, Bruno Rocha rochacbr...@gmail.com wrote:

 here:
 http://web2py.com/book/default/chapter/04#Third-Party-Modules

 --

 web2py provides another way to import modules in such a way that the
 global sys.path is not altered: by placing them in the modules folder of
 an application. One side benefit is that the module will be automatically
 copied and distributed with the application; however, there are certain
 restrictions that apply. web2py provides alocal_import function that must
 be used to import modules from the modules folder. Here is an example of
 usage:


 1.


 mymodule = local_import 
 http://web2py.com/book/default/docstring/local_import('mymodule')

 The function looks for mymodule in the app local modules folder and
 imports it with the name on the left-hand side of equal.

 This function takes three arguments: name, reload and app.
 -

 *but wait! there are updates coming*, now web2py hs gluon.current and
 custom importer which is better than that old way.

 http://web2py.com/book/default/chapter/04#Third-Party-Modules
 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]



 On Thu, May 12, 2011 at 12:10 AM, Jason Brower encomp...@gmail.comwrote:

 Looked and looked but I couldn't fine where you place a file with methods
 and classes in the modules directory and then you can import them.
 Could I see where that is in the book or perhaps some instruction here?
 Best Regards,
 Jason





Re: [web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Anthony
On Wednesday, May 11, 2011 11:41:32 PM UTC-4, 黄祥 wrote: 

 when the updates come, bruno? 
 is it for web2py package or web2py books?

 
The changes he's referring to are already in trunk and are mentioned here: 
https://groups.google.com/forum/?fromgroups#!topic/web2py/p2v_QVdLjxQ. 
Assuming testing is going well, I guess they would likely be included in the 
next release (so, pretty soon). Who knows when the book will be updated 
(hopefully not long after)?
 
Anthony
 


Re: [web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Stifan Kristi
a, i c, i followed the forum discussion too about web2py new version, but, i
think it'll be great if the new feature is well documented how to use,
combine and improve it.

btw, thanks for your info, anthony

On Thu, May 12, 2011 at 10:48 AM, Anthony abasta...@gmail.com wrote:

 On Wednesday, May 11, 2011 11:41:32 PM UTC-4, 黄祥 wrote:

 when the updates come, bruno?
 is it for web2py package or web2py books?


 The changes he's referring to are already in trunk and are mentioned here:
 https://groups.google.com/forum/?fromgroups#!topic/web2py/p2v_QVdLjxQ.
 Assuming testing is going well, I guess they would likely be included in the
 next release (so, pretty soon). Who knows when the book will be updated
 (hopefully not long after)?

 Anthony




Re: [web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Bruno Rocha
On Thu, May 12, 2011 at 12:48 AM, Anthony abasta...@gmail.com wrote:

 Who knows when the book will be updated (hopefully not long after)?


Massimo said, that book will be updated nearly August. BTW I think this kind
of change could be included in the actual version of the book when it be
more tested.


[web2py] Re: using CRYPT in SQLFORM.factory doesn't work?

2011-05-11 Thread Anthony
I think you've got a simple typo in you code -- in SQLFORM.factory, you have 
a ')' at the end of the Field line, so your 'requires' ends up being a 
SQLFORM.factory argument instead of a Field argument. It should be:
 
form=SQLFORM.factory(
Field('card_number','string',comment='with dashes',
  requires=CRYPT(auth.settings.hmac_key)))
When I try the above, CRYPT works fine for me.
 
Anthony

On Wednesday, May 11, 2011 11:02:17 PM UTC-4, niknok wrote:

 here's the code I used. 
 http://pastie.org/1891534 

 what's weird is that I know that CRYPT works in my other apps, it's 
 just in this particular controller that it isn't working right. 

 And in my case, my logical test is == and not !=. My problem is 
 the unecrypted 
  variable... 



Re: [web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Roberto De Ioris

 It is still not clear to me if they mean

 a framework that does a little bit of everything (compliment)

 or

 a framework that does a little bit of everything (not compliment)

 or

 a framework with one developer
 (which I do not think is the case because I trust they know better)

 Anyway, perhaps you should ask them.

 Massimo



It is a compliment, you can be sure.
You have to read it in the rock/heavy metal way, where Web2Py is the
talented player that can manage every intrument, but can make amazing
concert with the best 'sessions musicians' out there (as he has the skills
to choose them). So, as another user said in this thread, it can plays
both ways.

Sorry batteries included and on steroids are so over-used... ;)


-- 
Roberto De Ioris
http://unbit.it


Re: [web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Bruno Rocha
On Thu, May 12, 2011 at 2:00 AM, Roberto De Ioris robe...@unbit.it wrote:

 You have to read it in the rock/heavy metal way, where Web2Py is the
 talented player that can manage every intrument,


http://en.wikipedia.org/wiki/Ayreon


Re: [web2py] Re: Web2py - the one-man-band of all python frameworks :)

2011-05-11 Thread Roberto De Ioris

 On Thu, May 12, 2011 at 2:00 AM, Roberto De Ioris robe...@unbit.it
 wrote:

 You have to read it in the rock/heavy metal way, where Web2Py is the
 talented player that can manage every intrument,


 http://en.wikipedia.org/wiki/Ayreon


Exactly :)

-- 
Roberto De Ioris
http://unbit.it


Re: [web2py] Where in the book does it talk about the modules directory?

2011-05-11 Thread Jason Brower
Yeah, happy that is improving.  I will do it this way for now, as it 
take a bit before I upgrade the server.

It don't like the way it is here in the book.
BR,
Jason Brower

On 05/12/2011 06:35 AM, Bruno Rocha wrote:

here:
http://web2py.com/book/default/chapter/04#Third-Party-Modules

--

web2py provides another way to import modules in such a way that the 
global |sys.path| is not altered: by placing them in the modules 
folder of an application. One side benefit is that the module will be 
automatically copied and distributed with the application; however, 
there are certain restrictions that apply. web2py provides 
a|local_import| function that must be used to import modules from the 
modules folder. Here is an example of usage:


1.

mymodule=local_import  
http://web2py.com/book/default/docstring/local_import('mymodule')

The function looks for |mymodule| in the app local modules folder and 
imports it with the name on the left-hand side of equal.


This function takes three arguments: |name|, |reload| and |app|.

-

*but wait! there are updates coming*, now web2py hs gluon.current and 
custom importer which is better than that old way.



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Thu, May 12, 2011 at 12:10 AM, Jason Brower encomp...@gmail.com 
mailto:encomp...@gmail.com wrote:


Looked and looked but I couldn't fine where you place a file with
methods and classes in the modules directory and then you can
import them.
Could I see where that is in the book or perhaps some instruction
here?
Best Regards,
Jason