villas | 1 Apr 2011 01:26
Picon

Re: clean database

I believe the w2p file is just a standard zip file.  If you want to
include a subset of files,  I guess you could always make your own zip
file.

I sometimes just zip the app folder myself and unzip it on my other
computer when I'm working on something.

In production my DB file is not available to web2py so it couldn't be
included.

On Mar 29, 2:13 pm, LightOfMooN <vladsale...@...> wrote:
> Yes, thanks, it's good.
>
> But first question stills opened:
> Is there a way to pack just app code? (to *.w2p)
>
> On 29 мар, 16:03, Martín Mulone <mulone.mar... <at> gmail.com> wrote:
>
> > Put autodelete=True on the db field definition upload.
>
> > from the book:
>
> > autodelete determines if the corresponding uploaded file should be deleted
> > when the record referencing the file is deleted. For "upload" fields only.
>
> > 2011/3/29 LightOfMooN <vladsale...@...>
>
> > > Question is opened.
> > > App working, HDD space decreases because of uploads. But some uploads
> > > are deleted from database, but files not.
(Continue reading)

Jonathan Lundell | 1 Apr 2011 01:37
Picon
Favicon
Gravatar

Re: Re: clean database

On Mar 31, 2011, at 4:26 PM, villas wrote:
> 
> I believe the w2p file is just a standard zip file.  If you want to
> include a subset of files,  I guess you could always make your own zip
> file.

They're tgz (gzipped tar).

> 
> I sometimes just zip the app folder myself and unzip it on my other
> computer when I'm working on something.
> 
> In production my DB file is not available to web2py so it couldn't be
> included.
> 
> 
> On Mar 29, 2:13 pm, LightOfMooN <vladsale...@...> wrote:
>> Yes, thanks, it's good.
>> 
>> But first question stills opened:
>> Is there a way to pack just app code? (to *.w2p)
>> 
>> On 29 мар, 16:03, Martín Mulone <mulone.mar...@...> wrote:
>> 
>>> Put autodelete=True on the db field definition upload.
>> 
>>> from the book:
>> 
>>> autodelete determines if the corresponding uploaded file should be deleted
>>> when the record referencing the file is deleted. For "upload" fields only.
(Continue reading)

skwasha | 1 Apr 2011 03:20
Picon

Re: ckeditor integration

Latest frustration....

Now I have some validation questions.

In my model I have a field defined as notnull=True. If I submit a
blank field using just a regular textarea, I get the expected result
that the field is not accepted and an error generated. However, when I
submit a blank field using ckeditor, it goes thru and writes the blank
field to the DB.

I put in a cpl print stmts in the controller to see what the
request.vars were holding and what form.accepts(request.vars)
returned.

Here's where I'm lost... This is the output with the regular textarea:

<Storage {}>
False
<Storage {'_formkey': 'eb7de4fd-8f22-4641-83a8-8a952e1e970b',
'list_id': '3', '_formname': 'list_item_create', 'name': 'junk',
'description': ''}>
False

Here's the output from the same form using ckeditor:

<Storage {}>
False
<Storage {'_formkey': '7944510a-fdda-4e7b-9454-3854e16ab59c',
'list_id': '3', '_formname': 'list_item_create', 'name': 'junk',
'description': ''}>
(Continue reading)

luckysmack | 1 Apr 2011 04:09
Picon
Gravatar

MongoDB and Web2Py

I have read a few older messages about mongoDB being made to work with
the DAL. But they all seem to be pretty dated and have not specified
what was working and what wasnt. massimo menitoned that it may be
ready by january of this year. But under the supported list it wasnt
listed. So im just curious as to what the status of using mongoDB is
with web2py and if anyone has a basic example on how I would use it.
Thanks

Anthony | 1 Apr 2011 04:26
Picon

Re: DAL format= functionality

I think the format argument only alters the record representation in forms and SQLTABLE (which is used when a set or records is serialized in a view). If you're just doing a query and pulling an individual field value from a row, I don't think the format will be applied. See http://web2py.com/book/default/chapter/06#Record-Representation.

If you don't want to call the format function every time you display the speaker name, maybe you could use a virtual field: http://web2py.com/book/default/chapter/06#Virtual-Fields
Anthony

On Thursday, March 31, 2011 4:41:40 PM UTC-4, Gregory Hellings wrote:
I have defined a custom auth.settings.table_user_name implementation
that includes one extra field and specifies a value for the format
argument.  In this case format is a callback function which displays
the user's name with extra formatting based on membership in certain
auth groups.  This option works wonderfully with SQLFORM fields and
with appadmin displays of the auth_membership table, but I seem to be
missing something about its functionality elsewhere.

(This is in the context of a demo chat application utilizing the
web2py_comet functionality). I have another table which is defined
like this:

db.define_table('chat',
    Field('speaker', db.auth_user, default=auth.user_id,
writable=False, readable=False),
    Field('statement', 'text', requires=IS_NOT_EMPTY()),
    Field('deleted', db.auth_user, writable=False, readable=False))
db.chat.speaker.requires = IS_IN_DB(db, db.auth_user.id)
db.chat.deleted.requires  = IS_IN_DB(db, db,auth_user.id)

My controller for displaying the lines uses this logic

rawlines=db(db.chat.deleted==None).select(limitby=(0,10),orderby=~db.chat.id)
lines=[]
for line in rawlines:
    lines.append(DIV(line.speaker, B("> "), line.statement,
_id=line.id))

However, when I do that, I get the user's ID instead of the user's
name as formatted by my format callback method.  Thus the chat output
looks like

1> Hi there
1> How is everyone doing?
2> We're great, how about you?
1> Oh, I'm absolutely fantastic.

In order to get the properly formatted user's name, I have to
explicitly call my format method, making the last line of the above
controller instead read

    lines.append(DIV(name_format(line.speaker), B("> "),
line.statement, _id=line.id))

This defeats most of the purpose I had in using the automatic
format=name_format argument to the define_table call.  Am I missing
something here?  What am I doing incorrectly?  As I scale out of my
demo chatroom, I want to make sure user names are consistently
displayed throughout my application by means of the format argument to
the auth_user table, rather than trying to remember to call
name_format(user) everywhere.  Any advice?

--Greg
Joaquin Orbe | 1 Apr 2011 04:49
Picon
Gravatar

Re: Re: in-line select for counting purpose

On Wed, Mar 30, 2011 at 6:56 PM, Massimo Di Pierro
<massimo.dipierro@...> wrote:
> yes. I do not know how to do it with one query.
>
> On Mar 30, 3:18 pm, Joaquin Orbe <joaquino...@...> wrote:
>> On Sat, Mar 26, 2011 at 6:30 PM, Massimo Di Pierro
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <massimo.dipie...@...> wrote:
>> > You an have a nested select in place of a field.
>>
>> > I think you want:
>> > count = db.sales_order.id.count()
>> > query = db.sales_order.VendorID == db.vendor.id
>> > rows1 = db(query)
>> > (db.sales_order.Status==1).select(db.vendor.id,db.vendor.Name,count)
>> > rows2 = db(query)
>> > (db.sales_order.Status==2).select(db.vendor.id,db.vendor.Name,count)
>> > rows3 = db(query)
>> > (db.sales_order.Status==3).select(db.vendor.id,db.vendor.Name,count)
>>
>> > On Mar 26, 3:57 pm, Joaquin Orbe <joaquino...@...> wrote:
>> >> Hi all,
>>
>> >> I'm trying to get a result for this query:
>>
>> >> select vendor.id, vendor.Name,
>> >> (select count(*) from sales_order where [Status] = 1 and vendor.id =
>> >> sales_order.VendorID),
>> >> (select count(*) from sales_order where [Status] = 2 and vendor.id =
>> >> sales_order.VendorID),
>> >> (select count(*) from sales_order where [Status] = 3 and vendor.id =
>> >> sales_order.VendorID)
>> >> from vendor
>>
>> >> and for it I do:
>>
>> >> countOpen = db((db.sales_order.Status==1)&(db.sales_order.VendorID ==
>> >> db.vendor.id)).count()
>> >> countProg = db((db.sales_order.Status==2)&(db.sales_order.VendorID ==
>> >> db.vendor.id)).count()
>> >> countClosed = db((db.sales_order.Status==3)&(db.sales_order.VendorID
>> >> == db.vendor.id)).count()
>>
>> >> rows = db().select(db.vendor.id, db.vendor.Name,countOpen,countProg,countClosed)
>>
>> >> but it's not working because I get
>>
>> >> (1, vendor1, 1, 4, 1)
>> >> (2, vendor2, 1, 4, 1)
>>
>> >> instead of
>>
>> >> (1, vendor1, 1, 4, 1)
>> >> (2, vendor2, 0, 0, 0)
>>
>> >> It seems the result of vendor1 is also applied to vendor2 (vendor2
>> >> does not have records in sales_order table).
>>
>> >> Does someone know how to solve it?
>>
>> >> Thanks in advance,
>> >> Joaquin.
>>
>> Hi Massimo,
>> sorry for my late answer.
>>
>> How should I applied your suggestion? As I can understand, your code
>> seems to have three row results, and in my case I need only one. Is it
>> correct my understanding?
>>
>> Thanks,
>> Joaquin.

It's ok Massimo, thanks anyway. I've solved it with an executesql
statement for the moment.

BTW, I've been playing with dql.py trying to support this scenario but
the code is a bit messy to publish here. I could get it work but I
don't know if this could have impact in another place (I'm still a
newbie). I'll post it here once I apply a cleaning on it.

Thanks for all,
Joaquin.

Massimo Di Pierro | 1 Apr 2011 04:56
Picon

Re: wizard error when creating the database

That is a bug fixed in trunk. A leftover debug statement. Please
remove that print statement. I will post a new web2py shortly.

On Mar 31, 2:58 pm, Miguel <miguel.miran...@...> wrote:
> hello to all, today i upgraded to 1.94.6 using the admin interface,
> after that i tryid to create a new project using the wizard, all went
> fine until Step 6: Generate app "monitoreando"
>
> This is the trace:
>
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 188, in
> restricted
>     exec ccode in environment
>   File "/home/www-data/web2py/applications/admin/controllers/
> wizard.py", line 598, in <module>
>   File "/home/www-data/web2py/gluon/globals.py", line 124, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/www-data/web2py/applications/admin/controllers/
> wizard.py", line 212, in step6
>     create(form.vars)
>   File "/home/www-data/web2py/applications/admin/controllers/
> wizard.py", line 546, in create
>     fix_db(model)
>   File "/home/www-data/web2py/applications/admin/controllers/
> wizard.py", line 367, in fix_db
>     auth_user = make_table('auth_user',session.app['table_auth_user'])
>   File "/home/www-data/web2py/applications/admin/controllers/
> wizard.py", line 278, in make_table
>     print ftype
> IOError: sys.stdout access restricted by mod_wsgi
>
> Im using apache + mod_wsgi
> I dont remember what was the previus version, but i used the wizard
> before without any problem.
> Googling around appears that it is a web2py problem for not following
> the wsgi's "dont use print statement" rule
> what should i check?

Massimo Di Pierro | 1 Apr 2011 04:58
Picon

Re: MongoDB and Web2Py

Lots of people asked for support but nobody volunteered to help test
it.
If you are interested and can help with some regular tests we can make
it work in relatively short time.

Massimo

On Mar 31, 9:09 pm, luckysmack <luckysm...@...> wrote:
> I have read a few older messages about mongoDB being made to work with
> the DAL. But they all seem to be pretty dated and have not specified
> what was working and what wasnt. massimo menitoned that it may be
> ready by january of this year. But under the supported list it wasnt
> listed. So im just curious as to what the status of using mongoDB is
> with web2py and if anyone has a basic example on how I would use it.
> Thanks

pbreit | 1 Apr 2011 05:12
Picon

Re: dashes in url

I've come around a little bit on the default. The one thing where I could see defaulting to re-mapping is with the function since that's not going to work anyhow.

niknok | 1 Apr 2011 05:39
Picon

online book, image display error

For some reason or another, I couldn't get to view these images. In chapter 3, these are: index1.png, about.png

Also in chapter 7:custom_errors.png

FYI.


Gmane