[web2py] Re: Deployment problem on dotcloud with PostgreSQL

2011-12-30 Thread Thomas Dall'Agnese
Sent to your DePaul e-mail address.

I am looking forward to a solution to that problem as MySQL doesn't work 
neither on DotCloud (error creating a table, see other post).


[web2py] Re: Optimizing web2py app for GAE

2011-12-30 Thread dlypka
Perhaps these links will help:

http://groups.google.com/group/google-appengine/browse_thread/thread/21478bd9185dcc32/f61b532da5c46588?lnk=gst&q=index+reads#f61b532da5c46588
 

http://groups.google.com/group/google-appengine/browse_thread/thread/bdb45e04dd8f959e/0659767c7878bafb?lnk=gst&q=index+reads#0659767c7878bafb
 

http://groups.google.com/group/google-appengine/browse_thread/thread/fef4a4c22a50039/4ae7426d4daca9d2?lnk=gst&q=index+reads#4ae7426d4daca9d2
 

So, excessive index reads could be a problem...




[web2py] Error creating tables on a MySQL database on DotCloud?

2011-12-30 Thread Thomas Dall'Agnese
Hi,

After having errors in PostgreSQL, I moved to MySQL and also got errors.
With MySQL, I can't create some tables (but some tables worked!).

Error:

Traceback (most recent call last):
  File "/home/dotcloud/current/gluon/restricted.py", line 204, in restricted
exec ccode in environment
  File 
"/home/dotcloud/rsync-1325304927060/applications/myapp/models/db_wizard.py", 
line 54, in 
migrate=settings.migrate)
  File "/home/dotcloud/current/gluon/dal.py", line 5097, in define_table
polymodel=polymodel)
  File "/home/dotcloud/current/gluon/dal.py", line 705, in create_table
self.create_sequence_and_triggers(query,table)
  File "/home/dotcloud/current/gluon/dal.py", line 1348, in 
create_sequence_and_triggers
self.execute(query)
  File "/home/dotcloud/current/gluon/dal.py", line 1359, in execute
return self.log_execute(*a, **b)
  File "/home/dotcloud/current/gluon/dal.py", line 1353, in log_execute
ret = self.cursor.execute(*a, **b)
  File "/home/dotcloud/current/gluon/contrib/pymysql/cursors.py", line 108, in 
execute
self.errorhandler(self, exc, value)
  File "/home/dotcloud/current/gluon/contrib/pymysql/connections.py", line 184, 
in defaulterrorhandler
raise errorclass, errorvalue
InternalError: (1005, u"Can't create table 'mysql.sub_comment' (errno: 150)")


My sub_comment table is defined as follow:
db.define_table('sub_comment',
Field('sub', type='reference sub',
  label=T('Sub')),
Field('user', type='reference auth_user',
  label=T('User')),
Field('date_added', type='datetime',
  label=T('Date Added')),
Field('error_types', type='list:reference error_type',
  label=T('Error Type')),
Field('balises', type='list:reference balise',
  label=T('Balise')),
Field('content', type='text', notnull=True, required=True,
  label=T('Content')),
auth.signature,
format='%(content)s',
migrate=settings.migrate)

And the referenced tables are already created by web2py (worked)
Maybe "list:" doesn't work with MySQL?

Best regards,

Thomas


[web2py] Re: MySql table already exists error

2011-12-30 Thread Thomas Dall'Agnese
I see, thanks for your help!

Cheers,

Thomas


[web2py] Re: MySql table already exists error

2011-12-30 Thread Massimo Di Pierro
Not quote. First, your model must exactly describe what is in the db.
Then you set fake_migrate=True, this will create the metadata. Then
you set fake_migrate=False (or remove it) and migrate=True. Not you
can change the model and web2py will perform the ALTER TABLE.

If web2py does not know what is in DB it will always try create the
table not alter it.

Massimo

On Dec 30, 10:01 pm, "Thomas Dall'Agnese"
 wrote:
> Indeed, I am talking about (3), and in that case, running with migrate=True
> raises an error (table already exists).
>
> The table had been created by web2py so of course it exists.
> In case (3) should I also have fake_migrate=True?
>
> On Sat, Dec 31, 2011 at 12:58 PM, Massimo Di Pierro <
>
>
>
>
>
>
>
> massimo.dipie...@gmail.com> wrote:
> > There are various scenarios:
>
> > 1) the table exist in db but were not created by web2py
> > run at least once with migrate=True,fake_migrate=True
> > 2) the table exist in db and where created by web2py (or you run
> > fake_migrate once)
> > it is ok to run with migrate=False
> > 3) web2py is aware of the tables (created by web2py or you run
> > fake_migrate) but you need to change them
> > set migrate=True until the migration has happened.
>
> > I guess you are asking about 3.
>
> > On Dec 30, 9:53 pm, Thomas Dall'Agnese 
> > wrote:
> > > But if we change the table definition, for example we add one field, it
> > > will not be updated then, isn't it?
> > > How can we migrate a MySQL table?


Re: [web2py] Re: MySql table already exists error

2011-12-30 Thread Thomas Dall'Agnese
Indeed, I am talking about (3), and in that case, running with migrate=True
raises an error (table already exists).

The table had been created by web2py so of course it exists.
In case (3) should I also have fake_migrate=True?


On Sat, Dec 31, 2011 at 12:58 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> There are various scenarios:
>
> 1) the table exist in db but were not created by web2py
> run at least once with migrate=True,fake_migrate=True
> 2) the table exist in db and where created by web2py (or you run
> fake_migrate once)
> it is ok to run with migrate=False
> 3) web2py is aware of the tables (created by web2py or you run
> fake_migrate) but you need to change them
> set migrate=True until the migration has happened.
>
> I guess you are asking about 3.
>
> On Dec 30, 9:53 pm, Thomas Dall'Agnese 
> wrote:
> > But if we change the table definition, for example we add one field, it
> > will not be updated then, isn't it?
> > How can we migrate a MySQL table?


[web2py] Re: MySql table already exists error

2011-12-30 Thread Massimo Di Pierro
There are various scenarios:

1) the table exist in db but were not created by web2py
run at least once with migrate=True,fake_migrate=True
2) the table exist in db and where created by web2py (or you run
fake_migrate once)
it is ok to run with migrate=False
3) web2py is aware of the tables (created by web2py or you run
fake_migrate) but you need to change them
set migrate=True until the migration has happened.

I guess you are asking about 3.

On Dec 30, 9:53 pm, Thomas Dall'Agnese 
wrote:
> But if we change the table definition, for example we add one field, it
> will not be updated then, isn't it?
> How can we migrate a MySQL table?


[web2py] Re: MySql table already exists error

2011-12-30 Thread Thomas Dall'Agnese
But if we change the table definition, for example we add one field, it 
will not be updated then, isn't it?
How can we migrate a MySQL table?


[web2py] appadmin when routing domains

2011-12-30 Thread Plumo
I am using routers for multiple domains like this:

routers = dict(
  BASE  = dict(
  domains = {
  'domain1' : 'init',
  'domain2' : 'admin',
  },
   ),
)

Problem is when accessing domain1/appadmin it redirects me to domain1/admin 
to login, which does not exist. That app is accessed by domain2. 
If I login to admin at domain2/admin and then try domain1/appadmin, I am 
redirected again to domain1/admin.

Is there a way to use appadmin when routing domains?

Richard


[web2py] Re: log in issue with client tools, Mr freeze or anyone can help?

2011-12-30 Thread Frank
I will do it thank you.

On Dec 31, 9:15 am, Bruno Rocha  wrote:
> I did not updated the current web2pyslices website because I am developing
> a new one based on my new CMS.
>
> recently the registration_id field is now required by Auth but your table
> does not have it.
>
> Simply add to your auth_user table a new field called registration_id, you
> can do using extra_fields
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


Re: [web2py] Re: log in issue with client tools, Mr freeze or anyone can help?

2011-12-30 Thread Bruno Rocha
I did not updated the current web2pyslices website because I am developing
a new one based on my new CMS.

recently the registration_id field is now required by Auth but your table
does not have it.

Simply add to your auth_user table a new field called registration_id, you
can do using extra_fields

-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: log in issue with client tools, Mr freeze or anyone can help?

2011-12-30 Thread Frank
you can download source code from http://www.web2pyslices.com/faq and
test on 1.99.4


[web2py] log in issue with client tools, Mr freeze or anyone can help?

2011-12-30 Thread Frank
I've been using same log in module with web2pyslices for a long time
and it works perfectly, but recently, I got log in issue after I
upgrade to 1.99.4(I used to work well on 1.91.6), when you register a
new user then log off, when you log in again, there are error
information like" 'registration_id'",I
download the source code from web2pyslices, and test on 1.99.4, I got
same issue, can anyone help on this? I can not figure out what cause
this due to changes happen from 1.91.6 to 1.99.4 for web2py, it same
break my program.


Re: [web2py] Need Help with Custom Form Widget (Possible web2py Bug)

2011-12-30 Thread Ross Peoples
Thanks Bruno! To solve it, you used CAT() instead of returning a list. I 
have updated my code and tested. Thanks again for the help!

Re: [web2py] Need Help with Custom Form Widget (Possible web2py Bug)

2011-12-30 Thread Bruno Rocha
I got the same problem, I think I solved it (but I cant remember how)

it is working here:
http://labs.blouweb.com/movuca3/article/show/3/flying-spaguetti-monster
(you can register/login to test) I am using your plugin in comments and
also in article creator.

The source is in github.

On Fri, Dec 30, 2011 at 8:09 PM, Ross Peoples wrote:

> Was recently informed of a problem with plugin_ckeditor that I have been
> trying to solve for a while now, but I think it may actually be a web2py
> bug. First of all, here is the widget:
>
> def widget(self, field, value, **attributes):
> """
> To be used with db.table.field.widget to set CKEditor as the
> desired widget for the field.
> Simply set db.table.field.widget = ckeditor.widget to use the
> CKEditor widget.
> """
> default = dict(
> value = value,
> _cols = 80,
> _rows = 10
> )
>
> attributes = FormWidget._attributes(field, default, **attributes)
> attributes['_class'] = 'text plugin_ckeditor'
>
> textarea = TEXTAREA(**attributes)
> javascript = XML('some javascript code here')
> result = [textarea, javascript]
>
> return result
>
>
> And here is a test controller:
>
> def test():
> form = SQLFORM.factory(
> Field('requiredfield', required=True, notnull=True),
> Field('textfield', 'text', widget=ckeditor.widget)
> )
>
> if form.accepts(request.vars, session, keepvalues=True):
> response.flash = 'Accepted'
> elif form.errors:
> response.flash = 'There are some errors'
>
> return dict(form=form)
>
>
> This works great until there is a validation problem while submitting the
> form. Once that happens, instead of getting CKEditor in the form for the
> 'textfield' field, I get "[,
> ]".
>
> I have tried wrapping both TEXTAREA and XML(javascript) into a single
> XML() object, but when this happens, FORM will not pick up the value for
> the field, even though it's in request.vars.
>
> Thanks for your help.
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Need Help with Custom Form Widget (Possible web2py Bug)

2011-12-30 Thread Ross Peoples
Was recently informed of a problem with plugin_ckeditor that I have been 
trying to solve for a while now, but I think it may actually be a web2py 
bug. First of all, here is the widget:

def widget(self, field, value, **attributes):
"""
To be used with db.table.field.widget to set CKEditor as the 
desired widget for the field.
Simply set db.table.field.widget = ckeditor.widget to use the 
CKEditor widget.
"""
default = dict(
value = value,
_cols = 80,
_rows = 10
)

attributes = FormWidget._attributes(field, default, **attributes)
attributes['_class'] = 'text plugin_ckeditor'

textarea = TEXTAREA(**attributes)
javascript = XML('some javascript code here')
result = [textarea, javascript]

return result


And here is a test controller:

def test():
form = SQLFORM.factory(
Field('requiredfield', required=True, notnull=True),
Field('textfield', 'text', widget=ckeditor.widget)
)

if form.accepts(request.vars, session, keepvalues=True):
response.flash = 'Accepted'
elif form.errors:
response.flash = 'There are some errors'

return dict(form=form)


This works great until there is a validation problem while submitting the 
form. Once that happens, instead of getting CKEditor in the form for the 
'textfield' field, I get "[, 
]".

I have tried wrapping both TEXTAREA and XML(javascript) into a single XML() 
object, but when this happens, FORM will not pick up the value for the 
field, even though it's in request.vars.

Thanks for your help.


[web2py] Re: SQLFORM.smartgrid i18n

2011-12-30 Thread Massimo Di Pierro
Please open a ticket. Indeed this option is missing.

On Dec 30, 12:13 pm, Alexandre Andrade 
wrote:
> I cant found a way to translate the "Submit" button and 'Check to delete'
> using smartgrid.
>
> crud.settings doenst work.
>
> Any tips?
>
> --
> Atenciosamente
>
> Alexandre Andrade
> Hipercenter.com Classificados Gratuitos


[web2py] SQLFORM.smartgrid i18n

2011-12-30 Thread Alexandre Andrade
I cant found a way to translate the "Submit" button and 'Check to delete'
using smartgrid.

crud.settings doenst work.

Any tips?


-- 
Atenciosamente


Alexandre Andrade
Hipercenter.com Classificados Gratuitos


[web2py] Re: MARKMIN clarification

2011-12-30 Thread lyn2py
Thanks Massimo. Happy New Year's Eve :)

I'm not sure what considerations went into this, that a single new
line is not given a "br" at the end. (it can still be interpreted as a
continuation of the same paragraph, regardless)

I hope you will consider adding this feature (each new line gets a
"br" in HTML) to MARKMIN, I cite examples. If I write a poem, song
lyrics or a general line of verbatim, I would like the output to have
newlines just like the user had input into the form/textarea. And of
course, still keep two lines = a paragraph.

Have suggested to use "br" for newlines in blockquote (http://
code.google.com/p/web2py/issues/detail?id=588)

Thank you!


On Dec 31, 12:22 am, Massimo Di Pierro 
wrote:
> Two new lines in markmin translate into an end of paragraph in html, a
> single new line is interpreted as a continuation of the same
> paragraph.
>
> On Dec 30, 1:51 am, lyn2py  wrote:
>
>
>
>
>
>
>
> > Does MARKMIN have issues with processing newlines?
> > Because I can't use formatting here, everything looks like the same
> > text, but in MARKMIN the formatting is ok, only the newlines is not
> > ok.
>
> > (1) I noticed that newlines don't convert to  in MARKMIN, which is
> > strange.
>
> > Example:
> > I write this
> > in two lines
>
> > MARKMIN processes it as: I write thisin two lines
>
> > But 2 newlines automatically converts to a paragraph (which is
> > correct).
>
> > (2) Also, when using verbatim ``
>
> > Example:
> > ``I write this``
>
> > ``in two paragraphs``
>
> > MARKMIN: I write thisin two paragraphs
>
> > (3) Using a mix of verbatim/italics/bold
>
> > Example:
> > ``an edit as usual``
>
> > ``another``
>
> > ''one or the other''
> > **could be bolded**
>
> > MARKMIN:
> > an edit as usualanother
>
> > one or the other could be bolded
>
> > Notice the inconsistency in processing newlines (and spaces).
> > Is this correct behavior of MARKMIN?


[web2py] update_or_insert doesn't always return the corresponding row id

2011-12-30 Thread olivier
The "insert" method returns the id of the inserted row.
The "update_or_insert" method returns the id of the inserted row, but
returns None in case of an update...

Why is it so?

I have a case in which I want to update_or_insert and then further
update the corresponding row (to track the status of a long running
process).
I would rather have the method to always output the id of the updated/
inserted row...
Or is there any use-case you would like to discriminate between the
fact you inserted or update a row?

What do you think?

  -Olivier


>From dal.py (I added the proposed modification)
===

def update_or_insert(self, key=DEFAULT, **values):
  if key==DEFAULT:
record = self(**values)
  else:
record = self(key)
   if record:
record.update_record(**values)
newid = None  #--> why not record['id'] 
   else:
 newid = self.insert(**values)
   return newid


[web2py] Re: MARKMIN clarification

2011-12-30 Thread lyn2py
Thank you Massimo. Happy New Year's Eve :)

After fiddling with markmin for hours and reading
http://web2py.com/examples/static/markmin.html
a few times, I made a suggestion I hope you will consider including:
http://code.google.com/p/web2py/issues/detail?id=588

I don't know where I might be able to find the code in gluon to have a
"single new line" be converted to "". As I would also like to
suggest that.

The reason for this is because if the user didn't want new lines, he
probably wouldn't create a new line.

Example:
I
wouldn't
type
like that

Usually, I would keep typing in a single sentence.
However, I may put two sentences in a paragraph, but not joined
together.

Thank you!

On Dec 31, 12:22 am, Massimo Di Pierro 
wrote:
> Two new lines in markmin translate into an end of paragraph in html, a
> single new line is interpreted as a continuation of the same
> paragraph.
>
> On Dec 30, 1:51 am, lyn2py  wrote:
>
>
>
>
>
>
>
> > Does MARKMIN have issues with processing newlines?
> > Because I can't use formatting here, everything looks like the same
> > text, but in MARKMIN the formatting is ok, only the newlines is not
> > ok.
>
> > (1) I noticed that newlines don't convert to  in MARKMIN, which is
> > strange.
>
> > Example:
> > I write this
> > in two lines
>
> > MARKMIN processes it as: I write thisin two lines
>
> > But 2 newlines automatically converts to a paragraph (which is
> > correct).
>
> > (2) Also, when using verbatim ``
>
> > Example:
> > ``I write this``
>
> > ``in two paragraphs``
>
> > MARKMIN: I write thisin two paragraphs
>
> > (3) Using a mix of verbatim/italics/bold
>
> > Example:
> > ``an edit as usual``
>
> > ``another``
>
> > ''one or the other''
> > **could be bolded**
>
> > MARKMIN:
> > an edit as usualanother
>
> > one or the other could be bolded
>
> > Notice the inconsistency in processing newlines (and spaces).
> > Is this correct behavior of MARKMIN?


[web2py] Re: Optimizing web2py app for GAE

2011-12-30 Thread Anthony
On Friday, December 30, 2011 11:25:51 AM UTC-5, Massimo Di Pierro wrote:
>
> You have to do: 
>
> db.define_table('name',...,migrate=settings.migrate) 
>
> The table has to be defined because web2py needs to know how to map 
> SQL types into web2py types. The migrate argument, when set to False, 
> will prevent the "CREATE TABLE". Anyway, web2py does not "CREATE 
> TABLE" if it exists already.
>

Looks like create_table is called regardless of migrate on GAE:

if migrate or self._adapter.dbengine=='google:datastore':
try:
sql_locker.acquire()
self._adapter.create_table(t,migrate=migrate,
   fake_migrate=fake_migrate,
   polymodel=polymodel)

GoogleDatastoreAdapter.create_table() itself doesn't seem to do anything 
with 'migrate', but not clear if it results in any datastore activity. 
Looks like it just creates a gae.Model object:

if not polymodel:
table._tableobj = classobj(table._tablename, (gae.Model, ), myfields)

Anthony

 


[web2py] Re: redirecting python console output to web browser page

2011-12-30 Thread Massimo Di Pierro
There are two ways around it:
- hopefully the apt module can be configured to send output to a file
- if not, use the python subprocess module to run the code is a
separate process. The popen function has the ability to capture the
output.

On Dec 29, 9:21 pm, blackshirt  wrote:
> i have a little programming with web2py, with import some library from
> python-apt...
> i want to show output from some command/function from that library to
> the web page..
> Output from that script showing on console, not showing on web page,
> but only result on return value (True / false) send to web page..
>
> Here some code from controller page
>
> def update():
>
>     apt_pkg.init()
>     cache = apt.Cache()
>     cache.update(apt.progress.TextFetchProgress())
>     cache.open(None)
>
> this successfully run, if we call this controller, but output show on
> console not send to page..
> How we solved this, i'm stuck here ?
>
> Thanks for clue, advice, or reply's


Re: [web2py] Re: small display problem when using wizard

2011-12-30 Thread Anthony
It was actually fixed a couple weeks ago (for the second time). :-)

On Friday, December 30, 2011 11:20:34 AM UTC-5, Khalil KHAMLICHI wrote:
>
> excellent bug fixing time : 7 minutes.
> Thanks.
>
> On Fri, Dec 30, 2011 at 3:26 PM, Paolo Caruccio wrote:
>
>> fixed in trunk
>>
>>
>> http://code.google.com/p/web2py/source/detail?r=25d5f65ce920ed2c6089097122caa7ded3d63d8a
>>  
>>
>
>

[web2py] Re: Optimizing web2py app for GAE

2011-12-30 Thread Massimo Di Pierro
You have to do:

db.define_table('name',...,migrate=settings.migrate)

The table has to be defined because web2py needs to know how to map
SQL types into web2py types. The migrate argument, when set to False,
will prevent the "CREATE TABLE". Anyway, web2py does not "CREATE
TABLE" if it exists already.

Massimo

On Dec 30, 3:22 am, Joseph Jude  wrote:
> Let us say I have the below code in db.py under models
>
> define_table(db, )
>
> If I change that to,
> if settings.migrate:
>    define_table(db,...)
>
> rest of the queries based on this table doesn't work. I want to skip the
> definition altogether if the table is already present. Reason: I assume
> that GAE makes a datastore call for each of these define_table. So every
> page request initiates these define_table adding to the cost of datastore
> read limits posed in GAE. Is this how it happens? Can I skip definition of
> tables altogether? (I believe django doesn't invoke definition of tables
> for every request)
>
> Objective is to optimize application on GAE.
>
> Thank you,
> Joseph


[web2py] Re: Optimizing web2py app for GAE

2011-12-30 Thread Anthony
On Friday, December 30, 2011 4:22:29 AM UTC-5, Joseph Jude wrote:
>
> Let us say I have the below code in db.py under models
>
> define_table(db, )
>
> If I change that to,
> if settings.migrate:
>define_table(db,...)
>
> rest of the queries based on this table doesn't work. I want to skip the 
> definition altogether if the table is already present. Reason: I assume 
> that GAE makes a datastore call for each of these define_table. So every 
> page request initiates these define_table adding to the cost of datastore 
> read limits posed in GAE. Is this how it happens? Can I skip definition of 
> tables altogether? (I believe django doesn't invoke definition of tables 
> for every request)
>

The table definition creates the table model for web2py to use, so you 
cannot skip the table definition if your application code needs to do 
anything with that table model during the request. I don't think merely 
calling define_table should result in a datastore hit (I'm not totally sure 
about that on GAE, but in non-GAE environments, define_table won't touch 
the db, unless it results in a migration happening).

I'm not sure why you have so many reads. Maybe check to see if you're doing 
any recursive 
selects: http://web2py.com/books/default/chapter/29/6#Recursive-selects.

Anthony


[web2py] Re: MARKMIN clarification

2011-12-30 Thread Massimo Di Pierro
Two new lines in markmin translate into an end of paragraph in html, a
single new line is interpreted as a continuation of the same
paragraph.

On Dec 30, 1:51 am, lyn2py  wrote:
> Does MARKMIN have issues with processing newlines?
> Because I can't use formatting here, everything looks like the same
> text, but in MARKMIN the formatting is ok, only the newlines is not
> ok.
>
> (1) I noticed that newlines don't convert to  in MARKMIN, which is
> strange.
>
> Example:
> I write this
> in two lines
>
> MARKMIN processes it as: I write thisin two lines
>
> But 2 newlines automatically converts to a paragraph (which is
> correct).
>
> (2) Also, when using verbatim ``
>
> Example:
> ``I write this``
>
> ``in two paragraphs``
>
> MARKMIN: I write thisin two paragraphs
>
> (3) Using a mix of verbatim/italics/bold
>
> Example:
> ``an edit as usual``
>
> ``another``
>
> ''one or the other''
> **could be bolded**
>
> MARKMIN:
> an edit as usualanother
>
> one or the other could be bolded
>
> Notice the inconsistency in processing newlines (and spaces).
> Is this correct behavior of MARKMIN?


Re: [web2py] Re: small display problem when using wizard

2011-12-30 Thread Khalil KHAMLICHI
excellent bug fixing time : 7 minutes.
Thanks.

On Fri, Dec 30, 2011 at 3:26 PM, Paolo Caruccio
wrote:

> fixed in trunk
>
>
> http://code.google.com/p/web2py/source/detail?r=25d5f65ce920ed2c6089097122caa7ded3d63d8a
>
>


[web2py] Re: customized Web2py registration

2011-12-30 Thread Anthony
On Friday, December 30, 2011 7:26:31 AM UTC-5, Alan Etkin wrote:
>
> I'd create a custom form with new user fields, decorate it with 
> @auth.requires_membership(""), and on validation, use the 
> auth.get_or_create_user() function passing the collected form data. I 
> have not tested it, and maybe there is a simpler way.


That should work, though note that get_or_create_user will set auth.user to 
the record of the new user, so you have to save the admin's auth.user 
record and reset auth.user back to the admin's record after the insert.

See here for more details: http://stackoverflow.com/a/8681343/440323
 

> I think that 
> there would be good that web2py had a feature as login_bare for this 
> case, "register_bare" or alike.


Good idea.

Anthony 


[web2py] Re: small display problem when using wizard

2011-12-30 Thread Paolo Caruccio
fixed in trunk

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


[web2py] small display problem when using wizard

2011-12-30 Thread Khalil KHAMLICHI
please refer to attachement, I was on firefox 9.0.1
<>

Re: [web2py] Re: Janrain Engage OR normal register/login

2011-12-30 Thread Thomas Dall'Agnese
It works if we remove the first parameter (request) in the 
ExtendedLoginForm:
auth.settings.login_form = ExtendedLoginForm(auth, other_form, 
signals=['token'])


[web2py] Re: customized Web2py registration

2011-12-30 Thread Alan Etkin
I'd create a custom form with new user fields, decorate it with
@auth.requires_membership(""), and on validation, use the
auth.get_or_create_user() function passing the collected form data. I
have not tested it, and maybe there is a simpler way. I think that
there would be good that web2py had a feature as login_bare for this
case, "register_bare" or alike.

On Dec 30, 6:57 am, ganesh waghmare 
wrote:
> Hi,
>
> I am new to web2py and I need help... Thanks in advance for your
> help.!!
>
> I want to make application which is having one admin(super user)
> account.. I want to restrict 'only admin can register user'. So that
> once Admin logins to app, he will see different menus like 'Home',
> 'Setting', and 'Register User'.. I am done with other options but I am
> getting problems in Register...
>
> In my application there is 'Register' link  filemanager2/default/user/register>... But when I click on it, it get
> redirected to profiles page... it's becoz admin user is already logged
> in and therefor after clicking on register link it shows admin
> account's profile...
>
> Please Help... Thank You..!


Re: [web2py] Re: Janrain Engage OR normal register/login

2011-12-30 Thread Thomas Dall'Agnese
Another problem with the slices:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.

Traceback (most recent call last):
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/gluon/restricted.py", 
line 204, in restricted
exec ccode in environment
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/applications/fansubcheck/controllers/default.py"
 , 
line 238, in 
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/gluon/globals.py", 
line 172, in 
self._caller = lambda f: f()
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/applications/fansubcheck/controllers/default.py"
 , 
line 32, in user
auth(),
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/gluon/tools.py", line 
1141, in __call__
return getattr(self,args[0])()
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/gluon/tools.py", line 
1766, in login
return cas.login_form()
  File 
"/windows/Users/Thomas/Dropbox/appz/2011/dotcloud_web2py/gluon/contrib/login_methods/extended_login_form.py",
 line 89, in login_form
request = self.auth.environment.request
AttributeError: 'NoneType' object has no attribute 'request'


Is there any code example for web2py 1.99,4 to have the 2 different login 
types concurrently? (Janrain AND normal)


Re: [web2py] Re: Janrain Engage OR normal register/login

2011-12-30 Thread Thomas Dall'Agnese
Thanks Anthony.

The books seems to be not up-to-date:


TypeError: __init__() got multiple values for keyword argument 'signals'


I will try the slice 124, but it looks old too.

Best Regards,

Thomas


On Thu, Dec 29, 2011 at 11:53 PM, Anthony  wrote:

> See "Multiple login forms" at the end of this section:
> http://web2py.com/books/default/chapter/29/9#Other-login-methods-and-login-forms.
> There's also:
>
> http://www.web2pyslices.com/slices/take_slice/124
> http://www.web2pyslices.com/slices/take_slice/28
>
> Anthony
>
>
> On Thursday, December 29, 2011 7:37:18 AM UTC-5, Thomas Dall'Agnese wrote:
>>
>> Hi,
>>
>> Is it possible to allow normal login in addition to login via RPX
>> (janrain engage)?
>> If I activate RPX, I cannot register through the "normal" process.
>> Is it possible to keep the "normal" login as well as the RPX one?
>>
>> Best regards,
>>
>> Thomas
>>
>


[web2py] Re: redirecting python console output to web browser page

2011-12-30 Thread Alan Etkin
I am not sure if web2py has a feature for that. You can still redirect
output to a filelike object during controller processing and on exit
return the control to the original handler. That way you could extract
the output from the file object to append it to the web2py response

Pseudo-code:

on controller start

# create obj
# send all stdout to obj
# return dict with obj content as message or another name to be
processed by a web2py view

On Dec 30, 12:21 am, blackshirt  wrote:
> i have a little programming with web2py, with import some library from
> python-apt...
> i want to show output from some command/function from that library to
> the web page..
> Output from that script showing on console, not showing on web page,
> but only result on return value (True / false) send to web page..
>
> Here some code from controller page
>
> def update():
>
>     apt_pkg.init()
>     cache = apt.Cache()
>     cache.update(apt.progress.TextFetchProgress())
>     cache.open(None)
>
> this successfully run, if we call this controller, but output show on
> console not send to page..
> How we solved this, i'm stuck here ?
>
> Thanks for clue, advice, or reply's


[web2py] customized Web2py registration

2011-12-30 Thread ganesh waghmare
Hi,

I am new to web2py and I need help... Thanks in advance for your
help.!!

I want to make application which is having one admin(super user)
account.. I want to restrict 'only admin can register user'. So that
once Admin logins to app, he will see different menus like 'Home',
'Setting', and 'Register User'.. I am done with other options but I am
getting problems in Register...

In my application there is 'Register' link ... But when I click on it, it get
redirected to profiles page... it's becoz admin user is already logged
in and therefor after clicking on register link it shows admin
account's profile...


Please Help... Thank You..!


[web2py] Re: Optimizing web2py app for GAE

2011-12-30 Thread Joseph Jude
Let us say I have the below code in db.py under models

define_table(db, )

If I change that to,
if settings.migrate:
   define_table(db,...)

rest of the queries based on this table doesn't work. I want to skip the 
definition altogether if the table is already present. Reason: I assume 
that GAE makes a datastore call for each of these define_table. So every 
page request initiates these define_table adding to the cost of datastore 
read limits posed in GAE. Is this how it happens? Can I skip definition of 
tables altogether? (I believe django doesn't invoke definition of tables 
for every request)

Objective is to optimize application on GAE.

Thank you,
Joseph


[web2py] Re: MARKMIN clarification

2011-12-30 Thread lyn2py
Thanks Albert, just tried your suggestion, but it didn't create the
newlines "".

Also, because the intended input will be like a forum post (like
bbcode), I doubt I would like MARKMIN to force newlines with spaces
(has to be user-friendly, right?) Unless of course MARKMIN is not
meant for this use, then I will have to look for other ways to markup
the text input.

Any suggestions or pointers in this area is welcome!

On Dec 30, 4:29 pm, Albert Abril  wrote:
> I can't test it now, but try to put 4 spaces at the end of the line to
> force a newline.
>
> 2011/12/30 lyn2py 
>
>
>
>
>
>
>
> > Does MARKMIN have issues with processing newlines?
> > Because I can't use formatting here, everything looks like the same
> > text, but in MARKMIN the formatting is ok, only the newlines is not
> > ok.
>
> > (1) I noticed that newlines don't convert to  in MARKMIN, which is
> > strange.
>
> > Example:
> > I write this
> > in two lines
>
> > MARKMIN processes it as: I write thisin two lines
>
> > But 2 newlines automatically converts to a paragraph (which is
> > correct).
>
> > (2) Also, when using verbatim ``
>
> > Example:
> > ``I write this``
>
> > ``in two paragraphs``
>
> > MARKMIN: I write thisin two paragraphs
>
> > (3) Using a mix of verbatim/italics/bold
>
> > Example:
> > ``an edit as usual``
>
> > ``another``
>
> > ''one or the other''
> > **could be bolded**
>
> > MARKMIN:
> > an edit as usualanother
>
> > one or the other could be bolded
>
> > Notice the inconsistency in processing newlines (and spaces).
> > Is this correct behavior of MARKMIN?


Re: [web2py] Re: Web2py

2011-12-30 Thread Miroslav Gojic
The problem is accessing to file system.
I use Kubuntu 11.10 and WeB2Py 1.99.4 from Debina repository.
After some time I get to my web2py server work from Console
sudo python web2py/web2py.py -a 'password' -i '0.0.0.0' -p '8000'
and my sudo pass
and it is working

I tray to make autostart routine but in this moment without success, I need
to have web2py server all time on-line when I start my OS Kubuntu

But when I run Web2Py server from GUI (from Icon on desktop) than server
start and I have Internal error
I presume that I need to change owner of file and folder for web2py but I
tray 'me' as user and it is same


- - Miroslav Gojic - -
+ 381 64 014 8868




On Thu, Dec 29, 2011 at 22:45, Massimo Di Pierro  wrote:

> This is most likely a problem with accessing file system. what os?
>
> On Dec 29, 11:49 am, miroslavgojic  wrote:
> > When I start web2py I have message:
> >
> > Internal server error, and link to ticket but I can't open ticket...
> > And often it is happen that I can't close web2py server just stay on
> > desktop and I can't close the server window.
>


Re: [web2py] MARKMIN clarification

2011-12-30 Thread Albert Abril
I can't test it now, but try to put 4 spaces at the end of the line to
force a newline.

2011/12/30 lyn2py 

> Does MARKMIN have issues with processing newlines?
> Because I can't use formatting here, everything looks like the same
> text, but in MARKMIN the formatting is ok, only the newlines is not
> ok.
>
> (1) I noticed that newlines don't convert to  in MARKMIN, which is
> strange.
>
> Example:
> I write this
> in two lines
>
> MARKMIN processes it as: I write thisin two lines
>
> But 2 newlines automatically converts to a paragraph (which is
> correct).
>
> (2) Also, when using verbatim ``
>
> Example:
> ``I write this``
>
> ``in two paragraphs``
>
> MARKMIN: I write thisin two paragraphs
>
> (3) Using a mix of verbatim/italics/bold
>
> Example:
> ``an edit as usual``
>
> ``another``
>
> ''one or the other''
> **could be bolded**
>
> MARKMIN:
> an edit as usualanother
>
> one or the other could be bolded
>
> Notice the inconsistency in processing newlines (and spaces).
> Is this correct behavior of MARKMIN?