[web2py] Re: Remove link in MENU for current url

2010-10-31 Thread annet
Hi Michael,

 Completely optional.

Cheers


Annet


[web2py] how to derive a class from Table ?

2010-10-31 Thread Stef Mientki
hello,

I'ld like to derive a new class from Table
(if it succeeds, I can integrate DAL into my existing programs, without 
changing anything, except
adding an import statement)

This seems to be the obvious way,
the problem is that although a table seems to be created,
the Table is not attached to the database.
So writing to the database disappears in the universe.

class DAL_Table ( Table ) :
def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
... do my preprocessing, generate Fields
Table.__init__ ( self, DB, Name, *Fields, migrate = Name + '.table' )


This ones create a table attached to a database,
but the DAL_Table doesn't hace the properties of Table
class DAL_Table ( object ) :
def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
... do my preprocessing, generate Fields
My_Table = DB.define+table ( Name, *Fields, migrate = Name + '.table' )
... but now DAL_Table doesn't have the properties of Table

thanks,
Stef Mientki



Re: [web2py] how to derive a class from Table ?

2010-10-31 Thread Albert Abril
I'm not sure if you can do this with DAL.
However, maybe if you use an ORM you can derivate models.
Time ago someone write about using Django ORM or SQLAlchemy in web2py for
make this, you can read here [1] and here [2].

Correct me if i am not on the right way, thanks.

[1] http://www.mail-archive.com/web2py@googlegroups.com/msg36450.html
[2] http://web2py.com/AlterEgo/default/show/189


On Sun, Oct 31, 2010 at 10:11 AM, Stef Mientki stef.mien...@gmail.comwrote:

 hello,

 I'ld like to derive a new class from Table
 (if it succeeds, I can integrate DAL into my existing programs, without
 changing anything, except
 adding an import statement)

 This seems to be the obvious way,
 the problem is that although a table seems to be created,
 the Table is not attached to the database.
 So writing to the database disappears in the universe.

 class DAL_Table ( Table ) :
def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
... do my preprocessing, generate Fields
Table.__init__ ( self, DB, Name, *Fields, migrate = Name + '.table'
 )


 This ones create a table attached to a database,
 but the DAL_Table doesn't hace the properties of Table
 class DAL_Table ( object ) :
def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
... do my preprocessing, generate Fields
My_Table = DB.define+table ( Name, *Fields, migrate = Name +
 '.table' )
... but now DAL_Table doesn't have the properties of Table

 thanks,
 Stef Mientki




[web2py] Re: how to derive a class from Table ?

2010-10-31 Thread mdipierro
Can you explain the purpose? You can create a derivative class of
Table (is it just a table) but this is not the same as model
inheritance in ORMs, becuase tables (lower case) are not classes in
DAL. To do model inheritance

db.define_table('a',*fields)
db.define_table('b',db.a,*other_fields)

On 31 oct, 04:11, Stef Mientki stef.mien...@gmail.com wrote:
 hello,

 I'ld like to derive a new class from Table
 (if it succeeds, I can integrate DAL into my existing programs, without 
 changing anything, except
 adding an import statement)

 This seems to be the obvious way,
 the problem is that although a table seems to be created,
 the Table is not attached to the database.
 So writing to the database disappears in the universe.

 class DAL_Table ( Table ) :
     def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
         ... do my preprocessing, generate Fields
         Table.__init__ ( self, DB, Name, *Fields, migrate = Name + '.table' )

 This ones create a table attached to a database,
 but the DAL_Table doesn't hace the properties of Table
 class DAL_Table ( object ) :
     def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
         ... do my preprocessing, generate Fields
         My_Table = DB.define+table ( Name, *Fields, migrate = Name + '.table' 
 )
         ... but now DAL_Table doesn't have the properties of Table

 thanks,
 Stef Mientki


[web2py] Re: Passing pointer to session, requestion, etc objects to module

2010-10-31 Thread mr.freeze
Python passes arguments by reference so they are not copies. Take a
look at the constructors for the Crud and Auth classes in gluon/
tools.py. They receive a variable called 'environment' that contains
the session and request.

On Oct 30, 9:00 pm, b00m_chef r...@devshell.org wrote:
 How does one go about passing a pointer to the session and request
 objects from your app to a module in said app. Basically, in a module,
 I need to be able to manipulate all those objects without having to
 return and re-assign them.

 If I simply pass all the session, request, response, etc objects to my
 module object in the constructor and then assign all to self.bla, then
 I only get copies of those objects...I can't change them after.

 Is the above possible?

 Simple example of what I want to do is to be able to do
 session.forget() in my module.


[web2py] Ordering of versions in versioning dashboard

2010-10-31 Thread Branko Vukelic
I think the order should be reverse (showing latest at the top). You
rarely need to revert to revisions older than just a few commits back,
so it makes more sense to have those at the top, and not the oldest.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Re: Request for a logo - PluginCentral

2010-10-31 Thread Albert Abril
Finally it's going to be a 2n Round logo contest as said at this thread?
Just curious.

On Tue, Oct 26, 2010 at 9:28 PM, Albert Abril albert.ab...@gmail.comwrote:

 +1 to Branko again.

 ( mailist should have a comment voting system :D )


 On Tue, Oct 26, 2010 at 8:50 PM, Branko Vukelic bg.bra...@gmail.comwrote:

 Please don't even try to imagine a graphic designer that would turn
 abstract ideas like Stability and Ease of use into a useful graphic.
 That's impossible. In reality, it's the reverse. You have a memorable
 image that you can associate with the qualities you discover in a
 product. And only then does the image 'obtain' those qualities.

 Does a 3-pointed star represents German high-precision engineering,
 and luxury? I doubt that. Yet, Benz is using that shape. And people
 have come to associate those qualities with exactly the kind of
 3-pointed star Benz uses, and no other. You can put just any kind of
 3-pointed star on your car and expect it to look well-made and
 comfortable. It only works if it's the Mercedes-Benz 3-pointed star.

 When Arch Linux community had it's logo design contest, we run into
 this very problem: discussion about the qualities that a logo should
 represent. And, of course, you can't find those qualities in the logo
 that's currently being used unless you've associated them with the
 image yourself. But the discussion dragged on for days, and the whole
 community was divided in a flame war. There were even some
 'professionals' who claimed a logo really can speak 1000 words. That's
 so far from truth. You'd really have to draw a painting of a logo to
 pull that off.

 So, what are the notable exceptions to the above? Concrete imagery. In
 other words, mascots. And only those mascots that have some root in
 the culture. Lions, Tigers, Crane, Frogs, etc. Those animals have
 traditionally lots of characteristics associated with them. So using
 such images definitely can tell a story. What about that ship? Well,
 it's a 50-50 bet.

 To some it may speak, to others it may not. And here's a good test of
 this. How many of you had the following ideas when seeing that ship:

 * Ability to carry a huge amount of load: scalability
 * A graceful voyage across a vast ocean: stability
 * Took a lot of manpower to build: great community

 How many of you got those ideas upon seeing it? I suspect most had
 other thoughts. I seriously doubt there is a unified and universal
 graphical language that you can use reliably to relay abstract
 messages. IOW: Graphic design still hasn't got it's HTTP. ;)

 So, before this turns into a pointless discussions, let's just stop
 wasting time on abstract ideas. Stability, Speed, Scalability, et al.
 those are for the product itself to achieve, not the logo. Logo can be
 colorful, sharp, cute, dull, crap... Let's focus on what the logo CAN
 be, please.

 On Tue, Oct 26, 2010 at 6:36 PM, mwolfe02
 michael.joseph.wo...@gmail.com wrote:
  Excellent points.
 
  On Oct 26, 12:04 pm, Anthony abasta...@gmail.com wrote:
  Also:
  3. Easy (to learn and use)
  4. Open/welcoming/friendly/helpful (this refers to the community)
  5. Active development (i.e., constantly being enhanced and improved)
 
  As for the logo, I'm sure opinions will differ on all-text vs. image
  logos (and will probably depend a lot on the particular design), but
  I'm not sure a highly literal physical object image (e.g., boat,
  train, animal, etc.) will work that well for web2py. Those kinds of
  images certainly make sense when they represent something directly in
  the brand name (e.g., Ruby on Rails has a ruby with rails; Turbogears
  has a gear; Flask has a flask), but can be confusing otherwise. That's
  not to say we shouldn't have an image, but if we do, something more
  abstract may work better (e.g., like the old logo).
 
  Anthony
 
  On Oct 26, 11:27 am, mwolfe02 michael.joseph.wo...@gmail.com wrote:
 
 
 
 
 
 
 
   I really like the idea of a bold, simple image to represent the
   framework.  I'm just not convinced a ship is the right image.
 
   Maybe it would be more helpful to the few good logo designers on this
   list (of which Branko is certainly one), for us to propose different
   images.  I'll list what I feel (personally) are the strengths of the
   framework that an image would ideally represent:
 
   1a. Speed (of development)
   1b. Security
   2.  Reliability/Stability (ie, promise of backwards
   compatibility...the one thing that *truly* distinguishes web2py from
   other frameworks; most others don't even try)
 
   Some quick image ideas off the top of my head (that may or may not be
   practical as logos):
   - 'bullet' train
   - sailfish
   - catamaran sailboat (a bit more modern-looking/faster than Branko's
   original ship design; though I'd imagine less logo-friendly)
   - hummingbird
   - chain (close-up of two or three individual links)
   - hawk
   - lion
   - gazelle
 
   Please note that I've left off spiders and snakes.  I think they
 

Re: [web2py] Re: Request for a logo - PluginCentral

2010-10-31 Thread rochacbruno
We can start a votation to decide if we need a new logo votation.

LOL

Enviado via iPhone

Em 31/10/2010, às 14:13, Albert Abril albert.ab...@gmail.com escreveu:

 Finally it's going to be a 2n Round logo contest as said at this thread?
 Just curious.
 
 On Tue, Oct 26, 2010 at 9:28 PM, Albert Abril albert.ab...@gmail.com wrote:
 +1 to Branko again.
 
 ( mailist should have a comment voting system :D )
 
 
 On Tue, Oct 26, 2010 at 8:50 PM, Branko Vukelic bg.bra...@gmail.com wrote:
 Please don't even try to imagine a graphic designer that would turn
 abstract ideas like Stability and Ease of use into a useful graphic.
 That's impossible. In reality, it's the reverse. You have a memorable
 image that you can associate with the qualities you discover in a
 product. And only then does the image 'obtain' those qualities.
 
 Does a 3-pointed star represents German high-precision engineering,
 and luxury? I doubt that. Yet, Benz is using that shape. And people
 have come to associate those qualities with exactly the kind of
 3-pointed star Benz uses, and no other. You can put just any kind of
 3-pointed star on your car and expect it to look well-made and
 comfortable. It only works if it's the Mercedes-Benz 3-pointed star.
 
 When Arch Linux community had it's logo design contest, we run into
 this very problem: discussion about the qualities that a logo should
 represent. And, of course, you can't find those qualities in the logo
 that's currently being used unless you've associated them with the
 image yourself. But the discussion dragged on for days, and the whole
 community was divided in a flame war. There were even some
 'professionals' who claimed a logo really can speak 1000 words. That's
 so far from truth. You'd really have to draw a painting of a logo to
 pull that off.
 
 So, what are the notable exceptions to the above? Concrete imagery. In
 other words, mascots. And only those mascots that have some root in
 the culture. Lions, Tigers, Crane, Frogs, etc. Those animals have
 traditionally lots of characteristics associated with them. So using
 such images definitely can tell a story. What about that ship? Well,
 it's a 50-50 bet.
 
 To some it may speak, to others it may not. And here's a good test of
 this. How many of you had the following ideas when seeing that ship:
 
 * Ability to carry a huge amount of load: scalability
 * A graceful voyage across a vast ocean: stability
 * Took a lot of manpower to build: great community
 
 How many of you got those ideas upon seeing it? I suspect most had
 other thoughts. I seriously doubt there is a unified and universal
 graphical language that you can use reliably to relay abstract
 messages. IOW: Graphic design still hasn't got it's HTTP. ;)
 
 So, before this turns into a pointless discussions, let's just stop
 wasting time on abstract ideas. Stability, Speed, Scalability, et al.
 those are for the product itself to achieve, not the logo. Logo can be
 colorful, sharp, cute, dull, crap... Let's focus on what the logo CAN
 be, please.
 
 On Tue, Oct 26, 2010 at 6:36 PM, mwolfe02
 michael.joseph.wo...@gmail.com wrote:
  Excellent points.
 
  On Oct 26, 12:04 pm, Anthony abasta...@gmail.com wrote:
  Also:
  3. Easy (to learn and use)
  4. Open/welcoming/friendly/helpful (this refers to the community)
  5. Active development (i.e., constantly being enhanced and improved)
 
  As for the logo, I'm sure opinions will differ on all-text vs. image
  logos (and will probably depend a lot on the particular design), but
  I'm not sure a highly literal physical object image (e.g., boat,
  train, animal, etc.) will work that well for web2py. Those kinds of
  images certainly make sense when they represent something directly in
  the brand name (e.g., Ruby on Rails has a ruby with rails; Turbogears
  has a gear; Flask has a flask), but can be confusing otherwise. That's
  not to say we shouldn't have an image, but if we do, something more
  abstract may work better (e.g., like the old logo).
 
  Anthony
 
  On Oct 26, 11:27 am, mwolfe02 michael.joseph.wo...@gmail.com wrote:
 
 
 
 
 
 
 
   I really like the idea of a bold, simple image to represent the
   framework.  I'm just not convinced a ship is the right image.
 
   Maybe it would be more helpful to the few good logo designers on this
   list (of which Branko is certainly one), for us to propose different
   images.  I'll list what I feel (personally) are the strengths of the
   framework that an image would ideally represent:
 
   1a. Speed (of development)
   1b. Security
   2.  Reliability/Stability (ie, promise of backwards
   compatibility...the one thing that *truly* distinguishes web2py from
   other frameworks; most others don't even try)
 
   Some quick image ideas off the top of my head (that may or may not be
   practical as logos):
   - 'bullet' train
   - sailfish
   - catamaran sailboat (a bit more modern-looking/faster than Branko's
   original ship design; though I'd imagine less logo-friendly)
 

[web2py] An upsert in database

2010-10-31 Thread siddharth
Hi, I need to do an upsert in a database table. I need to insert a row
if it does not exist already and and update it if it does.
using python sqlite module I was writing the code as

code (python : curs holds the cursor to table ):

curs.execute(insert or ignore into table values(?,?),(name_var,0))
curs.execute(update docs set freq=freq+1 where name ='+name_var+
')


The table contains two columns : name (type text, primary key) and
freq (type integer). it name_var is a variable that holds the name to
query the database.

How do I achieve the same code in web2py? I tried db.executesql() but
am having problem with it because of the quotes involved.

Thank you.


[web2py] Re: An upsert in database

2010-10-31 Thread Niphlod
does db.executesql not fit ?

Niphlod

On 31 Ott, 18:01, siddharth sharmasiddhart...@gmail.com wrote:
 Hi, I need to do an upsert in a database table. I need to insert a row
 if it does not exist already and and update it if it does.
 using python sqlite module I was writing the code as

 code (python : curs holds the cursor to table ):

         curs.execute(insert or ignore into table values(?,?),(name_var,0))
         curs.execute(update docs set freq=freq+1 where name ='+name_var+
 ')

 The table contains two columns : name (type text, primary key) and
 freq (type integer). it name_var is a variable that holds the name to
 query the database.

 How do I achieve the same code in web2py? I tried db.executesql() but
 am having problem with it because of the quotes involved.

 Thank you.


[web2py] little bug in last web2py (maybe in a few last releases also)

2010-10-31 Thread Niphlod
hello, when you define a field in a table as a decimal(x,y) , the form
widget renders it as an input class=decimal(x,y) .../ .
I'm not perfectly sure that before worked right, because I noticed the
behaviour writing a letter accidentally inside a field, but I guess
before class for inputs of type decimal(x,y) would be simply rendered
as decimal.

the current web2py_ajax checks for decimal as a class with the
following snippet

jQuery('input.double,input.decimal').keyup()
-
and in this way pre-validation does not work.

Niphlod


[web2py] Re: An upsert in database

2010-10-31 Thread siddharth
I have done the following

try:
db.table.insert(name = name_var, freq = 1 )
except:
db.executesql('update table set freq=freq+1 where name=%s;'
%name_var)

seems to be working fine. Any thoughts ??(if it could be improved)

On Oct 31, 11:11 pm, Niphlod niph...@gmail.com wrote:
 does db.executesql not fit ?

 Niphlod

 On 31 Ott, 18:01, siddharth sharmasiddhart...@gmail.com wrote:

  Hi, I need to do an upsert in a database table. I need to insert a row
  if it does not exist already and and update it if it does.
  using python sqlite module I was writing the code as

  code (python : curs holds the cursor to table ):

          curs.execute(insert or ignore into table values(?,?),(name_var,0))
          curs.execute(update docs set freq=freq+1 where name ='+name_var+
  ')

  The table contains two columns : name (type text, primary key) and
  freq (type integer). it name_var is a variable that holds the name to
  query the database.

  How do I achieve the same code in web2py? I tried db.executesql() but
  am having problem with it because of the quotes involved.

  Thank you.




[web2py] Re: Passing pointer to session, requestion, etc objects to module

2010-10-31 Thread b00m_chef
thanks!


On Oct 31, 6:12 am, mr.freeze nat...@freezable.com wrote:
 Python passes arguments by reference so they are not copies. Take a
 look at the constructors for the Crud and Auth classes in gluon/
 tools.py. They receive a variable called 'environment' that contains
 the session and request.

 On Oct 30, 9:00 pm, b00m_chef r...@devshell.org wrote:



  How does one go about passing a pointer to the session and request
  objects from your app to a module in said app. Basically, in a module,
  I need to be able to manipulate all those objects without having to
  return and re-assign them.

  If I simply pass all the session, request, response, etc objects to my
  module object in the constructor and then assign all to self.bla, then
  I only get copies of those objects...I can't change them after.

  Is the above possible?

  Simple example of what I want to do is to be able to do
  session.forget() in my module.


Re: [web2py] Re: how to derive a class from Table ?

2010-10-31 Thread Stef Mientki
On 31-10-2010 13:43, mdipierro wrote:
 Can you explain the purpose?
I want to convert my old desktop applications to DAL,
with the minimal effort and even more important:
with a minimal chance of breaking some of the existing code.

Converting to DAL , I think of the following advantages:
1. DAL makes it much easier to maintain the code (compared to scattered SQL)
2. I can easily switch to another database, without the need for changing the 
code
3. for the future it should be much easier to move these desktop application to 
web applications

So the derived database / table classes (or whatever objects they are),
should combine my old methods, with the new DAL methods.

At the moment I've the code working, very ugly,
so maybe one of you might have suggestions fro improvement.
see code below,

thanks,
Stef Mientki


# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import __init__


# 
# Table Definitions
# 
_Afdeling_Table_Def = 
AID  integer  not null  primary key autoincrement
Name text not null  unique


# 
# Some intial values for database tables
# 
Afdelingen = 
Medische Psychologie
SVB-ID



# 
# import web2py libs ( not necessary, when web2py is properly istalled)
# 
import sys
sys.path.append ( r'P:\Web2PY\web2py_src\web2py' )
from gluon.sql import DAL, Field, Table, SQLDB



# ***
# ***
class _DAL_DB ( object ) :
  
This class combines the old methods with the new DAL DB methods.
This class should be initiated with the function DAL_DB.
  
  # store variables in memory
  def __init__ ( self, DB ) :
self.My_DB = DB

  # The old Close method
  def Close ( self ) :
self.My_DB.close_all_instances ( SQLDB.commit )

def DAL_DB ( Database_Name ) :
  # Create and connect to the database
  My_DB = DAL ( 'sqlite://' + DataBase_Name )

  # store Database in a class
  Create_a_Class = _DAL_DB ( My_DB )

  # Convert DAL methods to old methods and add them to the database
  My_DB.Close = Create_a_Class.Close

  # return the (extended) DAL database
  return My_DB
# ***


# ***
# ***
class DAL_Table ( Table ) :
  
This class combines the old methods and the new methods of a DAL Table.
  
  def __init__ ( self, DB, Name, Defs, Drop = False, Mod_Table = False ) :
# **
# Convert the old table definitions into Wbe2Py definitions
# **
Fields = []
Defs = Defs.splitlines ()
for Line in Defs :
  Line = Line .strip ()
  if Line :
line = Line.lower()
print line
if not ( ( 'primary' in line ) and ( 'key' in line ) ) :
  Parts = Line.split ()
  FParts = [ Parts[0], Parts[1].lower() ]
  FLine = Field ( ' + Parts[0] + ',' + Parts[1].lower() + '
  if ( 'not ' in line ) and ( ' null' in line ) :
FLine += ',notnull = True'
  if ( ' unique' in line ) :
FLine += ',unique = True'
  FLine += ')'
  print FLine
  Fields.append ( eval ( FLine ) )

# **
# Create the web2py table
# **
print 'Define Table', Name, Fields
#Table.__init__ ( self, DB, Name, *Fields, migrate = Name + '.table' )
self.My_Table = DB.define_table ( Name, *Fields, migrate = Name + '.table' )

  # **
  # Replicate all the Web2Py table methods
  # here only insert is done as an example
  # **
  def insert ( self, *args, **kwargs ) :
self.My_Table.insert ( *args, **kwargs )

  # **
  def Insert_Records_from_String ( self, Lines, Auto = False ) :

Inserting of a number of records from a multiline string,
where each line represents a record.
Fields are separated by a '|'.

#Record = self.Get_New_Dict ()
Lines = Lines.splitlines()
for Line in Lines :
  if Line.strip() :
Parts = Line.split ( '|' )
#print 'String Insert:',self.Table_Name, Parts
# Strings starting with '#' ar assumed comments and ignored
if not ( Parts[0].startswith ( '#' ) ) :
  for i in range ( len ( Parts ) ) :
 

[web2py] standalone DAL: why is migration table name preceeded by some prefix ?

2010-10-31 Thread Stef Mientki
hello,

I use the following statement to create a standalone DAT table

DB.define_table ( Name, *Fields, migrate = 'Afdeling.table' )

Why is the name of the migration table prefixed ?

9ca3bd6f71b92b953cff7d3c148b42fc_Afdeling.table

thanks,
Stef Mientki


[web2py] Standalone DAL, what's the correct uri for the database location ?

2010-10-31 Thread Stef Mientki
hello,

Standalone DAL,  what's the correct uri for the database location ?

This works:
  Database_Name = 'ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://' + Database_Name )


This gives an error, saying couldn;'t find a database after 5 tries
  Database_Name = r'D:/Data_Python_25/Beheer/ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://file:///' + Database_Name )

A workaround is to use os.chdir()

thanks,
Stef Mientki


[web2py] response.files and JS at bottom of page

2010-10-31 Thread Branko Vukelic
How does web2py render the JavaScript assets? Does it always render
them in head or this can be customized? Specifically, I like the JS
assets to be rendered just before the closing /body tag.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] standalone DAL: why is migration table name preceeded by some prefix ?

2010-10-31 Thread Thadeus Burgess
That is a hash of the connection string you pass in during DAL
instantiation. This way you can uniquely identify

db = DAL('sqlite://my.db')

vs

db = DAL('postgres://.')

without overwriting your .table files.

--
Thadeus




On Sun, Oct 31, 2010 at 3:03 PM, Stef Mientki stef.mien...@gmail.comwrote:

 hello,

 I use the following statement to create a standalone DAT table

DB.define_table ( Name, *Fields, migrate = 'Afdeling.table' )

 Why is the name of the migration table prefixed ?

9ca3bd6f71b92b953cff7d3c148b42fc_Afdeling.table

 thanks,
 Stef Mientki



Re: [web2py] Standalone DAL, what's the correct uri for the database location ?

2010-10-31 Thread Thadeus Burgess
Have you tried without the file:/// ?

On linux you don't need to specify file:/// you can just give the full path.

--
Thadeus




On Sun, Oct 31, 2010 at 3:19 PM, Stef Mientki stef.mien...@gmail.comwrote:

 hello,

 Standalone DAL,  what's the correct uri for the database location ?

 This works:
  Database_Name = 'ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://' + Database_Name )


 This gives an error, saying couldn;'t find a database after 5 tries
  Database_Name = r'D:/Data_Python_25/Beheer/ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://file:///' + Database_Name )

 A workaround is to use os.chdir()

 thanks,
 Stef Mientki



[web2py] Component updating too quickly

2010-10-31 Thread Luther Goh Lu Feng
In my action, I would like to update a component if the form is
accepted. The component is a comments list and the form is a comment
creation form. The problem is, the component does update, but does not
show the new comment created. I suspect that the component is updating
too quickly. I know this for sure as in the background I am updating
the comments component at regular intervals. So the component gets
updated on the next background refresh.


#process form create comments
if comments_form.accepts(request.vars, session):
 response.flash = 'Comment created'
 response.js = web2py_component('/roverus/comment/read.load?
current_conversation=1');


Re: [web2py] standalone DAL: why is migration table name preceeded by some prefix ?

2010-10-31 Thread Stef Mientki
thanks for the information  Thadeus,
cheers,
Stef

On 31-10-2010 21:59, Thadeus Burgess wrote:
 That is a hash of the connection string you pass in during DAL instantiation. 
 This way you can
 uniquely identify

 db = DAL('sqlite://my.db')

 vs

 db = DAL('postgres://.')

 without overwriting your .table files.

 --
 Thadeus




 On Sun, Oct 31, 2010 at 3:03 PM, Stef Mientki stef.mien...@gmail.com
 mailto:stef.mien...@gmail.com wrote:

 hello,

 I use the following statement to create a standalone DAT table

DB.define_table ( Name, *Fields, migrate = 'Afdeling.table' )

 Why is the name of the migration table prefixed ?

9ca3bd6f71b92b953cff7d3c148b42fc_Afdeling.table

 thanks,
 Stef Mientki





Re: [web2py] Standalone DAL, what's the correct uri for the database location ?

2010-10-31 Thread Stef Mientki
On 31-10-2010 22:01, Thadeus Burgess wrote:
 Have you tried without the file:/// ?
I thought I did, but probably I had other bugs then,
indeed it works without the file///' prefix,
both with forward  and with backward slashes.

thanks,
Stef

 On linux you don't need to specify file:/// you can just give the full path.

 --
 Thadeus




 On Sun, Oct 31, 2010 at 3:19 PM, Stef Mientki stef.mien...@gmail.com
 mailto:stef.mien...@gmail.com wrote:

 hello,

 Standalone DAL,  what's the correct uri for the database location ?

 This works:
  Database_Name = 'ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://' + Database_Name )


 This gives an error, saying couldn;'t find a database after 5 tries
  Database_Name = r'D:/Data_Python_25/Beheer/ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://file:///' + Database_Name )

 A workaround is to use os.chdir()

 thanks,
 Stef Mientki





[web2py] Re: Passing pointer to session, requestion, etc objects to module

2010-10-31 Thread b00m_chef
The problem was that I was using self.session.forget() thinking that
that would take care of getting rid of all of the session info. As
soon as I got rid of that line though, everything worked as normal...
As for references in python, that is how I thought python worked
(coming from C++), but this behavior gave me some doubt.

Thanks for the pointer to look at the environment argument, though
that didn't give any useful info...was there anything particularly
interesting about that argument in that class?



On Oct 31, 12:11 pm, b00m_chef r...@devshell.org wrote:
 thanks!

 On Oct 31, 6:12 am, mr.freeze nat...@freezable.com wrote:



  Python passes arguments by reference so they are not copies. Take a
  look at the constructors for the Crud and Auth classes in gluon/
  tools.py. They receive a variable called 'environment' that contains
  the session and request.

  On Oct 30, 9:00 pm, b00m_chef r...@devshell.org wrote:

   How does one go about passing a pointer to the session and request
   objects from your app to a module in said app. Basically, in a module,
   I need to be able to manipulate all those objects without having to
   return and re-assign them.

   If I simply pass all the session, request, response, etc objects to my
   module object in the constructor and then assign all to self.bla, then
   I only get copies of those objects...I can't change them after.

   Is the above possible?

   Simple example of what I want to do is to be able to do
   session.forget() in my module.


[web2py] Paypal Digital Download

2010-10-31 Thread Andrew Evans
Hello! I am working on a project that requires a Digital Download where the
download is provided after the payment has been sent to paypal.

The documentation on Paypal in web2py is very confusing and I don't know if
its for the purpose of what I need. I am generating a paypal/button for
express checkout. and I am trying to think of ways I can then redirect the
user to a page where they can download the product

Normally this would be simpler but I have multiple people selling there
different products and with that multiple products

here is my paypal code

br /br /
form name=_xclick action=https://www.paypal.com/cgi-bin/webscr;
method=post
input type=hidden name=cmd value=_xclick
input type=hidden name=business
value={{=db.auth_user[row.userinfo].email}}
input type=hidden name=currency_code
value={{=db.currency_paypal[row.currency].current}}
input type=hidden name=item_name value={{=row.product_name}}
input type=hidden name=no_shipping value=1
input type=hidden name=custom value={{=row.id}}
input type=hidden name=amount value={{='%.2f'%float(row.price)}}
input type=hidden name=return value= /
input type=hidden name=cancel_return value=/
input type=image src=http://www.paypal.com/en_US/i/btn/btn_buynow_SM.gif;
border=0 name=submit alt=Make payments with PayPal - it's fast, free
and secure!
/form

So my question is: How can I use paypal for a digital download using the
express checkout button? Do I need to create an IPN class and add notify_url
to my paypal code if so can some one provide an example

*cheers

and ty

Andrew


[web2py] Re: Passing pointer to session, requestion, etc objects to module

2010-10-31 Thread mr.freeze
It's just a nice pattern to follow when building modules that need
access to the response/response/session.  Instead of passing them all
individually, you can just pass globals() and everything you need is
there, similar to auth and crud.

auth = Auth(globals(),db)
crud = Crud(globals(),db)


On Oct 31, 4:36 pm, b00m_chef r...@devshell.org wrote:
 The problem was that I was using self.session.forget() thinking that
 that would take care of getting rid of all of the session info. As
 soon as I got rid of that line though, everything worked as normal...
 As for references in python, that is how I thought python worked
 (coming from C++), but this behavior gave me some doubt.

 Thanks for the pointer to look at the environment argument, though
 that didn't give any useful info...was there anything particularly
 interesting about that argument in that class?

 On Oct 31, 12:11 pm, b00m_chef r...@devshell.org wrote:

  thanks!

  On Oct 31, 6:12 am, mr.freeze nat...@freezable.com wrote:

   Python passes arguments by reference so they are not copies. Take a
   look at the constructors for the Crud and Auth classes in gluon/
   tools.py. They receive a variable called 'environment' that contains
   the session and request.

   On Oct 30, 9:00 pm, b00m_chef r...@devshell.org wrote:

How does one go about passing a pointer to the session and request
objects from your app to a module in said app. Basically, in a module,
I need to be able to manipulate all those objects without having to
return and re-assign them.

If I simply pass all the session, request, response, etc objects to my
module object in the constructor and then assign all to self.bla, then
I only get copies of those objects...I can't change them after.

Is the above possible?

Simple example of what I want to do is to be able to do
session.forget() in my module.




[web2py] multiple select contains

2010-10-31 Thread JmiXIII
Hello,

I'm juste trying to use contains with a custom FORM, but it does not
work with FORM(SELECT,_multiple=True

Here is a piece of my controller:

def rebuts():
#Formulaire de saisie des rebust
 
ListeArticle=db(db.Article.id0).select(orderby=db.Article.CodeArticle)
Selection=FORM(TABLE(TR(
(TD(De l'article,SELECT(_name='DebArt',
*[OPTION(ListeArticle[i].CodeArticle,
_value=str(ListeArticle[i].CodeArticle)) for i in
range(len(ListeArticle))]))),
 TD(A
l'article,SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle,
_value=str(ListeArticle[i].CodeArticle)) for i in
range(len(ListeArticle))])),
 
TD(Test,SELECT(_name='Test',_multiple=True,*[OPTION(ListeArticle[i].CodeArticle,
_value=str(ListeArticle[i].CodeArticle)) for i in
range(len(ListeArticle))])),
 TD(De la date (-MM-JJ), INPUT(_name='Debut', requires =
IS_DATE(error_message=T('Doit être de la forme -MM-JJ !',
 TD(A la date (-MM-JJ), INPUT(_name='Fin',requires =
IS_DATE(error_message=T('Doit être de la forme -MM-JJ !',
 TD(Sélectionner,
INPUT(_type='submit',_value='Sélectionner')

if Selection.accepts(request.vars,keepvalues=True):
pass

DebArt=request.vars.DebArt
Debut=request.vars.Debut
Fin=request.vars.Fin
FinArt=request.vars.FinArt
Test=request.vars.Test

[...]

   query5=db(db.GPOF.OF_CART.contains(Test)).select()
[...]
   return dict(query5=query5,Test=Test)


If I submit one value to the Test field = query5 act as I want
(=returns db.GPOF whose field OF_CART=Test)
If I submit more than one value to the Test Field = query5 does not
return anything.

I guess this question have already been asked around there but I
cannot find it through the group.
Can somebody help me with this , I'd like to returen all rows db.GP_OF
whose field are selected via the Test multiple select field 

Thanks a lot



Re: [web2py] Standalone DAL, what's the correct uri for the database location ?

2010-10-31 Thread rochacbruno
What about the folder atribute?

DAL('sqlite://db.db',folder='D://...')


Enviado via iPhone

Em 31/10/2010, às 19:30, Stef Mientki stef.mien...@gmail.com escreveu:

 On 31-10-2010 22:01, Thadeus Burgess wrote:
 
 Have you tried without the file:/// ?
 I thought I did, but probably I had other bugs then,
 indeed it works without the file///' prefix,
 both with forward  and with backward slashes.
 
 thanks,
 Stef
 
 On linux you don't need to specify file:/// you can just give the full path.
 
 --
 Thadeus
 
 
 
 
 On Sun, Oct 31, 2010 at 3:19 PM, Stef Mientki stef.mien...@gmail.com wrote:
 hello,
 
 Standalone DAL,  what's the correct uri for the database location ?
 
 This works:
  Database_Name = 'ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://' + Database_Name )
 
 
 This gives an error, saying couldn;'t find a database after 5 tries
  Database_Name = r'D:/Data_Python_25/Beheer/ID_TO_Beheer_DAL.db'
  DB = DAL_DB ( 'sqlite://file:///' + Database_Name )
 
 A workaround is to use os.chdir()
 
 thanks,
 Stef Mientki
 
 


[web2py] prefork or worker mpm for apache embedded mode

2010-10-31 Thread Sujan Shakya
The preferred apache configuration for mod_wsgi applications is to run
in daemon mode.
But if the application is to be run in embedded mode, which one is
preferred: prefork mpm or worker mpm ?
And, is DAL threadsafe ?