[web2py] Re: Mixing/supporting CMS with Web2py

2011-11-04 Thread Gour
On Fri, 4 Nov 2011 12:36:18 +0630
Phyo Arkar 
wrote:

> Due to the fact of web2py's Single step deployment , many
> not-so-technical users will want to adopt it . If theres a stable ,
> active CMS , developed using Web2py , it will change the future of
> both python and web2py in web development.

I fully agree...before jumping to Web2py I was looking at Zine (
http://zine.pocoo.org/code), but web2py-based blog/CMS could have much greater
impact considering all the known web2py pros...



Sincerely,
Gour


-- 
One who is not connected with the Supreme can have neither 
transcendental intelligence nor a steady mind, without which 
there is no possibility of peace. And how can there be any 
happiness without peace?

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: Missing my posts - Anyone else losing posts

2011-11-04 Thread Murray3
seems to happen all the time on google groups, nevermind!

On Nov 4, 5:39 am, BrendanC  wrote:
> Ignore my previous qn - they just showed up again - so it's probably some
> sort of refresh issue with my broswer settings.


Re: [web2py] Mixing/supporting CMS with Web2py

2011-11-04 Thread Philip Kilner

Hi Phylo,

On 04/11/2011 06:06, Phyo Arkar wrote:

We really need a CMS/Blog that the developer really cares ., It have a
lot of potential to become top CMS/Blog.



I agree, in principle, but we need to define our terms here. If by 
CMS/Blog we're referring to something like Wordpress, then that is 
realistic. The first step would probably be to define some sort of 
spec., as "CMS/Blog" can mean very different things to different people.


However, I think it would be too ambitious to try to replicate something 
like Plone - not a blogging tool, and hardly a lightweight CMS either - 
so from my PoV there will continue to be a need to mesh Plone and web2py 
together.



--

Regards,

PhilK


'a bell is a cup...until it is struck'



[web2py] Re: Mixing/supporting CMS with Web2py

2011-11-04 Thread Gour
On Fri, 04 Nov 2011 09:47:22 +
Philip Kilner 
wrote:

> I agree, in principle, but we need to define our terms here. If by 
> CMS/Blog we're referring to something like Wordpress, then that is 
> realistic. The first step would probably be to define some sort of 
> spec., as "CMS/Blog" can mean very different things to different
> people.

Having decent support/docs/more_devs/.. for InstantPress would be, imho, good
starting point...


Sincerely,
Gour



-- 
A person who has given up all desires for sense gratification, 
who lives free from desires, who has given up all sense of 
proprietorship and is devoid of false ego — he alone can 
attain real peace.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Re: ASK Web2py Groups: Clarification on decimal type field

2011-11-04 Thread Vinicius Assef
Think of it as any normal database application.

As far as Web2py doesn't create indexes, you must take care of it by yourself.

If your IS_IN_DB() validator refers to a field that isn't indexed,
your performance will suffer.


--
Vinicius Assef.



On Fri, Nov 4, 2011 at 1:33 AM, Pystar  wrote:
> Another Question:
> what is the performance drawback in using IS_IN_DB() validator in a
> form? From what I understand, web2py checks if the query passes
> against the database before doing a database insert or any other
> action. I would like to know if there would be a performance degrade
> as the number of records in the database increases and that means the
> more records the IS_IN_DB() validator has to check itself against?
> Thanks
>
> On Nov 4, 4:13 am, Pystar  wrote:
>> Thanks Max
>>
>> On Nov 4, 4:07 am, Massimo Di Pierro 
>> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > I always use request.now.I think of utfnow as a utility in case there
>> > ar multiple servers in different dimezones.
>>
>> > On Nov 3, 9:46 pm, Pystar  wrote:
>>
>> > > I have another question,
>> > > Whats the best way to get the time to use for a time stamp field in a
>> > > database insert? request.utcnow? I would like to do time comparisons
>> > > between when a record was inserted into a database and the present
>> > > time, so would request.utcnow suffice? and if it would, how do I get
>> > > the time elapsed value? between the 2 values?
>> > > thanks
>>
>> > > On Nov 4, 3:41 am, Pystar  wrote:
>>
>> > > > I would like some clarification on the Decimal type field in DAL. From
>> > > > the book, in the complete signature for Decimal type is "decimal(n,m)"
>> > > > where;
>> > > > n -- total number of digits
>> > > > m -- total number of digits after the decimal point
>> > > > if I am to specify a decimal type field that has 4 digits after the
>> > > > decimal place how would I specify that? since I cant really determine
>> > > > before hand how many digits in total the decimal number would contain.
>>
>> > > > Would specifying the field as "decimal(, 4)" work i.e. leave out the
>> > > > "n" value ? or is there something I am not getting?
>>
>> > > > Thanks for your swift response.
>> > > > Pystar


Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-11-04 Thread Phyo Arkar
it is true,

Can Instant Press developer define goals and roadmaps so that we know
what to work on and submit patches or allow some of us Developer
access?
Or should we fork it if hes busy to manage this project ?

Regards,

Phyo

On 11/4/11, Gour  wrote:
> On Fri, 04 Nov 2011 09:47:22 +
> Philip Kilner 
> wrote:
>
>> I agree, in principle, but we need to define our terms here. If by
>> CMS/Blog we're referring to something like Wordpress, then that is
>> realistic. The first step would probably be to define some sort of
>> spec., as "CMS/Blog" can mean very different things to different
>> people.
>
> Having decent support/docs/more_devs/.. for InstantPress would be, imho,
> good
> starting point...
>
>
> Sincerely,
> Gour
>
>
>
> --
> A person who has given up all desires for sense gratification,
> who lives free from desires, who has given up all sense of
> proprietorship and is devoid of false ego — he alone can
> attain real peace.
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>


Re: [web2py] Mixing/supporting CMS with Web2py

2011-11-04 Thread Phyo Arkar
Lets Keep it simple , mature first instead of  rushing it loaded with features.

Lets start with Main feature of WordPress , A blog , Layout/Theme
management , Posting news , Tagging , comments (Instant-press should
have to features)

Make those features works well stable and robust.

Add more features later.

Any takers?



On 11/4/11, Philip Kilner  wrote:
> Hi Phylo,
>
> On 04/11/2011 06:06, Phyo Arkar wrote:
>> We really need a CMS/Blog that the developer really cares ., It have a
>> lot of potential to become top CMS/Blog.
>>
>
> I agree, in principle, but we need to define our terms here. If by
> CMS/Blog we're referring to something like Wordpress, then that is
> realistic. The first step would probably be to define some sort of
> spec., as "CMS/Blog" can mean very different things to different people.
>
> However, I think it would be too ambitious to try to replicate something
> like Plone - not a blogging tool, and hardly a lightweight CMS either -
> so from my PoV there will continue to be a need to mesh Plone and web2py
> together.
>
>
> --
>
> Regards,
>
> PhilK
>
>
> 'a bell is a cup...until it is struck'
>
>


[web2py] Receiving external server response....

2011-11-04 Thread Auden RovelleQuartz
Does anyone have a simple example on how to receive a server response
sent back to a web2py URL ("status_url"), and store that response as a
text message (e.g so that data can be programmatically processed
later)?

The server response sent back is an HTTP post array and it is sent
from a payment processor in after processing the following POST form:

{{extend 'm_layout.html'}}

https://www.moneybookers.com/app/payment.pl";
method="post">















Re: [web2py] Re: interget or string to date

2011-11-04 Thread Phyo Arkar
please check dateutils.

It works will almost all date-time formats, it intelligently convert
to datetime object .

labix.org/python-dateutil

On 11/3/11, Omi Chiba  wrote:
> Vineet,
>
> Thanks for sharing.
> It works like a charm !
>
> On Nov 2, 10:27 am, Vineet  wrote:
>> Recently, I wrote this function for my purpose.
>> See if this helps you.
>> Assuming that argument 'dte' input format is -->>  "03-11-2011"
>>
>> [CODE]
>> import datetime, string
>>
>> def str_to_dt(dte):
>>     dte = str(dte)
>>     dte = string.strip(dte)
>>     if len(dte) == 10:
>>         y = int(dte[6:])
>>         m = int(dte[3:5])
>>         d = int(dte[:2])
>>         return datetime.date(y, m, d)
>> [/CODE]
>>
>> This returns output in "python datetime.date" format.
>>
>> --Vineet
>>
>> On Nov 2, 8:19 pm, Omi Chiba  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > This is more like python question but
>>
>> > jj.J2NSD is integer and has value = 2030 (MMDD)
>>
>> > I want to set the value as default value of FFNSD which is 'date'
>> > type.
>>
>> > Field('FFNSD', 'date'),
>>
>> > I think I need to import datetime and convert from integer or stiring.
>> > Is anyone know easy way to do it ?
>>
>> > This doesn't work because it set string to date...
>>
>> > db.FEDEXFORM.FFNSD.default = str(jj.J2NSD)[0:4]+"-"+str(jj.J2NSD)
>> > [4:6]+"-"+str(jj.J2NSD)[6:8]


Re: [web2py] Mixing/supporting CMS with Web2py

2011-11-04 Thread Phyo Arkar
Plone itself is a beast of its own, even tho web2py is a lot easier
than Zope and can create something that beats Plone ,  alot easier
than doing it with zope, we should not try to go that way.



On 11/4/11, Philip Kilner  wrote:
> Hi Phylo,
>
> On 04/11/2011 06:06, Phyo Arkar wrote:
>> We really need a CMS/Blog that the developer really cares ., It have a
>> lot of potential to become top CMS/Blog.
>>
>
> I agree, in principle, but we need to define our terms here. If by
> CMS/Blog we're referring to something like Wordpress, then that is
> realistic. The first step would probably be to define some sort of
> spec., as "CMS/Blog" can mean very different things to different people.
>
> However, I think it would be too ambitious to try to replicate something
> like Plone - not a blogging tool, and hardly a lightweight CMS either -
> so from my PoV there will continue to be a need to mesh Plone and web2py
> together.
>
>
> --
>
> Regards,
>
> PhilK
>
>
> 'a bell is a cup...until it is struck'
>
>


[web2py] Usability: SQLFORM.grid column order with foreign table

2011-11-04 Thread Cliff
Is there a way to force a certain column order in SQLFORM.grid when
the grid includes a foreign table?

If not, how do I submit a request for it?

In the following grid setup, the products.name column is last in the
grid.  It would be more usable to put it first.

query = ((db.products.id==db.product_lots.product_id) &
 (db.product_lots.is_active==True))
columns = ('products.name',
   'product_lots.our_lot_number',
'product_lots.quantity_on_hand'
  )
headers ={'products.name': 'Product Name',
  'product_lots.our_lot_number': 'Lot Number',
  'product_lots.quantity_on_hand': 'Quantity On Hand'}

form = SQLFORM.grid(query=query, columns=columns, headers=headers,
deletable=False, csv=False, )



[web2py] Re: auth_user represent

2011-11-04 Thread Bianca Cadaveri
Thank you Anthony !!!

BC

On 4 nov, 01:52, Anthony  wrote:
> On Thursday, November 3, 2011 8:31:10 PM UTC-4, Bianca Cadaveri wrote:
>
> > Thank you very much to both of you.
>
> > Is this way to write formats specific to Web2py : '%(first_name) %
> > (last_name) (%(id))' ?
>
> > I have never met before "%" followed by "()".
>
> > It means : write "first_name last_name" corresponding to "id", right ?
>
> Not exactly. This is standard Python string
> formatting:http://docs.python.org/library/stdtypes.html#string-formatting
>
> The string above should be followed by a % and then a dictionary with keys
> equal to the placeholders in parentheses (in this case, first_name,
> last_name, and id) and values equal to the values you want to substitute
> into the string. When you specify the 'format' argument of a table in this
> way, web2py will pass the Row object for the record as the dictionary (the
> Row class inherits from dictionary, so functions as a dictionary in this
> case), so the values from the record will get substituted for the field
> names in the 'format' string. The output of the above would be something
> like 'John Doe (1)' (the name is John Doe and the record id is 1).
>
> Alternatively, the format argument can be a function that takes a single
> Row object and returns the desired output.
>
> Anthony


Re: [web2py] Mixing/supporting CMS with Web2py

2011-11-04 Thread Philip Kilner

Hi,

On 04/11/2011 12:39, Phyo Arkar wrote:

Plone itself is a beast of its own, even tho web2py is a lot easier
than Zope and can create something that beats Plone ,  alot easier
than doing it with zope, we should not try to go that way.



There are things that Zope & Plone do with acquisition, the ZODB and its 
catalog that are hugely powerful. Having said that, the reputation for a 
"Z-shaped learning curve" is well deserved.


Again, we need to define our terms - trying to beat Plone in terms of 
its enterprise (that word again!) CMS features would be plain daft, and 
doomed to failure with the resources available, but trying to beat Plone 
in terms of agility and accessibility to developers is a task that 
web2py is well positioned for.



--

Regards,

PhilK


'a bell is a cup...until it is struck'



Re: [web2py] Re: Custom search_widget SQLFORM.grid

2011-11-04 Thread Jim Steil

Massimo

I am playing around with this more this morning and found some issues 
with what I'd been working on.  Will continue to refine and let you know 
when I have something working better.


-Jim

On 11/3/2011 8:00 PM, Massimo Di Pierro wrote:

Please make sure you apply your change to the latest sqlhtml.py (I
modified it this afternoon) and send me the whole modified file or a
patch file.

massimo

On Nov 3, 4:26 pm, Jim Steil  wrote:

Ok - no replies so I went about this myself and am trying to come up
with a solution.

First off, the reasons why the default search doesn't work for me.
-As in the example below, sometimes I want to provide a custom drop-down
for users to select from to limit the records displayed
-Date values are not handled by the default search
-Sometimes want an auto-complete field available in my search criteria

So, to make this work I looked at the code in SQLFORM.grid related to
the searching.  What I want to do is remove the default searching
altogether, including the query-building wizard (which I believe in
other environments is very powerful).

In looking at this code it occurred to me that I should be able to
replace the default search_widget with my own form definition and then
look at the values returned to my controller and build the necessary
query to pass to SQLFORM.smartgrid.  What I found was that this work
very easily.  The only problem is that I want the default search to not
appear while my custom search form does appear.  The problem is that
when I pass searchable=False to my grid that neither my custom search
nor the default search mechanism appear.  When I pass searchable=True,
both of them appear.  I'd like an option where I can pass my own search
form via search_widget but not display the default search fields.

I believe this could be done relatively easily by adding the following
to SQLFORM.grid:

  form = FORM(
  search_widget and search_widget([f for f in table if
f.readable]) or '',
  _method="GET",_action=url())
  console.append(form)

Starting after line 1649 in the latest (updated this morning)
sqlhtml.py.  Right after the line that reads:subquery = None

Using the following SQLFORM.smartgrid call:

  grid = SQLFORM.smartgrid(db.assetType, constraints=constraints,
   columns=columns,
   details=False, orderby=orderby,
   csv=False, search_widget=searchForm,
   searchable=None,
   paginate=15, maxtextlength=45)

searchForm is defined in the same controller as:

def searchForm(self):
  form = FORM('',
  LABEL('Name:', _for='asset_name'),
  INPUT(_name='asset_name',_value=request.get_vars.asset_name,
_id='web2py_asset_name'),
  INPUT(_type='submit',_value=T('Search')),
  INPUT(_type='submit',_value=T('Clear'),
_onclick="jQuery('#web2py_asset_name').val('');"),
  _method="GET",_action='',
  _id='assetSearchForm')

  return form

Now I can provide my own custom search widget providing I handle the
query building myself.  Thoughts?  Warning - my code works for my
situation but is not very pretty.

I would like this to be considered for a patch.  Any further input would
be greatly appreciated.

  -Jim

On 11/1/2011 8:38 AM, Jim Steil wrote:








Hi
I'm using the SQLFORM.grid extensively in a rewrite of my old
TurboGears application.  A common thing that I provided in my previous
version of the application was to present to the user different
filtering options for lists.  Here is a screen shot of it:
For my needs, the new SQLFORM.grid search_widget doesn't quite fit.
I'd like to provide my own search widget.  In looking through
sqlhtml.py at the search_widget code it would appear that I could
provide my own widget.  I'm just wondering if anyone else has done
this yet and has any code or advice they'd like to share.
Thanks for any input!
 -Jim


[web2py] data from request.vars

2011-11-04 Thread petrasadi
I am trying to retrieve a datetime.date type out of the request.vars,
but it comes out as str
Is this normal, or is there a way to parse from str back to datetime?


Re: [web2py] data from request.vars

2011-11-04 Thread Richard Vézina
I think it's normal...

You can convert it back to datetime :
http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior

Richard

On Fri, Nov 4, 2011 at 11:19 AM, petrasadi  wrote:

> I am trying to retrieve a datetime.date type out of the request.vars,
> but it comes out as str
> Is this normal, or is there a way to parse from str back to datetime?


[web2py] Smartgrid and create link

2011-11-04 Thread Roberto Perdomo
Hi, i need to put this code in new form from the add button of smartgrid:


$(document).ready(function() {
   $('#beneficiarios_cedula_personal__row').hide();
});


I can edit the edit and delete links, but i need a custom new link. How i
can do this?

Thanks.


[web2py] Re: Reusing a prefilled, readonly SQLFORM.factory form?

2011-11-04 Thread pepper_bg
This got solved by using the fact that Field.default could be
manipulated *after* the Field has been created (following the above
line of examples):

def build_form(readonly=False):
#create fields or get from
db
field1=Field('test')
field2=db.my_table.best
#set
defaults
field1.default='abc'
field2.default='123'
#give it to the
form
form = SQLFORM.factory( *[field1, field2], readonly=readonly )

def frm():
form = build_form( readonly=True )
return dict(form=form)

So readonly=True and no need of form.accepts. The lesson (if I am
still not missing something) - if you want to reuse a SQLFORM.factory
form and make it readonly set the defaults using Field.default and not
Form.vars. Very particular...


[web2py] How to group database fields in the model?

2011-11-04 Thread António Ramos
Hello,
i need something to group fields based on a rule

for example i have 30 database fields

the first 10 should be editable in condition 1. the remaining 20 fields
should be blocked
the next 10 in the condition 2 also the remaining 20 should be blocked

and the last 10 in condition 3

What is the best way to group fields?

for example in the name of the field

*_1_*field1  ? being _1_ the condition 1

*_2_*field12  being _2_ the condition 2

any ideas?


Re: [web2py] How to group database fields in the model?

2011-11-04 Thread Richard Vézina
db.table.field.writable and .readable = False

You will have to implement not null into the controller...

Just need to

if your condition:
  # SET your different fields to whatever you need
  db.table.field.writable and .readable = False

form = SQLFORM(db.table)

You will have to manage also the default and update properties for each
field the same way

if ...:
  db.table.field.default =
  db.table.field.update =

For a bizzard reason the .default and .update setup seems to stop working,
I sent a email about that earlier this week but don't get any reply...
Maybe the syntax has changed...

There is surely other solutions more DRY, but this should work for simple
task.

Hope it helps.

Richard

2011/11/4 António Ramos 

> Hello,
> i need something to group fields based on a rule
>
> for example i have 30 database fields
>
> the first 10 should be editable in condition 1. the remaining 20 fields
> should be blocked
> the next 10 in the condition 2 also the remaining 20 should be blocked
>
> and the last 10 in condition 3
>
> What is the best way to group fields?
>
> for example in the name of the field
>
> *_1_*field1  ? being _1_ the condition 1
>
> *_2_*field12  being _2_ the condition 2
>
> any ideas?
>
>
>
>
>


Re: [web2py] How to group database fields in the model?

2011-11-04 Thread António Ramos
what is the field.update for?

Thank you

2011/11/4 Richard Vézina 

> db.table.field.writable and .readable = False
>
> You will have to implement not null into the controller...
>
> Just need to
>
> if your condition:
>   # SET your different fields to whatever you need
>   db.table.field.writable and .readable = False
>
> form = SQLFORM(db.table)
>
> You will have to manage also the default and update properties for each
> field the same way
>
> if ...:
>   db.table.field.default =
>   db.table.field.update =
>
> For a bizzard reason the .default and .update setup seems to stop working,
> I sent a email about that earlier this week but don't get any reply...
> Maybe the syntax has changed...
>
> There is surely other solutions more DRY, but this should work for simple
> task.
>
> Hope it helps.
>
> Richard
>
> 2011/11/4 António Ramos 
>
>> Hello,
>> i need something to group fields based on a rule
>>
>> for example i have 30 database fields
>>
>> the first 10 should be editable in condition 1. the remaining 20 fields
>> should be blocked
>> the next 10 in the condition 2 also the remaining 20 should be blocked
>>
>> and the last 10 in condition 3
>>
>> What is the best way to group fields?
>>
>> for example in the name of the field
>>
>> *_1_*field1  ? being _1_ the condition 1
>>
>> *_2_*field12  being _2_ the condition 2
>>
>> any ideas?
>>
>>
>>
>>
>>
>


[web2py] Re: Mixing/supporting CMS with Web2py

2011-11-04 Thread Massimo Di Pierro
perhaps we should make a list of desired features.

On Nov 4, 9:10 am, Philip Kilner  wrote:
> Hi,
>
> On 04/11/2011 12:39, Phyo Arkar wrote:
>
> > Plone itself is a beast of its own, even tho web2py is a lot easier
> > than Zope and can create something that beats Plone ,  alot easier
> > than doing it with zope, we should not try to go that way.
>
> There are things that Zope & Plone do with acquisition, the ZODB and its
> catalog that are hugely powerful. Having said that, the reputation for a
> "Z-shaped learning curve" is well deserved.
>
> Again, we need to define our terms - trying to beat Plone in terms of
> its enterprise (that word again!) CMS features would be plain daft, and
> doomed to failure with the resources available, but trying to beat Plone
> in terms of agility and accessibility to developers is a task that
> web2py is well positioned for.
>
> --
>
> Regards,
>
> PhilK
>
> 'a bell is a cup...until it is struck'


[web2py] Re: How to group database fields in the model?

2011-11-04 Thread Massimo Di Pierro
db.table.c.update = lambda row: row.a+row.b

is a function that compute the value of field c if you have field a
and field b.

On Nov 4, 12:04 pm, António Ramos  wrote:
> what is the field.update for?
>
> Thank you
>
> 2011/11/4 Richard Vézina 
>
>
>
>
>
>
>
> > db.table.field.writable and .readable = False
>
> > You will have to implement not null into the controller...
>
> > Just need to
>
> > if your condition:
> >   # SET your different fields to whatever you need
> >   db.table.field.writable and .readable = False
>
> > form = SQLFORM(db.table)
>
> > You will have to manage also the default and update properties for each
> > field the same way
>
> > if ...:
> >   db.table.field.default =
> >   db.table.field.update =
>
> > For a bizzard reason the .default and .update setup seems to stop working,
> > I sent a email about that earlier this week but don't get any reply...
> > Maybe the syntax has changed...
>
> > There is surely other solutions more DRY, but this should work for simple
> > task.
>
> > Hope it helps.
>
> > Richard
>
> > 2011/11/4 António Ramos 
>
> >> Hello,
> >> i need something to group fields based on a rule
>
> >> for example i have 30 database fields
>
> >> the first 10 should be editable in condition 1. the remaining 20 fields
> >> should be blocked
> >> the next 10 in the condition 2 also the remaining 20 should be blocked
>
> >> and the last 10 in condition 3
>
> >> What is the best way to group fields?
>
> >> for example in the name of the field
>
> >> *_1_*field1  ? being _1_ the condition 1
>
> >> *_2_*field12  being _2_ the condition 2
>
> >> any ideas?


[web2py] Re: Smartgrid and create link

2011-11-04 Thread Massimo Di Pierro
SQLFORM.smartgrid(, links=dict(tablename=[lambda row:
A('hi',_class='button')])

links is a dict(tablename=[...]) the list (for each table) contains
functions that take a row and make the button.

On Nov 4, 11:15 am, Roberto Perdomo  wrote:
> Hi, i need to put this code in new form from the add button of smartgrid:
>
> 
>     $(document).ready(function() {
>        $('#beneficiarios_cedula_personal__row').hide();
>     });
> 
>
> I can edit the edit and delete links, but i need a custom new link. How i
> can do this?
>
> Thanks.


Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-11-04 Thread Vasile Ermicioi
I wish to make a Drupal alternative based on web2py


[web2py] Jquery 1.7; Twitter Bootstrap 1.4

2011-11-04 Thread pbreit
Jquery 1.7
http://blog.jquery.com/2011/11/03/jquery-1-7-released/

Twitter Bootstarp 1.4
https://github.com/twitter/bootstrap/wiki/Changelog


Re: [web2py] Re: nyroModal

2011-11-04 Thread Kenneth Lundström

Hi Russell,

Have you defined nyroModalRemove somewhere? I'm getting 
"parent.$.nyroModalRemove is not a function" when using your suggested 
three lines.



Kenneth

 return_script = ['parent.$.nyroModalRemove();']
 return_script.append('parent.window.location.reload();')
 return HTML(BODY(SCRIPT(''.join(return_script.xml()




[web2py] Re: Mixing/supporting CMS with Web2py

2011-11-04 Thread Gour
On Fri, 4 Nov 2011 10:38:06 -0700 (PDT)
Massimo Di Pierro
 wrote:

> perhaps we should make a list of desired features.

I believe that WordPress is quite etablished as Blog engine and CMS
platform, so making Instant Press as "Python's WordPress" would be
cool, iow, stable blog/CMS + support for easy styling/theming along
with solid framework to write plugins...

I'd be more than satisfied and would try to contribute to make it
happen!


Sincerely,
Gour

-- 


signature.asc
Description: PGP signature


[web2py] SQLFORM.smartgrid query/search don't work for related tables

2011-11-04 Thread Jim Steil

Hi

Testing some stuff with SQLFORM.smartgrid.  When using the query/search 
on a related table, the query doesn't present any fields in the dropdown 
list and no matter what I put in the search field, it returns 'Invalid 
query'.


Is anyone else seeing this problem as well?

-Jim

--
Jim Steil
VP of Information Technology
Quality Liquid Feeds, Inc.
608.935.2345 office
608.341.9896 cell


[web2py] Accept image upload from API or standalone form

2011-11-04 Thread pbreit
I'm trying to figure out how to accept an image upload from a form that was 
not generated by Web2py.

So for example:

http://pb-dev.pricetack.com:8001/mobilepost>






How do I process the image?


[web2py] we need some good web2py quotes ....

2011-11-04 Thread Massimo Di Pierro
more or less as long as this one:

"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla"

if it looks good but not cheesy we will use for the web2py.com site.


[web2py] Re: Accept image upload from API or standalone form

2011-11-04 Thread Anthony
Wouldn't request.vars.image.file be the file object and 
request.vars.file.filename the name?

On Friday, November 4, 2011 7:02:30 PM UTC-4, pbreit wrote:
>
> I'm trying to figure out how to accept an image upload from a form that 
> was not generated by Web2py.
>
> So for example:
>
> http://pb-dev.pricetack.com:8001/mobilepost>
> 
> 
> 
> 
> 
>
> How do I process the image?
>


[web2py] Re: Accept image upload from API or standalone form

2011-11-04 Thread pbreit
The error says "image" does not have an attribute "file":

image = db.item.image.store(request.vars.image.file, 
request.vars.image.filename)
AttributeError: 'str' object has no attribute 'file'

Am I doing it right? Do I need to use FORM() or SQLFORM.factory()?


[web2py] Re: Accept image upload from API or standalone form

2011-11-04 Thread pbreit
This seems to work:

http://pb-dev.pricetack.com:8001/mobilepost/index3"; 
enctype="multipart/form-data" method="post">








def index3():
form = SQLFORM.factory(
Field('title'),
Field('price'),
Field('image', 'upload', 
uploadfolder=request.folder+'static/uploads'))
if form.accepts(request.vars):
title = form.vars.title
start_price = form.vars.price
price_change = float(form.vars.price)*0.1
drops = 4
duration = 7
image = db.item.image.store(request.vars.image.file, 
request.vars.image.filename)
db.item.insert(title=title, start_price=start_price, 
price_change=price_change,
drops=drops, duration=duration, image=image)
return 'ok'
elif form.errors:
response.flash = 'form has errors'
return dict(form=form)


[web2py] Re: Accept image upload from API or standalone form

2011-11-04 Thread Massimo Di Pierro
The problem was that you need this to upload images

< form  enctype="multipart/form-data" method="post">

On Nov 4, 7:28 pm, pbreit  wrote:
> This seems to work:
>
> http://pb-dev.pricetack.com:8001/mobilepost/index3";
> enctype="multipart/form-data" method="post">
> 
> 
> 
> 
> 
> 
>
> def index3():
>     form = SQLFORM.factory(
>         Field('title'),
>         Field('price'),
>         Field('image', 'upload',
> uploadfolder=request.folder+'static/uploads'))
>     if form.accepts(request.vars):
>         title = form.vars.title
>         start_price = form.vars.price
>         price_change = float(form.vars.price)*0.1
>         drops = 4
>         duration = 7
>         image = db.item.image.store(request.vars.image.file,
> request.vars.image.filename)
>         db.item.insert(title=title, start_price=start_price,
> price_change=price_change,
>             drops=drops, duration=duration, image=image)
>         return 'ok'
>     elif form.errors:
>         response.flash = 'form has errors'
>     return dict(form=form)


[web2py] Re: SQLFORM.smartgrid query/search don't work for related tables

2011-11-04 Thread Massimo Di Pierro
Can you post your code? I cannot reproduce your problem. Which web2py
version?

On Nov 4, 4:26 pm, Jim Steil  wrote:
> Hi
>
> Testing some stuff with SQLFORM.smartgrid.  When using the query/search
> on a related table, the query doesn't present any fields in the dropdown
> list and no matter what I put in the search field, it returns 'Invalid
> query'.
>
> Is anyone else seeing this problem as well?
>
>      -Jim
>
> --
> Jim Steil
> VP of Information Technology
> Quality Liquid Feeds, Inc.
> 608.935.2345 office
> 608.341.9896 cell


[web2py] Re: error when upgraded to v1.99

2011-11-04 Thread Massimo Di Pierro
This is not a web2py error. You are declaring

Field('user', gae.UserProperty()),

what are you putting into this field? You seem to be re-implementing a
lot of the auth logic yourself.



On Nov 3, 10:07 pm, Richard Baron Penman  wrote:
> from trunk, now a different error:
>
> Traceback (most recent call last):
>   File "/web2py/helpdesk/gluon/restricted.py", line 204, in restricted
>     exec ccode in environment
>   File "/web2py/helpdesk/applications/helpdesk/controllers/default.py:index",
> line 11, in 
>   File "applications/helpdesk/modules/auth.py", line 109, in __call__
>     user_profile = UserProfile.get_or_create_from_session()
>   File "/web2py/helpdesk/applications/helpdesk/models/dbowrappers.py",
> line 234, in get_or_create_from_session
>     return cls.from_session() or cls.create_admin()
>   File "/web2py/helpdesk/applications/helpdesk/models/dbowrappers.py",
> line 226, in create_admin
>     id = cls.db.user_profile.insert(**data)
>   File "/web2py/helpdesk/gluon/dal.py", line 5063, in insert
>     return self._db._adapter.insert(self,self._listify(fields))
>   File "/web2py/helpdesk/gluon/dal.py", line 3464, in insert
>     tmp = table._tableobj(**dfields)
>   File "/google_appengine/google/appengine/ext/db/__init__.py", line
> 945, in __init__
>     prop.__set__(self, value)
>   File "/google_appengine/google/appengine/ext/db/__init__.py", line
> 599, in __set__
>     value = self.validate(value)
>   File "/google_appengine/google/appengine/ext/db/__init__.py", line
> 3269, in validate
>     raise BadValueError('Property %s must be a User' % self.name)
> BadValueError: Property user must be a User
>
> On Fri, Nov 4, 2011 at 10:14 AM, Massimo Di Pierro
>
>
>
>
>
>
>
>  wrote:
> > Try the latest trunk.
>
> > On Nov 3, 6:53 pm, Plumo  wrote:
> >> db.define_table('user_profile',
> >>     Field('name'),
> >>     Field('user', gae.UserProperty()),
> >>     Field('email'),
> >>     Field('active', 'boolean'),
> >>     Field('role_worker', 'boolean'),
> >>     Field('role_facilitator', 'boolean'),
> >>     Field('role_admin', 'boolean'),
> >> )


Re: [web2py] Re: error when upgraded to v1.99

2011-11-04 Thread Richard Baron Penman
Yes the app uses a customized auth.
That user field stores google accounts:

from google.appengine.api import users
google_user = users.get_current_user()

The error is raised from GAE but doesn't happen when I use the same
version of GAE with an older version of web2py.
Do you know what might have changed in web2py to break it?

Richard


On Sat, Nov 5, 2011 at 12:41 PM, Massimo Di Pierro
 wrote:
> This is not a web2py error. You are declaring
>
> Field('user', gae.UserProperty()),
>
> what are you putting into this field? You seem to be re-implementing a
> lot of the auth logic yourself.
>
>
>
> On Nov 3, 10:07 pm, Richard Baron Penman  wrote:
>> from trunk, now a different error:
>>
>> Traceback (most recent call last):
>>   File "/web2py/helpdesk/gluon/restricted.py", line 204, in restricted
>>     exec ccode in environment
>>   File "/web2py/helpdesk/applications/helpdesk/controllers/default.py:index",
>> line 11, in 
>>   File "applications/helpdesk/modules/auth.py", line 109, in __call__
>>     user_profile = UserProfile.get_or_create_from_session()
>>   File "/web2py/helpdesk/applications/helpdesk/models/dbowrappers.py",
>> line 234, in get_or_create_from_session
>>     return cls.from_session() or cls.create_admin()
>>   File "/web2py/helpdesk/applications/helpdesk/models/dbowrappers.py",
>> line 226, in create_admin
>>     id = cls.db.user_profile.insert(**data)
>>   File "/web2py/helpdesk/gluon/dal.py", line 5063, in insert
>>     return self._db._adapter.insert(self,self._listify(fields))
>>   File "/web2py/helpdesk/gluon/dal.py", line 3464, in insert
>>     tmp = table._tableobj(**dfields)
>>   File "/google_appengine/google/appengine/ext/db/__init__.py", line
>> 945, in __init__
>>     prop.__set__(self, value)
>>   File "/google_appengine/google/appengine/ext/db/__init__.py", line
>> 599, in __set__
>>     value = self.validate(value)
>>   File "/google_appengine/google/appengine/ext/db/__init__.py", line
>> 3269, in validate
>>     raise BadValueError('Property %s must be a User' % self.name)
>> BadValueError: Property user must be a User
>>
>> On Fri, Nov 4, 2011 at 10:14 AM, Massimo Di Pierro
>>
>>
>>
>>
>>
>>
>>
>>  wrote:
>> > Try the latest trunk.
>>
>> > On Nov 3, 6:53 pm, Plumo  wrote:
>> >> db.define_table('user_profile',
>> >>     Field('name'),
>> >>     Field('user', gae.UserProperty()),
>> >>     Field('email'),
>> >>     Field('active', 'boolean'),
>> >>     Field('role_worker', 'boolean'),
>> >>     Field('role_facilitator', 'boolean'),
>> >>     Field('role_admin', 'boolean'),
>> >> )


[web2py] login weirdness and login_next

2011-11-04 Thread lucas
hello one and all,

hopefully this is simple.  i read a few of the previous posts
concerning login_next and i believe my weirdness is much more simple.

i did a lot of work with downloading.  and now when a user logs in, it
immediately comes up with a "Open File..." dialog box where you can
chose to open the downloaded file or save it to disk.  this is not
what i want to happen after a user logs in.

so i set

auth.settings.login_next = URL("index")

thinking it was going to keep the open file dialog from popping up.
but it didn't.  please suggest.  thank you in advance and have a great
day.  lucas


[web2py] Re: we need some good web2py quotes ....

2011-11-04 Thread Gour
On Fri, 4 Nov 2011 16:08:33 -0700 (PDT)
Massimo Di Pierro
 wrote:

> more or less as long as this one:
> 
> "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla"


me: web development? me? are you kidding?
web2py: no install, no config files, just unpack.
me: hmm.
web2py: comprehensive docs, easy deployment.
me: hmm, interesting...what's included?
web2py: multiple DBs, DAL, secure, SSL server, templates...
me: heh, but what's missing?
web2py: fun - that's your part!!!
me (convinced): it's good and it's true


Sincerely,
Gour

-- 
In this endeavor there is no loss or diminution, 
and a little advancement on this path can protect 
one from the most dangerous type of fear.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature