[web2py] Ajax from menu item?

2010-04-22 Thread Keith Edmunds
Does anyone have any sample code showing how to call the Web2py 'ajax'
function from a menu? I currently have this as a link on a page, and I'd
like to move it to a menu item:

a href=# onclick=ajax(
'{{=URL(request.application, 'dopy', 'new')}}',[], 'DetailArea'
) /New/a

Thanks


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] How to change Web2py interface language

2010-04-22 Thread NoNoNo
I want to change the interface language to English. According to some
post, I change the language of Chrome browser to En, relaunched web2py
and it didn't work. Can anyone help me out?


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] How to change Web2py interface language

2010-04-22 Thread Johann Spies
On 22 April 2010 08:07, NoNoNo coldspring830...@gmail.com wrote:
 I want to change the interface language to English. According to some
 post, I change the language of Chrome browser to En, relaunched web2py
 and it didn't work. Can anyone help me out?

I just added Afrikaans to a page. The name af-af.py did not work for
me, but when I changed it to af.py, web2py responded to my browser's
Afrikaans preference.

I wonder why the default naming of the files use the double-names like es-es.py.

Regards
Johann

-- 
Finally, brethren, whatsoever things are true,  whatsoever things are
honest, whatsoever things are  just, whatsoever things are pure,
whatsoever things are lovely, whatsoever things are of good report; if
there be any virtue, and if there be any praise, think on these
things.Philippians 4:8


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] How to change Web2py interface language

2010-04-22 Thread Nicol van der Merwe
[Off topic]

Cool, another Afrikaans speaking person that uses web2py! Totally sweet, or
rather uitstekend. Hi Johan!

[Off topic]


Nicolaas van der Merwe
-- 
If we hit that bullseye, the rest of the dominoes should fall like a house
of cards. Checkmate.  -Z. Brannigan

On Thu, Apr 22, 2010 at 12:07 PM, Johann Spies johann.sp...@gmail.comwrote:

 On 22 April 2010 08:07, NoNoNo coldspring830...@gmail.com wrote:
  I want to change the interface language to English. According to some
  post, I change the language of Chrome browser to En, relaunched web2py
  and it didn't work. Can anyone help me out?

 I just added Afrikaans to a page. The name af-af.py did not work for
 me, but when I changed it to af.py, web2py responded to my browser's
 Afrikaans preference.

 I wonder why the default naming of the files use the double-names like
 es-es.py.

 Regards
 Johann

 --
 Finally, brethren, whatsoever things are true,  whatsoever things are
 honest, whatsoever things are  just, whatsoever things are pure,
 whatsoever things are lovely, whatsoever things are of good report; if
 there be any virtue, and if there be any praise, think on these
 things.Philippians 4:8


 --
 Subscription settings:
 http://groups.google.com/group/web2py/subscribe?hl=en



Re: [web2py] Re: can I hook my code to db.connect() ?

2010-04-22 Thread Alexey Nezhdanov
Sure.
In short: everything works ok.

In detail - see below.


(Pdb) l 1
  1 # -*- coding: utf-8 -*-
  2
  3 exec('from applications.%s.modules import cfg' %
request.application)
  4 db = DAL('oracle://%s/%...@%s'%(cfg.oralogin,cfg.orapassword,cfg.oradb),
pool_size=10)
  5
  6 db.define_table('mytable',
  7   Field('myfield','string'),
  8   Field('mydt','datetime'),
  9 )
 10
 11  - import pdb;pdb.set_trace()
(Pdb) db.mytable.insert(myfield='aaa',mydt='2010-04-22 00:00:00')
1
(Pdb) db.mytable.insert(myfield='bbb',mydt='2010-04-22 10:00:00')
2
(Pdb) db.commit()
(Pdb) print db(db.mytable.mydt'2010-04-22 09:00:00').select()
mytable.id,mytable.myfield,mytable.mydt
2,bbb,2010-04-22 10:00:00

(Pdb) print db(db.id0).select()
*** KeyError: 'id'
(Pdb) print db(db.mytable.id0).select()
mytable.id,mytable.myfield,mytable.mydt
1,aaa,2010-04-22 00:00:00
2,bbb,2010-04-22 10:00:00

(Pdb)


On Tue, Apr 20, 2010 at 6:20 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 I think I understand better the problem. Oracle uses the same time for
 DATE and DATETIME, i.e. DATE.
 I made in trunk the change you suggested. Can you please check this
 does not break insert and select of Field('somename','date')?

 On Apr 20, 12:37 am, Alexey Nezhdanov snak...@gmail.com wrote:
  Oh, well.
  May be that's an Oracle bug then. I use my custom 'console.py' script
 here,
  but output should be clear enough:
 
  BTW - time_start column was created by web2py with this line:
  Field('time_start','datetime'),
 
  sn...@nezhdanov:~/VTC/pinger/elixir$ ./console.py
  select time_start from pinger_results where id=1;
  [('TIME_START', type 'cx_Oracle.DATETIME', 23, 7, 0, 0, 1)]
  select time_start from pinger_results where time_start='2010-04-20
  15:16:17';
  ORA-01861: литерал не соответствует формату строки
  ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'
  ok
  select time_start from pinger_results where time_start='2010-04-20
  15:16:17';
  [('TIME_START', type 'cx_Oracle.DATETIME', 23, 7, 0, 0, 1)]
  ==
  no comments
 
  Alexey
 
  On Mon, Apr 19, 2010 at 8:27 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   taking a second look at the source code
 
  self._execute(ALTER SESSION SET NLS_DATE_FORMAT = '-
   MM-DD';)
  self._execute(ALTER SESSION SET NLS_TIMESTAMP_FORMAT =
   '-MM-DD HH24:MI:SS';)
 
   Now you propose adding:
 
  self._execute(ALTER SESSION set NLS_DATE_FORMAT = '-
   MM-DD HH24:MI:SS';)
 
   But date does not have HH224, MI, SS, only timestamp does.
 
   On Apr 19, 11:19 am, Alexey Nezhdanov snak...@gmail.com wrote:
No, I'm all for it. Actually it sounds more like bugfix since atm
 web2py
can't make datetime queries on Oracle.
 
On Mon, Apr 19, 2010 at 6:16 PM, mdipierro mdipie...@cs.depaul.edu
   wrote:
 There is no hook for this, but should this not be always the
 default?
 If so I am happy to add it to trunk. Any counterindication?
 
 On Apr 19, 12:32 am, Alexey Nezhdanov snak...@gmail.com wrote:
  Hi.
  Sometimes I have to execute this line prior to making a query:
  oradb.executesql(ALTER SESSION set NLS_DATE_FORMAT =
 '-MM-DD
  HH24:MI:SS';)
 
  That is because Oracle by default uses different date format that
   causes
 my
  queries to fail.
  The problem is that doing that in model is incorrect - this
 should be
  executed just once for each db connection.
  Doing that just prior to query is inconvenient and still
 incorrect -
   I am
  probably reusing same connection.
  Can I somehow tell web2py to execute this sql right after calling
 connect()?
 
  Regards
  Alexey
 
  --
  Subscription settings:
http://groups.google.com/group/web2py/subscribe?hl=en



Re: [web2py] Re: can I hook my code to db.connect() ?

2010-04-22 Thread Alexey Nezhdanov
Aargh...
You asked to check _date_ type of field. But it works ok too:


- import pdb;pdb.set_trace()
(Pdb) l 1
  1 # -*- coding: utf-8 -*-
  2
  3 exec('from applications.%s.modules import cfg' %
request.application)
  4 db = DAL('oracle://%s/%...@%s'%(cfg.oralogin,cfg.orapassword,cfg.oradb),
pool_size=10)
  5
  6 db.define_table('mytable',
  7   Field('myfield','string'),
  8   Field('mydt','datetime'),
  9   Field('mydt2','date'),
 10 )
 11
(Pdb)
 12  - import pdb;pdb.set_trace()
[EOF]
(Pdb) db.mytable.insert(myfield='ccc',mydt2='2010-04-22')
3
(Pdb) db.mytable.insert(myfield='ddd',mydt2='2010-04-23')
4
(Pdb) db.commit()
(Pdb) db(db.mytable.id0).select()
gluon.sql.Rows object at 0xb28330c
(Pdb) print db(db.mytable.id0).select()
mytable.id,mytable.myfield,mytable.mydt,mytable.mydt2
1,aaa,2010-04-22 00:00:00,NULL
2,bbb,2010-04-22 10:00:00,NULL
3,ccc,NULL,2010-04-22
4,ddd,NULL,2010-04-23
(Pdb) print db(db.mytable.mydt2'2010-04-22').select()
mytable.id,mytable.myfield,mytable.mydt,mytable.mydt2
4,ddd,NULL,2010-04-23
(Pdb)


Regards
Alexey

On Thu, Apr 22, 2010 at 2:43 PM, Alexey Nezhdanov snak...@gmail.com wrote:

 Sure.
 In short: everything works ok.

 In detail - see below.


 (Pdb) l 1
   1 # -*- coding: utf-8 -*-
   2
   3 exec('from applications.%s.modules import cfg' %
 request.application)
   4 db = 
 DAL('oracle://%s/%...@%s'%(cfg.oralogin,cfg.orapassword,cfg.oradb),
 pool_size=10)
   5
   6 db.define_table('mytable',
   7   Field('myfield','string'),
   8   Field('mydt','datetime'),
   9 )
  10
  11  - import pdb;pdb.set_trace()
 (Pdb) db.mytable.insert(myfield='aaa',mydt='2010-04-22 00:00:00')
 1
 (Pdb) db.mytable.insert(myfield='bbb',mydt='2010-04-22 10:00:00')
 2
 (Pdb) db.commit()
 (Pdb) print db(db.mytable.mydt'2010-04-22 09:00:00').select()
 mytable.id,mytable.myfield,mytable.mydt
 2,bbb,2010-04-22 10:00:00

 (Pdb) print db(db.id0).select()
 *** KeyError: 'id'
 (Pdb) print db(db.mytable.id0).select()
 mytable.id,mytable.myfield,mytable.mydt
 1,aaa,2010-04-22 00:00:00
 2,bbb,2010-04-22 10:00:00

 (Pdb)



 On Tue, Apr 20, 2010 at 6:20 PM, mdipierro mdipie...@cs.depaul.eduwrote:

 I think I understand better the problem. Oracle uses the same time for
 DATE and DATETIME, i.e. DATE.
 I made in trunk the change you suggested. Can you please check this
 does not break insert and select of Field('somename','date')?

 On Apr 20, 12:37 am, Alexey Nezhdanov snak...@gmail.com wrote:
  Oh, well.
  May be that's an Oracle bug then. I use my custom 'console.py' script
 here,
  but output should be clear enough:
 
  BTW - time_start column was created by web2py with this line:
  Field('time_start','datetime'),
 
  sn...@nezhdanov:~/VTC/pinger/elixir$ ./console.py
  select time_start from pinger_results where id=1;
  [('TIME_START', type 'cx_Oracle.DATETIME', 23, 7, 0, 0, 1)]
  select time_start from pinger_results where time_start='2010-04-20
  15:16:17';
  ORA-01861: литерал не соответствует формату строки
  ALTER SESSION set NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'
  ok
  select time_start from pinger_results where time_start='2010-04-20
  15:16:17';
  [('TIME_START', type 'cx_Oracle.DATETIME', 23, 7, 0, 0, 1)]
  ==
  no comments
 
  Alexey
 
  On Mon, Apr 19, 2010 at 8:27 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   taking a second look at the source code
 
  self._execute(ALTER SESSION SET NLS_DATE_FORMAT = '-
   MM-DD';)
  self._execute(ALTER SESSION SET NLS_TIMESTAMP_FORMAT =
   '-MM-DD HH24:MI:SS';)
 
   Now you propose adding:
 
  self._execute(ALTER SESSION set NLS_DATE_FORMAT = '-
   MM-DD HH24:MI:SS';)
 
   But date does not have HH224, MI, SS, only timestamp does.
 
   On Apr 19, 11:19 am, Alexey Nezhdanov snak...@gmail.com wrote:
No, I'm all for it. Actually it sounds more like bugfix since atm
 web2py
can't make datetime queries on Oracle.
 
On Mon, Apr 19, 2010 at 6:16 PM, mdipierro mdipie...@cs.depaul.edu
 
   wrote:
 There is no hook for this, but should this not be always the
 default?
 If so I am happy to add it to trunk. Any counterindication?
 
 On Apr 19, 12:32 am, Alexey Nezhdanov snak...@gmail.com wrote:
  Hi.
  Sometimes I have to execute this line prior to making a query:
  oradb.executesql(ALTER SESSION set NLS_DATE_FORMAT =
 '-MM-DD
  HH24:MI:SS';)
 
  That is because Oracle by default uses different date format
 that
   causes
 my
  queries to fail.
  The problem is that doing that in model is incorrect - this
 should be
  executed just once for each db connection.
  Doing that just prior to query is inconvenient and still
 incorrect -
   I am
  probably reusing same connection.
  Can I somehow tell web2py to execute this sql right after
 calling
 connect()?
 
  Regards
  Alexey
 
  --
  Subscription settings:

[web2py] Re: Preventing login after Auth.register; Adding groups to the register form

2010-04-22 Thread rohfle
I managed to get both of those problems sorted. Thank you for your
input!

Attached below is the rough code I used:
@auth.requires_membership('administrators')
def create():
# set up groups to be put into
groups = db().select(db.auth_group.ALL)
group_fields = []
group_lookup = {}
# create the fields and a lookup table for the ids of the groups
if we want to add them
for g in groups:
name = is_in_group_%s % g.role
group_fields.append(Field(name, boolean,
label=g.role.capitalize()))
group_lookup[name] = g.id
# create the form
form = SQLFORM.factory(db.auth_user,
Field(password_two, password, requires=IS_EXPR('value==%s'
% repr(request.vars.get(password, None)),
 
error_message=auth.messages.mismatched_password),
  label=Verify Password),
*group_fields)
# if all good
if form.accepts(request.vars):
response.flash = 'User %s added successfully!' %
request.vars[username]

# create an ignore list of input names to seperate the user
data from the rest
ignore_list = group_lookup.keys() + [password_two,
_formname]
# seperate the user_data
user_data = {}
for k in request.vars:
if k not in ignore_list:
user_data[k] = request.vars[k]
# create the new user
new_user = db.auth_user.insert(**user_data)
# process the membership information
for g in group_lookup.keys():
if request.vars.get(g, None).lower() == on:
auth.add_membership(group_lookup[g], new_user)
elif form.errors:
response.flash = 'An error has occurred.'
else:
response.flash = 'Please fill out the form.'
return dict(form=form)

On Apr 22, 3:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 auth.resiter() form is not thought for person A to register person B
 but for person A to register itself.

 You can use appadmin to register another person or you have to create
 your own interface for example via

    form=crud.create(db.auth_user)

 You can also make your form more complex

    form=SQLFORM.factory(db.auth_user,Field('group1'),Field('group2')):
    if form.accepts(request.vars):
          insert form.vars into db.auth_user
          if form.vars.group1. auth.add_membership()
          if form.vars.group2. auth.add_membership()

 On Apr 21, 10:00 pm, rohfle roh...@gmail.com wrote:

  When I said logging on, I meant the process of login, not logging
  events.

  Elaborating on the original questions:
  1) For example, I login as an administrator and I register a user name
  named bob. When I click submit to register bob, the currently logged-
  in user gets switched from administrator to bob after being added to
  the database. Can I stop this switch from occurring?

  2) I want to extend the register form from looking in HTML like:
          [username]
          [firstname]
          [lastname]
          [password]
          [verify password]
                        Submit
  to:
          [username]
          [firstname]
          [lastname]
          [password]
          [verify password]

         [x] group1
         [  ] group2
                        Submit
  where group1 and group2 come from the table auth_group.

  Sorry I should have made these things clearer.

  On Apr 22, 2:13 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   1) Yes. Look at the bottom of this page:

  http://www.web2py.com/book/default/section/8/2

   If you set a log message to None, the log is not performed.

   2) Not sure I understand. You can do

   auth.settings.register_onaccept=lambda form: do_something_with(form)

   On Apr 21, 8:14 pm, rohfle roh...@gmail.com wrote:

Couple of questions about web2py Auth:

1) Can I stop Auth.register from logging on as the newly created user
after registration?
2) Is there a way to add group membership to form returned by
Auth.register?

--
Subscription 
settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Database migration does not work

2010-04-22 Thread Matthew
Database: PostgreSQL
web2py: 1.76.5

Database migration doesn't seem to be working. I've added a new field
to my database, and sql.log says the table has been successfully
altered.

ALTER TABLE performer ADD musicbrainz_guid VARCHAR(512);
timestamp: 2010-04-19T20:55:38.147015

However, when I try to query my data in the admin console, I see this
message:

Invalid Query: column performer.musicbrainz_guid does not exist

I found this post,
http://groups.google.com/group/web2py/browse_thread/thread/23353f4a0265d009/de6dadfeee3580f0?lnk=gstq=database+migration#de6dadfeee3580f0,
but I don't think it's related to my issue.

Thanks,
Matthew


[web2py] Display contents of a folder

2010-04-22 Thread greenpoise
I want to display the contents (files) of a folder and be able to
click and download the files. How is this accomplished within a
controller? leads? any examples out there? I know there is os.path,
os.listdir and glob. Do I have to import the modules in Web2Py?


Thanks



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Database migration does not work

2010-04-22 Thread Kuba Kucharski
Can you show us the line with a query code?

-- 
Kuba


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] repeated call of form.accepts produces odd results

2010-04-22 Thread selecta
due to some strange code that I produced I found that form.accepts
will swallow the formkey etc.

def index():
return dict()

def noformsubmit():
form = form_factory(Field('tag_name'))
msg = 'no'
for i in range(1):
if form.accepts(request.vars, session):
msg = 'yes'
return dict(form = form, msg = msg)

index.html
{{=LOAD('default', 'noformsubmit', ajax = True)}}

noformsubmit.html
msg: {{=msg}}
{{=form.custom.begin}}
input id=tag_name name=tag_name value= size=5 /
input type=submit value=tag /
{{=form.custom.end}}

on the initial call the formkey will be swallowed
if the form is submitted the formkey will be added to the form

even though you might not want to produce this code the behavior is
strange and should not be like that



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: tagging content in user-documentation - TO: WEB2PY COMMUNITY

2010-04-22 Thread mdipierro
Tagging is a good idea. I will add that.

By the way, email me personally and I can give permission to edit
pages.

On Apr 22, 12:40 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 SUMMARIZE:

 could we improve web2py documentation dramatically w/o creating a lot
 of new content just by tagging?

 FULL:

 After Massimo's post in Preventing login after Auth.register; Adding
 groups to the register form

 It is in the book but it is called form_factory. web2py support both
 names.

 I know, factory is there. but there is no info about this little trick:

 SQLFORM.factory(db.auth_user, Field('something'))

 I know it is lame--not-a-trick for programmers/carefull readers of the book

 but how can one(student, beginner) know he can do that? Let me present
 you some feedback about teaching web2py to students of.. psychology
 ..with some background in programming
 (means: after 1 year of  basics+databases(EXCEL;)+MYSQL)+Python - yes,
 they are pretty green but they know what an object is more or less,
 they know what does it mean to return a value, they understand what
 the database is. they are probably convinced they know how it works)

 They see db.auth_user as a whole table of data(YES), not the
 definition, they stick to this thinking almost to the end, they give
 up after showing them how it is coded in DAL, how f.e the drop()
 method works

 I needed to explain this thing to many of them. Somehow, they see it
 that way. And you probably know why..
 because of this: db.person['id'] ;)

 of course, IN THE BOOK:

 It defines, stores and returns a Table object called person
 containing a field (column) name. This object can also be accessed
 via db.person, so you do not need to catch the return value.
 define_table checks whether or not the corresponding table exists.

 (they claim they understand those first 6 sections of the book but it
 seems they missed some details)

 should this sentence: It defines,...  go UPPERCASE? Or rather go
 uppercase when beginner button CLICKED in the book app?

 the book is great BUT pretty condensed. hard to read for someone who
 just learned a lot of things from the python section of the web2py
 book.

 This is the point of my question. Even if I am still wrong and the
 trick is in the book, the question still stands.

 Massimo, I don't expect nor want to waste your time to implement such
 things especially since the book app is online and free AFAIK. I am
 asking community, does marking/tagging things in the book/other
 recipes makes sense for you? because tagging will be a lot of work.
 but could this improve web2py documentation dramatically w/o creating
 new content?

 Maybe this could nicely complete the idea of making new tutorials on
 different levels of knowledge.

 quote from the previous thread:
 
 or.. are we trying to fit to much into the book, and soon we will need
 beginner's and advanced book. normal/extended/with python explanatory
 etc.

 this is a question for all of you:

 How far should we go with documenting, the book/web2pyslices/etc W/O marking
 sections/subsections/sentences *beginner/*advanced(maybe some other
 markers) so we
 could easily split/sort them later?
 

 --
 Kuba

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: How to change Web2py interface language

2010-04-22 Thread mdipierro
we should have both af.py and af-af.py should be treated as different
languages. if you send me your translation I will be happy to include
it.

Massimo

On Apr 22, 5:07 am, Johann Spies johann.sp...@gmail.com wrote:
 On 22 April 2010 08:07, NoNoNo coldspring830...@gmail.com wrote:

  I want to change the interface language to English. According to some
  post, I change the language of Chrome browser to En, relaunched web2py
  and it didn't work. Can anyone help me out?

 I just added Afrikaans to a page. The name af-af.py did not work for
 me, but when I changed it to af.py, web2py responded to my browser's
 Afrikaans preference.

 I wonder why the default naming of the files use the double-names like 
 es-es.py.

 Regards
 Johann

 --
 Finally, brethren, whatsoever things are true,  whatsoever things are
 honest, whatsoever things are  just, whatsoever things are pure,
 whatsoever things are lovely, whatsoever things are of good report; if
 there be any virtue, and if there be any praise, think on these
 things.    Philippians 4:8

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Display contents of a folder

2010-04-22 Thread mdipierro
something like this?

def folder():
import os
return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
path/')]))

On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:
 I want to display the contents (files) of a folder and be able to
 click and download the files. How is this accomplished within a
 controller? leads? any examples out there? I know there is os.path,
 os.listdir and glob. Do I have to import the modules in Web2Py?

 Thanks

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: tagging content in user-documentation - TO: WEB2PY COMMUNITY

2010-04-22 Thread selecta
massimo, you could use my improved tagging plugin if you want to
it allows single users to create tags for single record and display
tag clouds for a single record, table, and a general tag cloud

On Apr 22, 3:35 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Tagging is a good idea. I will add that.

 By the way, email me personally and I can give permission to edit
 pages.

 On Apr 22, 12:40 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:



  SUMMARIZE:

  could we improve web2py documentation dramatically w/o creating a lot
  of new content just by tagging?

  FULL:

  After Massimo's post in Preventing login after Auth.register; Adding
  groups to the register form

  It is in the book but it is called form_factory. web2py support both
  names.

  I know, factory is there. but there is no info about this little trick:

  SQLFORM.factory(db.auth_user, Field('something'))

  I know it is lame--not-a-trick for programmers/carefull readers of the 
  book

  but how can one(student, beginner) know he can do that? Let me present
  you some feedback about teaching web2py to students of.. psychology
  ..with some background in programming
  (means: after 1 year of  basics+databases(EXCEL;)+MYSQL)+Python - yes,
  they are pretty green but they know what an object is more or less,
  they know what does it mean to return a value, they understand what
  the database is. they are probably convinced they know how it works)

  They see db.auth_user as a whole table of data(YES), not the
  definition, they stick to this thinking almost to the end, they give
  up after showing them how it is coded in DAL, how f.e the drop()
  method works

  I needed to explain this thing to many of them. Somehow, they see it
  that way. And you probably know why..
  because of this: db.person['id'] ;)

  of course, IN THE BOOK:

  It defines, stores and returns a Table object called person
  containing a field (column) name. This object can also be accessed
  via db.person, so you do not need to catch the return value.
  define_table checks whether or not the corresponding table exists.

  (they claim they understand those first 6 sections of the book but it
  seems they missed some details)

  should this sentence: It defines,...  go UPPERCASE? Or rather go
  uppercase when beginner button CLICKED in the book app?

  the book is great BUT pretty condensed. hard to read for someone who
  just learned a lot of things from the python section of the web2py
  book.

  This is the point of my question. Even if I am still wrong and the
  trick is in the book, the question still stands.

  Massimo, I don't expect nor want to waste your time to implement such
  things especially since the book app is online and free AFAIK. I am
  asking community, does marking/tagging things in the book/other
  recipes makes sense for you? because tagging will be a lot of work.
  but could this improve web2py documentation dramatically w/o creating
  new content?

  Maybe this could nicely complete the idea of making new tutorials on
  different levels of knowledge.

  quote from the previous thread:
  
  or.. are we trying to fit to much into the book, and soon we will need
  beginner's and advanced book. normal/extended/with python explanatory
  etc.

  this is a question for all of you:

  How far should we go with documenting, the book/web2pyslices/etc W/O marking
  sections/subsections/sentences *beginner/*advanced(maybe some other
  markers) so we
  could easily split/sort them later?
  

  --
  Kuba

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Display contents of a folder

2010-04-22 Thread greenpoise
will try and post. Thanks


dan



On Apr 22, 9:39 am, mdipierro mdipie...@cs.depaul.edu wrote:
 something like this?

 def folder():
     import os
     return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
 path/')]))

 On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:



  I want to display the contents (files) of a folder and be able to
  click and download the files. How is this accomplished within a
  controller? leads? any examples out there? I know there is os.path,
  os.listdir and glob. Do I have to import the modules in Web2Py?

  Thanks

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Display contents of a folder

2010-04-22 Thread mdipierro
just make sure you NEVER do os.chdir() that is not thread safe and
breaks web2py.

On Apr 22, 8:49 am, greenpoise danel.sega...@gmail.com wrote:
 will try and post. Thanks

 dan

 On Apr 22, 9:39 am, mdipierro mdipie...@cs.depaul.edu wrote:

  something like this?

  def folder():
      import os
      return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
  path/')]))

  On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:

   I want to display the contents (files) of a folder and be able to
   click and download the files. How is this accomplished within a
   controller? leads? any examples out there? I know there is os.path,
   os.listdir and glob. Do I have to import the modules in Web2Py?

   Thanks

   --
   Subscription 
   settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: tagging content in user-documentation - TO: WEB2PY COMMUNITY

2010-04-22 Thread mdipierro
Can you email it to me, to make sure I have the latest?

On Apr 22, 8:46 am, selecta gr...@delarue-berlin.de wrote:
 massimo, you could use my improved tagging plugin if you want to
 it allows single users to create tags for single record and display
 tag clouds for a single record, table, and a general tag cloud

 On Apr 22, 3:35 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Tagging is a good idea. I will add that.

  By the way, email me personally and I can give permission to edit
  pages.

  On Apr 22, 12:40 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:

   SUMMARIZE:

   could we improve web2py documentation dramatically w/o creating a lot
   of new content just by tagging?

   FULL:

   After Massimo's post in Preventing login after Auth.register; Adding
   groups to the register form

   It is in the book but it is called form_factory. web2py support both
   names.

   I know, factory is there. but there is no info about this little trick:

   SQLFORM.factory(db.auth_user, Field('something'))

   I know it is lame--not-a-trick for programmers/carefull readers of the 
   book

   but how can one(student, beginner) know he can do that? Let me present
   you some feedback about teaching web2py to students of.. psychology
   ..with some background in programming
   (means: after 1 year of  basics+databases(EXCEL;)+MYSQL)+Python - yes,
   they are pretty green but they know what an object is more or less,
   they know what does it mean to return a value, they understand what
   the database is. they are probably convinced they know how it works)

   They see db.auth_user as a whole table of data(YES), not the
   definition, they stick to this thinking almost to the end, they give
   up after showing them how it is coded in DAL, how f.e the drop()
   method works

   I needed to explain this thing to many of them. Somehow, they see it
   that way. And you probably know why..
   because of this: db.person['id'] ;)

   of course, IN THE BOOK:

   It defines, stores and returns a Table object called person
   containing a field (column) name. This object can also be accessed
   via db.person, so you do not need to catch the return value.
   define_table checks whether or not the corresponding table exists.

   (they claim they understand those first 6 sections of the book but it
   seems they missed some details)

   should this sentence: It defines,...  go UPPERCASE? Or rather go
   uppercase when beginner button CLICKED in the book app?

   the book is great BUT pretty condensed. hard to read for someone who
   just learned a lot of things from the python section of the web2py
   book.

   This is the point of my question. Even if I am still wrong and the
   trick is in the book, the question still stands.

   Massimo, I don't expect nor want to waste your time to implement such
   things especially since the book app is online and free AFAIK. I am
   asking community, does marking/tagging things in the book/other
   recipes makes sense for you? because tagging will be a lot of work.
   but could this improve web2py documentation dramatically w/o creating
   new content?

   Maybe this could nicely complete the idea of making new tutorials on
   different levels of knowledge.

   quote from the previous thread:
   
   or.. are we trying to fit to much into the book, and soon we will need
   beginner's and advanced book. normal/extended/with python explanatory
   etc.

   this is a question for all of you:

   How far should we go with documenting, the book/web2pyslices/etc W/O 
   marking
   sections/subsections/sentences *beginner/*advanced(maybe some other
   markers) so we
   could easily split/sort them later?
   

   --
   Kuba

   --
   Subscription 
   settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: getting started with fbconnect

2010-04-22 Thread Rohan
Hi Christian,

you can check  http://www.web2pyslices.com/main/slices/take_slice/77
I have not tried it yet but thought let you know about it.

Thanks


On Apr 20, 10:10 am, howesc how...@umich.edu wrote:
 Rohan,

 Someone pointed out gaema (http://code.google.com/p/gaema/) on the
 group a couple of weeks ago as a tool that integrates google, twitter,
 facebook, and others with google app engine.  i'm in the process of
 adapting it to work with web2py auth (for GAE and non GAE apps).  If
 all goes well look for an update from me in the next day or two with
 my progress.

 christian

 On Apr 19, 12:17 am, Rohan yourbuddyro...@gmail.com wrote:



  Hi All,

  I want to use fbconnect with web2py. I found couple of threads in this
  group
  1.http://groups.google.com/group/web2py/browse_frm/thread/84f27e0a06312...
  2.http://groups.google.com/group/web2py/browse_frm/thread/31e9149ad7310...

  but I am not able to find any document to get started with using
  fbconnect with web2py. I have already obtained API key from facebook.
  Can someone please share any doc for using fbconnect with web2py?

  Thanks


[web2py] Re: MySQL server has gone away

2010-04-22 Thread mdipierro
Something like this is now in trunk. Just do

db = DAL(...)

please take a look.

On Apr 21, 1:12 am, Igor Gassko gas...@gmail.com wrote:
 Could you please post on this thread, once there's built-in solution
 for keeping pooled connections alive?
 For now, I've seen that you may end up with several dead connection in
 the pool, so slighly better solution might be as follows:

 for x in range(10):
     try:
         db = DAL(connection_string, pool_size=5)
         break
     except:
         import time
         time.sleep(1)

 On Mar 26, 6:04 pm, mdipierro mdipie...@cs.depaul.edu wrote:



  Eventually a fix at the web2py level would not be much different than
  this.

  Massimo

  On Mar 26, 10:03 am, David Zejda d...@atlas.cz wrote:

   Thanks. The workaround works, even when keeping the pool. :)

   D.

try:
    db=DAL(mysql://a:b...@localhost/c, pool_size=5)
except:
    db=DAL(mysql://a:b...@localhost/c, pool_size=5)

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Display contents of a folder

2010-04-22 Thread greenpoise
It works. Thanks. Is this TABLE(*[TR(TD(f)) for the purpose of the
view?




On Apr 22, 10:01 am, mdipierro mdipie...@cs.depaul.edu wrote:
 just make sure you NEVER do os.chdir() that is not thread safe and
 breaks web2py.

 On Apr 22, 8:49 am, greenpoise danel.sega...@gmail.com wrote:

  will try and post. Thanks

  dan

  On Apr 22, 9:39 am, mdipierro mdipie...@cs.depaul.edu wrote:

   something like this?

   def folder():
       import os
       return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
   path/')]))

   On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:

I want to display the contents (files) of a folder and be able to
click and download the files. How is this accomplished within a
controller? leads? any examples out there? I know there is os.path,
os.listdir and glob. Do I have to import the modules in Web2Py?

Thanks

--
Subscription 
settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: tagging content in user-documentation - TO: WEB2PY COMMUNITY

2010-04-22 Thread selecta
sure, i'm adding some improvements right now, will send it soon

On Apr 22, 4:02 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Can you email it to me, to make sure I have the latest?

 On Apr 22, 8:46 am, selecta gr...@delarue-berlin.de wrote:



  massimo, you could use my improved tagging plugin if you want to
  it allows single users to create tags for single record and display
  tag clouds for a single record, table, and a general tag cloud

  On Apr 22, 3:35 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Tagging is a good idea. I will add that.

   By the way, email me personally and I can give permission to edit
   pages.

   On Apr 22, 12:40 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:

SUMMARIZE:

could we improve web2py documentation dramatically w/o creating a lot
of new content just by tagging?

FULL:

After Massimo's post in Preventing login after Auth.register; Adding
groups to the register form

It is in the book but it is called form_factory. web2py support both
names.

I know, factory is there. but there is no info about this little trick:

SQLFORM.factory(db.auth_user, Field('something'))

I know it is lame--not-a-trick for programmers/carefull readers of 
the book

but how can one(student, beginner) know he can do that? Let me present
you some feedback about teaching web2py to students of.. psychology
..with some background in programming
(means: after 1 year of  basics+databases(EXCEL;)+MYSQL)+Python - yes,
they are pretty green but they know what an object is more or less,
they know what does it mean to return a value, they understand what
the database is. they are probably convinced they know how it works)

They see db.auth_user as a whole table of data(YES), not the
definition, they stick to this thinking almost to the end, they give
up after showing them how it is coded in DAL, how f.e the drop()
method works

I needed to explain this thing to many of them. Somehow, they see it
that way. And you probably know why..
because of this: db.person['id'] ;)

of course, IN THE BOOK:

It defines, stores and returns a Table object called person
containing a field (column) name. This object can also be accessed
via db.person, so you do not need to catch the return value.
define_table checks whether or not the corresponding table exists.

(they claim they understand those first 6 sections of the book but it
seems they missed some details)

should this sentence: It defines,...  go UPPERCASE? Or rather go
uppercase when beginner button CLICKED in the book app?

the book is great BUT pretty condensed. hard to read for someone who
just learned a lot of things from the python section of the web2py
book.

This is the point of my question. Even if I am still wrong and the
trick is in the book, the question still stands.

Massimo, I don't expect nor want to waste your time to implement such
things especially since the book app is online and free AFAIK. I am
asking community, does marking/tagging things in the book/other
recipes makes sense for you? because tagging will be a lot of work.
but could this improve web2py documentation dramatically w/o creating
new content?

Maybe this could nicely complete the idea of making new tutorials on
different levels of knowledge.

quote from the previous thread:

or.. are we trying to fit to much into the book, and soon we will need
beginner's and advanced book. normal/extended/with python explanatory
etc.

this is a question for all of you:

How far should we go with documenting, the book/web2pyslices/etc W/O 
marking
sections/subsections/sentences *beginner/*advanced(maybe some other
markers) so we
could easily split/sort them later?


--
Kuba

--
Subscription 
settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Patrick


On Apr 21, 10:41 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 It is crytical that the my_hmac_key in your example be the same as
 auth.settings.hmac_key

 On Apr 21, 10:09 pm, Jonathan Lundell jlund...@pobox.com wrote:



  On Apr 21, 2010, at 7:09 PM, mdipierro wrote:

   NO. You cannot use

   password=IS_CRYPT()(passwd)[0])

   You must use

   password=db.auth_user.password.requires[0](passwd)[0])

   the reason is that IS_CRYPT() by default uses MD5 while if you pass a
   key IS_CRYPT(key='sha521:blabla') is uses better algorithms (for
   example hmac+sha512). So to encrypt the password you have to use the
   same IS_CRYPT(key='...') that you used when defining the model.

   When you create a new app from admin, auth uses hmac+sha512.

  FWIW (and I'm not sure it's responsive to the original question), I use 
  something like this:

      uid = auth.get_or_create_user(dict(username='xxx', first_name='fff', 
  last_name='lll',
          email='whate...@localhost', password=hmac.new(my_hmac_key, 'hey!', 
  sha512).hexdigest(), registration_key=))
      auth.add_membership(gid_admin, uid)

  --

Massimo,

I tried your way however it doesn't set the password, (it is None in
appadmin). Could you elaborate more on your example?


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Patrick


On Apr 21, 10:09 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 21, 2010, at 7:09 PM, mdipierro wrote:

  NO. You cannot use

  password=IS_CRYPT()(passwd)[0])

  You must use

  password=db.auth_user.password.requires[0](passwd)[0])

  the reason is that IS_CRYPT() by default uses MD5 while if you pass a
  key IS_CRYPT(key='sha521:blabla') is uses better algorithms (for
  example hmac+sha512). So to encrypt the password you have to use the
  same IS_CRYPT(key='...') that you used when defining the model.

  When you create a new app from admin, auth uses hmac+sha512.

 FWIW (and I'm not sure it's responsive to the original question), I use 
 something like this:

     uid = auth.get_or_create_user(dict(username='xxx', first_name='fff', 
 last_name='lll',
         email='whate...@localhost', password=hmac.new(my_hmac_key, 'hey!', 
 sha512).hexdigest(), registration_key=))
     auth.add_membership(gid_admin, uid)

 --

I've attempted to use your example but I get an error saying 'hmac' is
not defined. Aside from that it works if I remove the hmac.new
altogether but then I'm stuck with it setting the password but not
being able to log in due to it not being hashed properly. Thanks, for
showing me a simpler way with auth.get_or_create_user.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] How to use YAML fixturing with web2py

2010-04-22 Thread Thadeus Burgess
I wrote a blog post on fixutres and pre-loading your database with default data.

http://thadeusb.com/weblog/archive/2010/4/21/using_fixtures_in_web2py/36

I am looking for an implementation to load YAML files that consists of
one file (it only has to perform loading on the most basic YAML
objects). PyYaml is a massive library for the purposes of
redistributing as a plugin.

--
Thadeus


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 7:55 AM, Patrick wrote:

 
 
 On Apr 21, 10:09 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 21, 2010, at 7:09 PM, mdipierro wrote:
 
 NO. You cannot use
 
 password=IS_CRYPT()(passwd)[0])
 
 You must use
 
 password=db.auth_user.password.requires[0](passwd)[0])
 
 the reason is that IS_CRYPT() by default uses MD5 while if you pass a
 key IS_CRYPT(key='sha521:blabla') is uses better algorithms (for
 example hmac+sha512). So to encrypt the password you have to use the
 same IS_CRYPT(key='...') that you used when defining the model.
 
 When you create a new app from admin, auth uses hmac+sha512.
 
 FWIW (and I'm not sure it's responsive to the original question), I use 
 something like this:
 
 uid = auth.get_or_create_user(dict(username='xxx', first_name='fff', 
 last_name='lll',
 email='whate...@localhost', password=hmac.new(my_hmac_key, 'hey!', 
 sha512).hexdigest(), registration_key=))
 auth.add_membership(gid_admin, uid)
 
 --
 
 I've attempted to use your example but I get an error saying 'hmac' is
 not defined.

I left out: import hmac (it's from the Python library)

 Aside from that it works if I remove the hmac.new
 altogether but then I'm stuck with it setting the password but not
 being able to log in due to it not being hashed properly. Thanks, for
 showing me a simpler way with auth.get_or_create_user.
 
 
 -- 
 Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] repeated call of form.accepts produces odd results

2010-04-22 Thread Thadeus Burgess
Of course, accepts() is not ment to be called multiple times. The
reason it swallows is because it uses sessions to prevent double
submission. So basically calling form.accepts twice is like double
submitting the form from your controller.

To avoid protection against double submission, just call
``form.accepts(request.vars)`` without the session object.

--
Thadeus





On Thu, Apr 22, 2010 at 8:32 AM, selecta gr...@delarue-berlin.de wrote:
 due to some strange code that I produced I found that form.accepts
 will swallow the formkey etc.

 def index():
    return dict()

 def noformsubmit():
    form = form_factory(Field('tag_name'))
    msg = 'no'
    for i in range(1):
        if form.accepts(request.vars, session):
            msg = 'yes'
    return dict(form = form, msg = msg)

 index.html
 {{=LOAD('default', 'noformsubmit', ajax = True)}}

 noformsubmit.html
 msg: {{=msg}}
 {{=form.custom.begin}}
 input id=tag_name name=tag_name value= size=5 /
 input type=submit value=tag /
 {{=form.custom.end}}

 on the initial call the formkey will be swallowed
 if the form is submitted the formkey will be added to the form

 even though you might not want to produce this code the behavior is
 strange and should not be like that



 --
 Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en



Re: [web2py] Re: http://www.web2py.com doesnt load

2010-04-22 Thread Thadeus Burgess
I know. I am just saying our community is growing, and it will be soon
when there are enough of us who are willing to test a release before
it is marked as stable.

I have already started working on my update script on the server...

#update.sh
#!/bin/bash

# first SSH into the machine,
# then run the following commands
cd ~/web2py
hg pull
hg update -r RELEASE

Now I can update all of my web2py instances with one command ! Such
geek pleasures are priceless.


p.s. not that I would want to update ALL of them at the same time,
each needs its own amount of testing after an upgrade.

--
Thadeus





On Wed, Apr 21, 2010 at 9:03 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 We have had nightly builds for long time but people do not check them.
 More precisely very few people check them and therefore bugs are not
 caught.
 The bugs that caused the problems in 1.77.1,2 were not introduced the
 night before but weeks before.
 Most people only download stable releases.

 Massimo

 On Apr 21, 7:49 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 I like Yarko's proposal of R- as it will stay in line with B- B2-, RC- etc 
 etc.

 Hopefully we can get to a point we start having release candidates
 instead of jumping 4 versions because of simple bugfixes :) (I'm
 staring at you 1.77.1-4)

 --
 Thadeus

 On Wed, Apr 21, 2010 at 6:16 PM, Álvaro Justen [Turicas]

 alvarojus...@gmail.com wrote:
  On Tue, Apr 20, 2010 at 16:58, Yarko Tymciurak
  resultsinsoftw...@gmail.com wrote:
  RE:  using R-  as a prefix to release number (especially if adding
  RELEASE as a tag that always points to the LATEST RELEASE):

  Note that the RELEASE tag will move: it essentially will be re-
  tagging at each release.

  As relases move along, having a R-  prefix will leave past releases
  marked conspicuously.  If ONLY  releases will be tagged, this might be
  superfluous - BUT is patches, or test posts are (at any point in the
  future) tagged, then a way to clearly, unambiguously be able to find
  Release tags will be important.   There may be other ways to approach
  this, but this is common, simple, allows tagging a release as beta,
  release candidate, and (potentially) release, without the need to add
  any revisions, for example:

  B2-1.99.99,   RC-1.99.99, and R-1.99.99   might all be different
  changesets - OR the same changeset that passed all these gates.

  The discussion of a tag format of the form:  [Release state]-[Release
  number]   is useful.   It should not be mixed up with discussion of
  having ONE tag which always marks the latest release - these are
  separate concerns.

  I think we should use just the release number as the tag for release
  versions. If we are talking about a bugfix ou release candidate (that
  are in a lowest number compared to releases), so we can use
  number-bugfix or number-RC.
  The default approach to tag versions is to tag releases so, please,
  don't put this ugly R- before the version number - it is intuitive
  and more simple. But the exceptions (anything that isn't a release,
  like RC and bugfixes) should be explicitly tagged.
  We need to use more of the KISS philosophy.

  Hope that helps clarify.
  Regards,
  - Yarko

  On Apr 20, 11:27 am, mdipierro mdipie...@cs.depaul.edu wrote:
  This is easier than I thought. Thanks to yarko for insisting about
  this. Please make sure I do it properly.

  On Apr 20, 10:27 am, Thadeus Burgess thade...@thadeusb.com wrote:

   You mean, I will finally have a way to run stable versions of web2py
   but easily update them !? w00t!

   --
   Thadeus

   On Tue, Apr 20, 2010 at 12:26 AM, Yarko Tymciurak

   resultsinsoftw...@gmail.com wrote:
heckings, so you can ALWAYS get the latest release from Goog

   --
   Subscription 
   settings:http://groups.google.com/group/web2py/subscribe?hl=en

  --
  Álvaro Justen - Turicas
   http://blog.justen.eng.br/
   21 9898-0141



[web2py] Authenticate against the users defined at the server database

2010-04-22 Thread Jose
Hi,

there any way to authenticate against the users defined at the server
database?
That is, pass user and password in db = DAL (...)

Regards,
Jose


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Display contents of a folder

2010-04-22 Thread Thadeus Burgess
Yes, for the view. It is web2py helpers constructing valid XHTML code
that is properly escaped.

Also, for situations like this, the X-Sendfile header would be perfect !

--
Thadeus





On Thu, Apr 22, 2010 at 9:25 AM, greenpoise danel.sega...@gmail.com wrote:
 It works. Thanks. Is this TABLE(*[TR(TD(f)) for the purpose of the
 view?




 On Apr 22, 10:01 am, mdipierro mdipie...@cs.depaul.edu wrote:
 just make sure you NEVER do os.chdir() that is not thread safe and
 breaks web2py.

 On Apr 22, 8:49 am, greenpoise danel.sega...@gmail.com wrote:

  will try and post. Thanks

  dan

  On Apr 22, 9:39 am, mdipierro mdipie...@cs.depaul.edu wrote:

   something like this?

   def folder():
       import os
       return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
   path/')]))

   On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:

I want to display the contents (files) of a folder and be able to
click and download the files. How is this accomplished within a
controller? leads? any examples out there? I know there is os.path,
os.listdir and glob. Do I have to import the modules in Web2Py?

Thanks

--
Subscription 
settings:http://groups.google.com/group/web2py/subscribe?hl=en



[web2py] Re: Display contents of a folder

2010-04-22 Thread greenpoise
I am guessing the helper is TABLE? How would I use it though? I used
glob instead of listdir to predefine wildcards and it worked fine.
What is X-Sendfile?


thanks

Dan

On Apr 22, 11:35 am, Thadeus Burgess thade...@thadeusb.com wrote:
 Yes, for the view. It is web2py helpers constructing valid XHTML code
 that is properly escaped.

 Also, for situations like this, the X-Sendfile header would be perfect !

 --
 Thadeus

 On Thu, Apr 22, 2010 at 9:25 AM, greenpoise danel.sega...@gmail.com wrote:
  It works. Thanks. Is this TABLE(*[TR(TD(f)) for the purpose of the
  view?

  On Apr 22, 10:01 am, mdipierro mdipie...@cs.depaul.edu wrote:
  just make sure you NEVER do os.chdir() that is not thread safe and
  breaks web2py.

  On Apr 22, 8:49 am, greenpoise danel.sega...@gmail.com wrote:

   will try and post. Thanks

   dan

   On Apr 22, 9:39 am, mdipierro mdipie...@cs.depaul.edu wrote:

something like this?

def folder():
    import os
    return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
path/')]))

On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:

 I want to display the contents (files) of a folder and be able to
 click and download the files. How is this accomplished within a
 controller? leads? any examples out there? I know there is os.path,
 os.listdir and glob. Do I have to import the modules in Web2Py?

 Thanks

 --
 Subscription 
 settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread mdipierro
ticket_master = db.auth_user.insert(first_name=fname,
 last_name=lname,
 email=maile,
 
password=db.auth_user.password.requires[0](passwd)[0]))

unless you have a custom auth_user model. In that case depdends on the
password validator(s)


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: http://www.web2py.com doesnt load

2010-04-22 Thread mdipierro
LOL. Good.

On Apr 22, 10:32 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I know. I am just saying our community is growing, and it will be soon
 when there are enough of us who are willing to test a release before
 it is marked as stable.

 I have already started working on my update script on the server...

 #update.sh
 #!/bin/bash

 # first SSH into the machine,
 # then run the following commands
 cd ~/web2py
 hg pull
 hg update -r RELEASE

 Now I can update all of my web2py instances with one command ! Such
 geek pleasures are priceless.

 p.s. not that I would want to update ALL of them at the same time,
 each needs its own amount of testing after an upgrade.

 --
 Thadeus

 On Wed, Apr 21, 2010 at 9:03 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  We have had nightly builds for long time but people do not check them.
  More precisely very few people check them and therefore bugs are not
  caught.
  The bugs that caused the problems in 1.77.1,2 were not introduced the
  night before but weeks before.
  Most people only download stable releases.

  Massimo

  On Apr 21, 7:49 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  I like Yarko's proposal of R- as it will stay in line with B- B2-, RC- etc 
  etc.

  Hopefully we can get to a point we start having release candidates
  instead of jumping 4 versions because of simple bugfixes :) (I'm
  staring at you 1.77.1-4)

  --
  Thadeus

  On Wed, Apr 21, 2010 at 6:16 PM, Álvaro Justen [Turicas]

  alvarojus...@gmail.com wrote:
   On Tue, Apr 20, 2010 at 16:58, Yarko Tymciurak
   resultsinsoftw...@gmail.com wrote:
   RE:  using R-  as a prefix to release number (especially if adding
   RELEASE as a tag that always points to the LATEST RELEASE):

   Note that the RELEASE tag will move: it essentially will be re-
   tagging at each release.

   As relases move along, having a R-  prefix will leave past releases
   marked conspicuously.  If ONLY  releases will be tagged, this might be
   superfluous - BUT is patches, or test posts are (at any point in the
   future) tagged, then a way to clearly, unambiguously be able to find
   Release tags will be important.   There may be other ways to approach
   this, but this is common, simple, allows tagging a release as beta,
   release candidate, and (potentially) release, without the need to add
   any revisions, for example:

   B2-1.99.99,   RC-1.99.99, and R-1.99.99   might all be different
   changesets - OR the same changeset that passed all these gates.

   The discussion of a tag format of the form:  [Release state]-[Release
   number]   is useful.   It should not be mixed up with discussion of
   having ONE tag which always marks the latest release - these are
   separate concerns.

   I think we should use just the release number as the tag for release
   versions. If we are talking about a bugfix ou release candidate (that
   are in a lowest number compared to releases), so we can use
   number-bugfix or number-RC.
   The default approach to tag versions is to tag releases so, please,
   don't put this ugly R- before the version number - it is intuitive
   and more simple. But the exceptions (anything that isn't a release,
   like RC and bugfixes) should be explicitly tagged.
   We need to use more of the KISS philosophy.

   Hope that helps clarify.
   Regards,
   - Yarko

   On Apr 20, 11:27 am, mdipierro mdipie...@cs.depaul.edu wrote:
   This is easier than I thought. Thanks to yarko for insisting about
   this. Please make sure I do it properly.

   On Apr 20, 10:27 am, Thadeus Burgess thade...@thadeusb.com wrote:

You mean, I will finally have a way to run stable versions of web2py
but easily update them !? w00t!

--
Thadeus

On Tue, Apr 20, 2010 at 12:26 AM, Yarko Tymciurak

resultsinsoftw...@gmail.com wrote:
 heckings, so you can ALWAYS get the latest release from Goog

--
Subscription 
settings:http://groups.google.com/group/web2py/subscribe?hl=en

   --
   Álvaro Justen - Turicas
    http://blog.justen.eng.br/
    21 9898-0141


[web2py] Re: Authenticate against the users defined at the server database

2010-04-22 Thread mdipierro
db = DAL('postgres://username:passw...@hostname:port/dbname')

auhenticate against the database authentication. If you want to
authenticate against the OS username:password of the db owner, you
must create a ssh tunnel. That must be done outside web2py.

On Apr 22, 10:34 am, Jose jjac...@gmail.com wrote:
 Hi,

 there any way to authenticate against the users defined at the server
 database?
 That is, pass user and password in db = DAL (...)

 Regards,
 Jose

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Display contents of a folder

2010-04-22 Thread Thadeus Burgess
X-Sendfile is a special header that if it contains a path to a file,
the webserver will ignore everything in response.body and serve the
file that X-Sendfile header points to.

You can read more about it in a recent post.
http://groups.google.com/group/web2py/browse_thread/thread/69c871c1f9d89d62#


TABLE is just one of the many web2py html helpers. Read
http://web2py.com/book/default/section/5/2

--
Thadeus





On Thu, Apr 22, 2010 at 10:52 AM, greenpoise danel.sega...@gmail.com wrote:
 I am guessing the helper is TABLE? How would I use it though? I used
 glob instead of listdir to predefine wildcards and it worked fine.
 What is X-Sendfile?


 thanks

 Dan

 On Apr 22, 11:35 am, Thadeus Burgess thade...@thadeusb.com wrote:
 Yes, for the view. It is web2py helpers constructing valid XHTML code
 that is properly escaped.

 Also, for situations like this, the X-Sendfile header would be perfect !

 --
 Thadeus

 On Thu, Apr 22, 2010 at 9:25 AM, greenpoise danel.sega...@gmail.com wrote:
  It works. Thanks. Is this TABLE(*[TR(TD(f)) for the purpose of the
  view?

  On Apr 22, 10:01 am, mdipierro mdipie...@cs.depaul.edu wrote:
  just make sure you NEVER do os.chdir() that is not thread safe and
  breaks web2py.

  On Apr 22, 8:49 am, greenpoise danel.sega...@gmail.com wrote:

   will try and post. Thanks

   dan

   On Apr 22, 9:39 am, mdipierro mdipie...@cs.depaul.edu wrote:

something like this?

def folder():
    import os
    return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
path/')]))

On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:

 I want to display the contents (files) of a folder and be able to
 click and download the files. How is this accomplished within a
 controller? leads? any examples out there? I know there is os.path,
 os.listdir and glob. Do I have to import the modules in Web2Py?

 Thanks

 --
 Subscription 
 settings:http://groups.google.com/group/web2py/subscribe?hl=en



Re: [web2py] Re: rocket performance

2010-04-22 Thread Thadeus Burgess
I know I have been talking about x-sendfile alot lately

Is there any reason that rocket should support it?

--
Thadeus





On Tue, Apr 20, 2010 at 4:06 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 ok. will fix this soon.

 On Apr 20, 4:03 pm, Timothy Farrell tfarr...@swgen.com wrote:
 Ton's of references in epydoc.  Those will be there as long as
 wsgiserver.py is in the distro.  Otherwise, run epydoc and sphinx.

 Other than that, theres:
 \examples\views\default\index.html:line 35
 - change link tohttp://launchpad.net/rocket

 \examples\views\default\who.html:line 77
 - remove the reference so long as wsgiserver is not the default
 - add liRocket Web Server developed by Timothy Farrell./li

 On 4/20/2010 9:21 AM, mdipierro wrote:

  I made a mistake. Left references to cherry in some of the pages in
  applications/example. Could you help me locate them and suggest
  changes?

  Massimo

  On Apr 20, 8:11 am, Timothy Farrelltfarr...@swgen.com  wrote:

  Thank you.  It's always good to see the fruits of one's labor come out.

  On 4/19/2010 3:57 PM, elffikk wrote:

     a simple test loading one by one the same link, leaving concurrency
  and advanced testing to Tim and others :)
  just wanted to feel the improvement, and I have to say Tim did his job
  very well

  web2py 1.76.5  vs 1.77.1 load test

  10 requests:
  1.76.5  - 0.3016 seconds
  1.77.1 -  0.2736 seconds

  100 requests:
  1.76.5  - 1.7729 seconds
  1.77.1 -  1.4585 seconds

  1000 requests:
  1.76.5  - 16.6493 seconds
  1.77.1 -  13.4033 seconds

  and here is the great test script :)

  import sys, urllib
  n = int((sys.argv[1:] or [10])[0])
  s = 'http://127.0.0.1:8001/'#s = 'http://127.0.0.1:8002/'
  for i in xrange(n):
      urllib.urlopen(s).read()

  --
  Subscription 
  settings:http://groups.google.com/group/web2py/subscribe?hl=en



[web2py] Re: How to use YAML fixturing with web2py

2010-04-22 Thread Yarko Tymciurak
On Apr 22, 10:18 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I wrote a blog post on fixutres and pre-loading your database with default 
 data.

 http://thadeusb.com/weblog/archive/2010/4/21/using_fixtures_in_web2py/36

Nice - thanks!


 I am looking for an implementation to load YAML files that consists of
 one file (it only has to perform loading on the most basic YAML
 objects). PyYaml is a massive library for the purposes of
 redistributing as a plugin.

 --
 Thadeus

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Display contents of a folder

2010-04-22 Thread Iceberg
Sorry for chime in. Do you guys have a convenient way to input a file
path via browser? I've tried these.

1) INPUT(_name='the_path') # User have to type it

2) INPUT(_name='a_file', _type='file')
This is assuming that the web server is running on local machine as a
desktop application. However, in old days the file object contains
path info, but that is no longer the case in recent browsers.

3) So I guess I have to somehow design a dedicated interface to
browse the directories on my server. Or maybe it already exist
somewhere?

Do you have better way?

Regards,
Iceberg


On Apr22, 9:39pm, mdipierro mdipie...@cs.depaul.edu wrote:
 something like this?

 def folder():
     import os
     return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
 path/')]))

 On Apr 22, 7:48 am, greenpoise danel.sega...@gmail.com wrote:



  I want to display the contents (files) of a folder and be able to
  click and download the files. How is this accomplished within a
  controller? leads? any examples out there? I know there is os.path,
  os.listdir and glob. Do I have to import the modules in Web2Py?

  Thanks

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Display contents of a folder

2010-04-22 Thread Iceberg
Sorry for chime in. Do you guys have a convenient way to input a file
path via browser? I've tried these.

1) INPUT(_name='the_path') # User have to type it

2) INPUT(_name='a_file', _type='file')
This is assuming that the web server is running on local machine as a
desktop application. However, in old days the file object contains
path info, but that is no longer the case in recent browsers.

3) So I guess I have to somehow design a dedicated interface to
browse the directories on my server. Or does it already exist
somewhere?

Do you have better way?

Regards,
Iceberg


On Apr22, 9:39pm, mdipierro mdipie...@cs.depaul.edu wrote:
 something like this?

 def folder():
 ? ? import os
 ? ? return dict(files=TABLE(*[TR(TD(f)) for f in os.listdir('/
 path/')]))

 On Apr 22, 7:48?am, greenpoise danel.sega...@gmail.com wrote:



  I want to display the contents (files) of a folder and be able to
  click and download the files. How is this accomplished within a
  controller? leads? any examples out there? I know there is os.path,
  os.listdir and glob. Do I have to import the modules in Web2Py?

  Thanks


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Patrick


On Apr 22, 11:03 am, mdipierro mdipie...@cs.depaul.edu wrote:
 ticket_master = db.auth_user.insert(first_name=fname,
                                  last_name=lname,
                                  email=maile,

 password=db.auth_user.password.requires[0](passwd)[0]))

 unless you have a custom auth_user model. In that case depdends on the
 password validator(s)


I'm sorry your solution *does* work, I misread it in the reply, the
formatting got off and I was treating it like a separate variable. So
it works! When you first start web2py the user gets created (and every
time the user gets deleted as well. I'll figure out a better way to do
this later on. For now call this a feature). But the password gets set
properly and you can login and perform actions as the user. Thanks for
all the suggestions, until next time.



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Solved: Auto Creating Users/Groups/Roles

2010-04-22 Thread Patrick


On Apr 21, 4:32 pm, Patrick arcaneli...@gmail.com wrote:
 I have been learning web2py and decided to create a simple ticket
 system. Thus far I've been able to read the book/documentation or look
 at others code and been able to hack my way through most issues.
 However in my situation I need to have a default user created for
 default administrative purposes, such as adding other admin users (I
 know this isn't the best way to accomplish this but I'm learning...
 advice, suggestions always welcome).

 I've tried something similar to this post http://groups.google.com/
 group/web2py/browse_thread/thread/39f2d63f7024bbfb/2da45ae0132fe8fc?
 lnk=gstq=auto+users#2da45ae0132fe8fc, but I can't login as the user
 because it says invalid login.

 I believe this is due to when I set the default password. If I login
 appadmin and change the password and then try to login it works. So
 I'm messing up on the password creation part. Here is the code for my
 z_defuser.py:

 fname='ticket'
 lname='master'
 maile='tmas...@example.com'
 passwd='tmaster09!'

 # Check to see if the user exists first.
 # If the user does do nothing, else create the new user.
 rows = db(db.auth_user.email == maile).select()
 if rows:
     pass
 else:
     ticket_master = db.auth_user.insert(first_name=fname,
                                 last_name=lname,
                                 email=maile,
                                 password=passwd)

 P.S.
 Any suggestions/advice are welcome. Thank you.


[web2py] Re: http://www.web2py.com doesnt load

2010-04-22 Thread Yarko Tymciurak

On Apr 22, 10:32 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I know. I am just saying our community is growing, and it will be soon
 when there are enough of us who are willing to test a release before
 it is marked as stable.


I assume Massimo runs his tests before committing anything, but do not
really know - so I'll ask.

When I look at http://code.google.com/p/web2py/source/browse/Makefile,
I see executable build, epydoc, and deployment entries - I do not
see anyting to run functional nor regression tests.

Ad-hoc community testing can certainly catch things that other forms
of testing cannot, but at this point - as Thadeus points out - a
growing community, it would be good to be able to make test  on your
platform, deployment or otherwise, with your application in place,
prior to doing ad-hoc testing.

It would also be good to have tests - once problems are found -
written and generalized, so that problems do not easily re-appear
undetected later.

I don't want to get on a rant about this, for I am one less inclined
(generally) to do test-driven development than some, but structured
testsing - just like code reviews - has a place an a purpose.All
I'm suggesting is we NOT overdo it, but put something in place for the
community to boot-strap on, be able to use for basic, structured
testing of their own, and possibly add test cases to.

Regards,
- Yarko

 I have already started working on my update script on the server...

 #update.sh
 #!/bin/bash

 # first SSH into the machine,
 # then run the following commands
 cd ~/web2py
 hg pull
 hg update -r RELEASE

 Now I can update all of my web2py instances with one command ! Such
 geek pleasures are priceless.

 p.s. not that I would want to update ALL of them at the same time,
 each needs its own amount of testing after an upgrade.

 --
 Thadeus

 On Wed, Apr 21, 2010 at 9:03 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  We have had nightly builds for long time but people do not check them.
  More precisely very few people check them and therefore bugs are not
  caught.
  The bugs that caused the problems in 1.77.1,2 were not introduced the
  night before but weeks before.
  Most people only download stable releases.

  Massimo

  On Apr 21, 7:49 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  I like Yarko's proposal of R- as it will stay in line with B- B2-, RC- etc 
  etc.

  Hopefully we can get to a point we start having release candidates
  instead of jumping 4 versions because of simple bugfixes :) (I'm
  staring at you 1.77.1-4)

  --
  Thadeus

  On Wed, Apr 21, 2010 at 6:16 PM, Álvaro Justen [Turicas]

  alvarojus...@gmail.com wrote:
   On Tue, Apr 20, 2010 at 16:58, Yarko Tymciurak
   resultsinsoftw...@gmail.com wrote:
   RE:  using R-  as a prefix to release number (especially if adding
   RELEASE as a tag that always points to the LATEST RELEASE):

   Note that the RELEASE tag will move: it essentially will be re-
   tagging at each release.

   As relases move along, having a R-  prefix will leave past releases
   marked conspicuously.  If ONLY  releases will be tagged, this might be
   superfluous - BUT is patches, or test posts are (at any point in the
   future) tagged, then a way to clearly, unambiguously be able to find
   Release tags will be important.   There may be other ways to approach
   this, but this is common, simple, allows tagging a release as beta,
   release candidate, and (potentially) release, without the need to add
   any revisions, for example:

   B2-1.99.99,   RC-1.99.99, and R-1.99.99   might all be different
   changesets - OR the same changeset that passed all these gates.

   The discussion of a tag format of the form:  [Release state]-[Release
   number]   is useful.   It should not be mixed up with discussion of
   having ONE tag which always marks the latest release - these are
   separate concerns.

   I think we should use just the release number as the tag for release
   versions. If we are talking about a bugfix ou release candidate (that
   are in a lowest number compared to releases), so we can use
   number-bugfix or number-RC.
   The default approach to tag versions is to tag releases so, please,
   don't put this ugly R- before the version number - it is intuitive
   and more simple. But the exceptions (anything that isn't a release,
   like RC and bugfixes) should be explicitly tagged.
   We need to use more of the KISS philosophy.

   Hope that helps clarify.
   Regards,
   - Yarko

   On Apr 20, 11:27 am, mdipierro mdipie...@cs.depaul.edu wrote:
   This is easier than I thought. Thanks to yarko for insisting about
   this. Please make sure I do it properly.

   On Apr 20, 10:27 am, Thadeus Burgess thade...@thadeusb.com wrote:

You mean, I will finally have a way to run stable versions of web2py
but easily update them !? w00t!

--
Thadeus

On Tue, Apr 20, 2010 at 12:26 AM, Yarko Tymciurak

resultsinsoftw...@gmail.com wrote:
 heckings, so you can ALWAYS get 

[web2py] Re: Authenticate against the users defined at the server database

2010-04-22 Thread Jose


On 22 abr, 13:06, mdipierro mdipie...@cs.depaul.edu wrote:
 db = DAL('postgres://username:passw...@hostname:port/dbname')

I meant to enter user and password from a form

Jose


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Authenticate against the users defined at the server database

2010-04-22 Thread Kuba Kucharski
 I meant to enter user and password from a form
??

you mean you want to authenticate to your database with creditentials
from auth_user table???

-- 
Kuba


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 9:32 AM, Patrick wrote:

 I'm sorry your solution *does* work, I misread it in the reply, the
 formatting got off and I was treating it like a separate variable. So
 it works! When you first start web2py the user gets created (and every
 time the user gets deleted as well. I'll figure out a better way to do
 this later on. For now call this a feature). But the password gets set
 properly and you can login and perform actions as the user. Thanks for
 all the suggestions, until next time.

I use something like this to make it happen once. This isn't necessarily the 
test you want, but it's adaptable.

if not db(auth.settings.table_group.id0).count():
...do your thing...

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: rocket performance

2010-04-22 Thread Timothy Farrell
This is the first I'd heard of x-sendfile so I looked it up.  It seems 
to work to off-load work from the application server to the web-server 
for serving large files.


In theory, there would be no real benefit from this in Rocket since 
Rocket and web2py run in the same process.  Serving a file from disk is 
hardly a CPU-intensive process for a threaded system.  The only benefit 
would be to allow the GC to collect some of the request environment 
stuff earlier.  I can't see this having a measurable benefit.


For Apache and LightTPd, it makes a more sense when the app-server runs 
in a different process.


-tim

On 4/22/2010 11:11 AM, Thadeus Burgess wrote:

I know I have been talking about x-sendfile alot lately

Is there any reason that rocket should support it?

--
Thadeus





On Tue, Apr 20, 2010 at 4:06 PM, mdipierromdipie...@cs.depaul.edu  wrote:
   

ok. will fix this soon.

On Apr 20, 4:03 pm, Timothy Farrelltfarr...@swgen.com  wrote:
 

Ton's of references in epydoc.  Those will be there as long as
wsgiserver.py is in the distro.  Otherwise, run epydoc and sphinx.

Other than that, theres:
\examples\views\default\index.html:line 35
- change link tohttp://launchpad.net/rocket

\examples\views\default\who.html:line 77
- remove the reference so long as wsgiserver is not the default
- add liRocket Web Server developed by Timothy Farrell./li

On 4/20/2010 9:21 AM, mdipierro wrote:

   

I made a mistake. Left references to cherry in some of the pages in
applications/example. Could you help me locate them and suggest
changes?
 
   

Massimo
 
   

On Apr 20, 8:11 am, Timothy Farrelltfarr...@swgen.comwrote:
 
   

Thank you.  It's always good to see the fruits of one's labor come out.
   
   

On 4/19/2010 3:57 PM, elffikk wrote:
   
   

a simple test loading one by one the same link, leaving concurrency
and advanced testing to Tim and others :)
just wanted to feel the improvement, and I have to say Tim did his job
very well
 
   

web2py 1.76.5  vs 1.77.1 load test
 
   

10 requests:
1.76.5  - 0.3016 seconds
1.77.1 -  0.2736 seconds
 
   

100 requests:
1.76.5  - 1.7729 seconds
1.77.1 -  1.4585 seconds
 
   

1000 requests:
1.76.5  - 16.6493 seconds
1.77.1 -  13.4033 seconds
 
   

and here is the great test script :)
 
   

import sys, urllib
n = int((sys.argv[1:] or [10])[0])
s = 'http://127.0.0.1:8001/'#s = 'http://127.0.0.1:8002/'
for i in xrange(n):
 urllib.urlopen(s).read()
 
   

--
Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
   
 




[web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Patrick


On Apr 22, 12:18 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 22, 2010, at 9:32 AM, Patrick wrote:

  I'm sorry your solution *does* work, I misread it in the reply, the
  formatting got off and I was treating it like a separate variable. So
  it works! When you first start web2py the user gets created (and every
  time the user gets deleted as well. I'll figure out a better way to do
  this later on. For now call this a feature). But the password gets set
  properly and you can login and perform actions as the user. Thanks for
  all the suggestions, until next time.

 I use something like this to make it happen once. This isn't necessarily the 
 test you want, but it's adaptable.

 if not db(auth.settings.table_group.id0).count():
     ...do your thing...


Thank you so much! I looked at your example and was able to create
something simply usable.
Can't believe I'm coding...

# default credentials. at least *one* user must exist or the default
ticket master user
# will be created.
fname='ticket'
lname='master'
maile='tmas...@localhost'
passwd='tmaster09!'
# Johnathan's suggestion on running this once. Works like a charm.
# Thank you Massimo for the password part.
if not db(db.auth_user.id0).count():
 
ticket_master=db.auth_user.insert(first_name=fname,last_name=lname,email=maile,

password=db.auth_user.password.requires[0](passwd)[0])
else:
pass


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Authenticate against the users defined at the server database

2010-04-22 Thread Jose


On 22 abr, 14:10, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
  I meant to enter user and password from a form

 ??

 you mean you want to authenticate to your database with creditentials
 from auth_user table???


I do not really need anything.

A few days ago showing web2py asked me as validated when there is a
database server with registered users at the server level (not at the
table as is the case auth_user), and are already assigned permissions
to tables, views, processes, etc in the database.

Jose


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Thadeus Burgess
I just wrote a blog post on this!

http://groups.google.com/group/web2py/browse_thread/thread/1a522db61b5e5d44

--
Thadeus





On Thu, Apr 22, 2010 at 1:12 PM, Patrick arcaneli...@gmail.com wrote:


 On Apr 22, 12:18 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 22, 2010, at 9:32 AM, Patrick wrote:

  I'm sorry your solution *does* work, I misread it in the reply, the
  formatting got off and I was treating it like a separate variable. So
  it works! When you first start web2py the user gets created (and every
  time the user gets deleted as well. I'll figure out a better way to do
  this later on. For now call this a feature). But the password gets set
  properly and you can login and perform actions as the user. Thanks for
  all the suggestions, until next time.

 I use something like this to make it happen once. This isn't necessarily the 
 test you want, but it's adaptable.

 if not db(auth.settings.table_group.id0).count():
     ...do your thing...


 Thank you so much! I looked at your example and was able to create
 something simply usable.
 Can't believe I'm coding...

 # default credentials. at least *one* user must exist or the default
 ticket master user
 # will be created.
 fname='ticket'
 lname='master'
 maile='tmas...@localhost'
 passwd='tmaster09!'
 # Johnathan's suggestion on running this once. Works like a charm.
 # Thank you Massimo for the password part.
 if not db(db.auth_user.id0).count():

 ticket_master=db.auth_user.insert(first_name=fname,last_name=lname,email=maile,
                                
 password=db.auth_user.password.requires[0](passwd)[0])
 else:
    pass


 --
 Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en



[web2py] Re: How to use YAML fixturing with web2py

2010-04-22 Thread Patrick


On Apr 22, 10:18 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I wrote a blog post on fixutres and pre-loading your database with default 
 data.

 http://thadeusb.com/weblog/archive/2010/4/21/using_fixtures_in_web2py/36

 I am looking for an implementation to load YAML files that consists of
 one file (it only has to perform loading on the most basic YAML
 objects). PyYaml is a massive library for the purposes of
 redistributing as a plugin.

 --
 Thadeus

 --

Wow thanks! I was just discussing with a friend the idea of preloading
data from a file, we were thinking that we would have to put it into a
SQL file. A great read.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Auto Creating Users/Groups/Roles

2010-04-22 Thread Patrick
Bookmarked.

On Apr 22, 1:24 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 I just wrote a blog post on this!

 http://groups.google.com/group/web2py/browse_thread/thread/1a522db61b...

 --
 Thadeus



 On Thu, Apr 22, 2010 at 1:12 PM, Patrick arcaneli...@gmail.com wrote:

  On Apr 22, 12:18 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Apr 22, 2010, at 9:32 AM, Patrick wrote:

   I'm sorry your solution *does* work, I misread it in the reply, the
   formatting got off and I was treating it like a separate variable. So
   it works! When you first start web2py the user gets created (and every
   time the user gets deleted as well. I'll figure out a better way to do
   this later on. For now call this a feature). But the password gets set
   properly and you can login and perform actions as the user. Thanks for
   all the suggestions, until next time.

  I use something like this to make it happen once. This isn't necessarily 
  the test you want, but it's adaptable.

  if not db(auth.settings.table_group.id0).count():
      ...do your thing...

  Thank you so much! I looked at your example and was able to create
  something simply usable.
  Can't believe I'm coding...

  # default credentials. at least *one* user must exist or the default
  ticket master user
  # will be created.
  fname='ticket'
  lname='master'
  maile='tmas...@localhost'
  passwd='tmaster09!'
  # Johnathan's suggestion on running this once. Works like a charm.
  # Thank you Massimo for the password part.
  if not db(db.auth_user.id0).count():

  ticket_master=db.auth_user.insert(first_name=fname,last_name=lname,email=ma­ile,
                                 
  password=db.auth_user.password.requires[0](passwd)[0])
  else:
     pass

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Web2py Upload Function

2010-04-22 Thread greenpoise
My question is, which controller takes careof the upload field in
web2py???  Web2py makes it easy to upload a file but I want to know
how it does it so I can write a function based on it.


Thanks


dan


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Web2py Upload Function

2010-04-22 Thread Thadeus Burgess
Take a look at welcome/controllers/default.py-def download

And http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#291

And http://code.google.com/p/web2py/source/browse/gluon/sql.py#2667

And http://code.google.com/p/web2py/source/browse/gluon/sql.py#2694

And http://code.google.com/p/web2py/source/browse/gluon/sql.py#3292

I think there are a couple more locations too... specifically web2py
will rename the file to something safe

--
Thadeus





On Thu, Apr 22, 2010 at 2:54 PM, greenpoise danel.sega...@gmail.com wrote:
 My question is, which controller takes careof the upload field in
 web2py???  Web2py makes it easy to upload a file but I want to know
 how it does it so I can write a function based on it.


 Thanks


 dan


 --
 Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en



[web2py] Re: Web2py Upload Function

2010-04-22 Thread greenpoise
wow thats rough!! over 3,000 lines of coding.  thanks!!   :-)




On Apr 22, 4:07 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Take a look at welcome/controllers/default.py-def download

 Andhttp://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#291

 Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#2667

 Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#2694

 Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#3292

 I think there are a couple more locations too... specifically web2py
 will rename the file to something safe

 --
 Thadeus

 On Thu, Apr 22, 2010 at 2:54 PM, greenpoise danel.sega...@gmail.com wrote:
  My question is, which controller takes careof the upload field in
  web2py???  Web2py makes it easy to upload a file but I want to know
  how it does it so I can write a function based on it.

  Thanks

  dan

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Custom auth view throws 404

2010-04-22 Thread scausten
Hi,

Bit of a noob question (sorry) but I'd like to add a page /user/
combinedLogin to my app, which combines the login and register forms,
but can't work it out. This:

if request.args(0)==login:
=auth.login()
=auth.register()

works fine, but I'd like to expose a new url (/user/combinedLogin).

Any ideas?

Si


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Web2py Upload Function

2010-04-22 Thread mdipierro
Most of it is done in the Field.store() method in sql.py. In fact you
can do

db.mytable.insert(filefield=db.mytable.filefield.store(stream,filename='original_filename.txt'))



On Apr 22, 3:27 pm, greenpoise danel.sega...@gmail.com wrote:
 wow thats rough!! over 3,000 lines of coding.  thanks!!   :-)

 On Apr 22, 4:07 pm, Thadeus Burgess thade...@thadeusb.com wrote:

  Take a look at welcome/controllers/default.py-def download

  Andhttp://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#291

  Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#2667

  Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#2694

  Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#3292

  I think there are a couple more locations too... specifically web2py
  will rename the file to something safe

  --
  Thadeus

  On Thu, Apr 22, 2010 at 2:54 PM, greenpoise danel.sega...@gmail.com wrote:
   My question is, which controller takes careof the upload field in
   web2py???  Web2py makes it easy to upload a file but I want to know
   how it does it so I can write a function based on it.

   Thanks

   dan

   --
   Subscription 
   settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Custom auth view throws 404

2010-04-22 Thread mdipierro
How about

{{extend 'layout.html'}}
h2Login/h2
{{=auth.login()}}
h2Register/h2
{{=auth.register()}}

On Apr 22, 3:49 pm, scausten scaus...@googlemail.com wrote:
 Hi,

 Bit of a noob question (sorry) but I'd like to add a page /user/
 combinedLogin to my app, which combines the login and register forms,
 but can't work it out. This:

 if request.args(0)==login:
     =auth.login()
     =auth.register()

 works fine, but I'd like to expose a new url (/user/combinedLogin).

 Any ideas?

 Si

 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Bug in crontab parsing in 1.77.3?

2010-04-22 Thread howesc
in newcron.py line 242 the code allows an empty string to be added to
the lines array, that parsecronline() returns None for.

perhaps line 242 should be changed from:
lines = [x.strip() for x in cronlines if not
x.strip().startswith('#')]

to something like:
lines = [x.strip() for x in cronlines if not x.strip().startswith('#')
and not x.strip() == '']



On Apr 21, 6:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 this helps debug the problem. I will look more into it tomorrow.

 On Apr 21, 7:04 pm, howesc how...@umich.edu wrote:

  Hello,

  in 1.77.3, the following crontab file fails:

  ==
  #crontab

  #add
  #0-59/1 * * * * www-data cd /opt/web2py/  python web2py.py -C -D 1 
  /tmp/cron.output 21

  #to /etc/crontab and restart cron for this to take effect

  #run process every hour, at 5 past the hour
  5 * * * * root *processstats/process
  =

  with the following traceback:

  web2py Enterprise Web Framework
  Created by Massimo Di Pierro, Copyright 2007-2010
  Version 1.77.3 (2010-04-20 02:48:54)
  Database drivers available: SQLite3, PostgreSQL
  Starting hardcron...
  Traceback (most recent call last):
    File web2py.py, line 20, in module
      gluon.widget.start(cron=True)
    File /Users/cfhowes/linuxhome/clients/tenthrow/source/trunk/src/
  tenthrow/opt/web2py/gluon/widget.py, line 779, in start
      newcron.hardcron(os.getcwd()).start()
    File /Users/cfhowes/linuxhome/clients/tenthrow/source/trunk/src/
  tenthrow/opt/web2py/gluon/newcron.py, line 40, in __init__
      crondance(self.path, 'hard', startup=True)
    File /Users/cfhowes/linuxhome/clients/tenthrow/source/trunk/src/
  tenthrow/opt/web2py/gluon/newcron.py, line 252, in crondance
      citems = [(k in task and not v in task[k]) for k,v in checks]
  TypeError: argument of type 'NoneType' is not iterable

  but, if i put a comment character on the 2 blank lines in my crontab
  it works just fine.

  The file as above worked fine in older versions of web2py (though i
  admit it's been a while since this project was upgraded)

  Thanks,

  Christian

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Bug in crontab parsing in 1.77.3?

2010-04-22 Thread mdipierro
You are right.

On Apr 22, 4:14 pm, howesc how...@umich.edu wrote:
 in newcron.py line 242 the code allows an empty string to be added to
 the lines array, that parsecronline() returns None for.

 perhaps line 242 should be changed from:
 lines = [x.strip() for x in cronlines if not
 x.strip().startswith('#')]

 to something like:
 lines = [x.strip() for x in cronlines if not x.strip().startswith('#')
 and not x.strip() == '']

 On Apr 21, 6:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  this helps debug the problem. I will look more into it tomorrow.

  On Apr 21, 7:04 pm, howesc how...@umich.edu wrote:

   Hello,

   in 1.77.3, the following crontab file fails:

   ==
   #crontab

   #add
   #0-59/1 * * * * www-data cd /opt/web2py/  python web2py.py -C -D 1 
   /tmp/cron.output 21

   #to /etc/crontab and restart cron for this to take effect

   #run process every hour, at 5 past the hour
   5 * * * * root *processstats/process
   =

   with the following traceback:

   web2py Enterprise Web Framework
   Created by Massimo Di Pierro, Copyright 2007-2010
   Version 1.77.3 (2010-04-20 02:48:54)
   Database drivers available: SQLite3, PostgreSQL
   Starting hardcron...
   Traceback (most recent call last):
     File web2py.py, line 20, in module
       gluon.widget.start(cron=True)
     File /Users/cfhowes/linuxhome/clients/tenthrow/source/trunk/src/
   tenthrow/opt/web2py/gluon/widget.py, line 779, in start
       newcron.hardcron(os.getcwd()).start()
     File /Users/cfhowes/linuxhome/clients/tenthrow/source/trunk/src/
   tenthrow/opt/web2py/gluon/newcron.py, line 40, in __init__
       crondance(self.path, 'hard', startup=True)
     File /Users/cfhowes/linuxhome/clients/tenthrow/source/trunk/src/
   tenthrow/opt/web2py/gluon/newcron.py, line 252, in crondance
       citems = [(k in task and not v in task[k]) for k,v in checks]
   TypeError: argument of type 'NoneType' is not iterable

   but, if i put a comment character on the 2 blank lines in my crontab
   it works just fine.

   The file as above worked fine in older versions of web2py (though i
   admit it's been a while since this project was upgraded)

   Thanks,

   Christian

   --
   Subscription 
   settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] one solution to web2py+eclipse and undefined variable warnings

2010-04-22 Thread Jonas Rundberg
Hi,

To get rid of the undefined variable warnings in eclipse you can
define names as globals in the preferences.
(Eg to remove the warnings for request, response, db, T, auth, etc...)

Preferences - PyDev - Editor - Code Analysis
Under the undefined tab, you find Consider the following names
global: (comma separated)

There you can add service,auth,T,response,session,request,db or
whatever.
Doing this seems easier then writing global request, ... at the top
of all of your controller files.

cheers
/ jonas rundberg





-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] IS_INT_IN_RANGE

2010-04-22 Thread dave
When using validator IS_INT_IN_RANGE(1900,2100) and a value of
2100 is entered an error message of 'enter an integer between
1900 and 2099' is displayed.  A value of 1900 is accepted.

Seams like the range of the validator should be inclusive for BOTH
ends.  I have not checked validator IS_FLOAT_IN_RANGE


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] IS_INT_IN_RANGE

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 4:28 PM, dave wrote:

 When using validator IS_INT_IN_RANGE(1900,2100) and a value of
 2100 is entered an error message of 'enter an integer between
 1900 and 2099' is displayed.  A value of 1900 is accepted.

It's using the Python notion of a range, from the programmer's point of view, 
but not the user's.

 
 Seams like the range of the validator should be inclusive for BOTH
 ends.  I have not checked validator IS_FLOAT_IN_RANGE

Float is inclusive; Python doesn't have an intrinsic notion of a float range.

-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] is there or hot to create an 'IS_ALPHA' validator

2010-04-22 Thread dave
I'm interested in only there letters 'a..z' and 'A..z'.  I'm sure its
easy with regx, but I'm looking to see how such would be defined it it
was native to web2y.  I'm a database/batch guy, but this framework
makes it look like I know what I'm doing with a GUI !!!


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Web2py Upload Function

2010-04-22 Thread greenpoise
Perfect. Will try. Thanks again!

Dan

On Apr 22, 4:51 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Most of it is done in the Field.store() method in sql.py. In fact you
 can do

 db.mytable.insert(filefield=db.mytable.filefield.store(stream,filename='ori­ginal_filename.txt'))

 On Apr 22, 3:27 pm, greenpoise danel.sega...@gmail.com wrote:



  wow thats rough!! over 3,000 lines of coding.  thanks!!   :-)

  On Apr 22, 4:07 pm, Thadeus Burgess thade...@thadeusb.com wrote:

   Take a look at welcome/controllers/default.py-def download

   Andhttp://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#291

   Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#2667

   Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#2694

   Andhttp://code.google.com/p/web2py/source/browse/gluon/sql.py#3292

   I think there are a couple more locations too... specifically web2py
   will rename the file to something safe

   --
   Thadeus

   On Thu, Apr 22, 2010 at 2:54 PM, greenpoise danel.sega...@gmail.com 
   wrote:
My question is, which controller takes careof the upload field in
web2py???  Web2py makes it easy to upload a file but I want to know
how it does it so I can write a function based on it.

Thanks

dan

--
Subscription 
settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] is there or hot to create an 'IS_ALPHA' validator

2010-04-22 Thread Jonathan Lundell
On Apr 22, 2010, at 4:56 PM, dave wrote:

 I'm interested in only there letters 'a..z' and 'A..z'.  I'm sure its
 easy with regx, but I'm looking to see how such would be defined it it
 was native to web2y.  I'm a database/batch guy, but this framework
 makes it look like I know what I'm doing with a GUI !!!

IS_MATCH('[a-zA-Z]+') ought to work.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: ValueError: invalid literal for int() with base 10:

2010-04-22 Thread DenesL

The problem happens in this requires

IS_NOT_IN_DB(db(db.companyapplication.application==request.vars.application),db.companyapplication.company,error_message='combination
of company en application already in database')]

because the field naming choice makes it impossible to tell apart in
request.vars which application is being referenced on each side of the
comparison, on the left side companyapplication.application refers to
an application.id while on the right side it refers to
application.application, a string.

to get around this redefine table companyapplication as follows

db.define_table('companyapplication',
Field('company_id',db.company,),
Field('application_id',db.application),
migrate=False)

and update the requires to reflect the new naming

db.companyapplication.company_id.requires=[IS_IN_DB(db,db.company.id,'%
(company)s'),
 
IS_NOT_IN_DB(db(db.companyapplication.application_id==request.vars.application_id),db.companyapplication.company_id,error_message='combination
of company and application already in database')]

db.companyapplication.application_id.requires=IS_IN_DB(db,db.application.id,'%
(application)s')

Following such a convention (adding '_id' to denote a reference) is
highly recommended.

Denes.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Use of Python assert statements

2010-04-22 Thread Paul Wray
When using the packaged web2py distribution, is thare a way to use
assert statements for development, then switch them off for production
use?

Not knowing the details of how .pyo files are used, I tested this by
inserting an 'assert 1==2' and compiling that  controller file with -
O, but the optimised code was apparently not used - the assertion
exception still appeared.

It seems the only way to use assert statements would be for the full
packaged framework to be compiled as optimised code, and the
interpreter run with -O, is that correct?



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: SQLFORM update with a custom html form

2010-04-22 Thread Paul Wray
I too have tried this without success.

I seems that you cannot use a custom form together with SQLFORM with
record=
Is that true?

Paul


On Apr 9, 6:14 am, JmiXIII sylvn.p...@gmail.com wrote:
 Hello,

 I'm using a SQLFORM with a html custom (as described in book/7.2 =
 SQLFORM in HTML)
 My fonction inside my controller is :

 def ncmodif():
 ### Formulaire de saisie des NC de production
     rec=db(db.NC.id==269).select()[0]
     form=SQLFORM(db.NC,record=rec)
     if form.accepts(request.vars,formname='test'):
         response.flash = 'form accepted'
     elif form.errors:
         response.flash = 'form has errors'
     else:
         response.flash = 'please fill the form'
     return dict()

 I have hardcoded db.NC.if==269 for the moment to see how it works.

 My view is something like:
 forminput name=FieldName/input type=hidden
 name=_formname value=test /

 My question is there a simple way to make this form work as it works
 with the standard way (ie when using {{=form}}) to update the record
 via the custom form ?
 Can I have the input field prepopulated and updated when I submit
 since ncmodif() does not return any value ?

 Thanks

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.


[web2py] Re: SQLFORM update with a custom html form

2010-04-22 Thread mdipierro
You can. Did you try

{{=form.custom.begin}}
input 
{{=form.custom.end}}

On Apr 22, 11:35 pm, Paul Wray paul.w...@det.nsw.edu.au wrote:
 I too have tried this without success.

 I seems that you cannot use a custom form together with SQLFORM with
 record=
 Is that true?

 Paul

 On Apr 9, 6:14 am, JmiXIII sylvn.p...@gmail.com wrote:

  Hello,

  I'm using a SQLFORM with a html custom (as described in book/7.2 =
  SQLFORM in HTML)
  My fonction inside my controller is :

  def ncmodif():
  ### Formulaire de saisie des NC de production
      rec=db(db.NC.id==269).select()[0]
      form=SQLFORM(db.NC,record=rec)
      if form.accepts(request.vars,formname='test'):
          response.flash = 'form accepted'
      elif form.errors:
          response.flash = 'form has errors'
      else:
          response.flash = 'please fill the form'
      return dict()

  I have hardcoded db.NC.if==269 for the moment to see how it works.

  My view is something like:
  forminput name=FieldName/input type=hidden
  name=_formname value=test /

  My question is there a simple way to make this form work as it works
  with the standard way (ie when using {{=form}}) to update the record
  via the custom form ?
  Can I have the input field prepopulated and updated when I submit
  since ncmodif() does not return any value ?

  Thanks

  --
  You received this message because you are subscribed to the Google Groups 
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.