[web2py] Re: update_or_insert error

2014-12-02 Thread T.R.Rajkumar
Thanks Niphlod, I did as you said and it is working nicely. Thank you once 
again for pointing the mistake. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py doesn't retrieve the latest user-memberships from ldap.

2014-12-02 Thread Derek
That seems normal to me. Maybe you'd want to set the session timeout to 1 
day.

On Monday, December 1, 2014 3:23:56 AM UTC-7, Dennis Jacobs wrote:
>
> Hi Guys,
>
> I've a small question regarding the auth-module when using ldap.
> I know that when a user doesn't exist in the web2py tables, web2py will 
> retrieve the user along it's membership into the db upon his first login.
> However i've noticed that web2py doesn't uypdate this info when the user 
> is already known, but the memberships in ldap has been changed.
>
> Is this normal behaviour?
> And are there any known work-around for this?
>
> With kind regards.
> Jacobs Dennis.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Web2py's included connection pooling VS external pooling software

2014-12-02 Thread Michele Comitini
Everything ok with your plan.  One note, instead of playing with the
max-procs in lighttpd you can use the fastcgi server parameters. btw don't
use flup use this:
https://github.com/momyc/gevent-fastcgi
and arrange the num_workers parameter.
to do that differently for each application may end up with one adapter
script for each different application.



2014-12-01 23:33 GMT+01:00 Lisandro Rostagno :

> Thank you very much Niphlod and Michele for your help! Now I have a more
> clear understanding of all this. I understand now why I was seeing 5
> fastcgi processes regardless of the "max-procs" configuration (that was
> because I was using fcgi_fork, and I was actually seeing one process and
> its 5 children).
>
> Michele, abount using pgbouncer when having more clients connections than
> max postgresql connections, I think that's my case (correct me if I'm
> wronk). All the sites I'm hosting are news sites, and ocassionally some of
> them have sudden spikes in traffic. The last time one of the sites
> presented a high peak on traffic, connections reached the postgresql
> max_connections limit and, therefor, **all** the applications started
> throwing intermitent HTTP 500 errors.
>
> So I started my research to see what could I do to **avoid compromising
> some apps when one of them is getting high traffic**. Above all, I want to
> be able to **control "the limits" for every app**. I started setting
> server.kbytes-per-second  and connection.kbytes-per-second for every app.
> However that didn't resolve the problem of high database connection
> requests.
>
> With the last info you gave me, I think now I can achieve my goal "playing
> around" a little with this settings (please correct me if I'm worng):
>
>  - max-procs for the fastcgi of every app: I could set it to 1 for apps
> with lower traffic, and set it to a higher value for apps with higher
> traffic (of course, always checking stats to see what happens).
>
>  - pool_size pgbouncer parameter: I mean modifying this value for every
> database, using a larger pool for apps with higher traffic, and viceversa.
> The cool stuff here is that with pgbouncer I can check stats of clients,
> pools, etc. My goal here is to set a limit for an app, and if a new
> connection is requested but the pool is full, the client keeps waiting
> until a connection is freed (no http 500 error).
>
> I'll be trying these changes and I'll be posting here the results.
> As always, any comment is really appreciated. Thank you again for the help!
>
>
>
>
>
>
>
> 2014-12-01 17:56 GMT-03:00 Michele Comitini :
>
>
>> What you have here is lighttpd starting 1 forking flup server.  The
>> important part is this:
>>
>> from flup.server.fcgi_fork import WSGIServer
>>
>> With that you have a python interpreter for each request, up to a
>> maximum.  The default is 5 spare children, the default  maximum is 50.
>> Under lighttpd is also possible to use fcgi_single and "max_procs" = 5
>> with similar results  [I'd expect a slightly bigger memory footprint].
>> Since you have a forking/multiprocess configuration, you need to have a
>> single connection in the web2py connection pool so pool_size=1 is what you
>> need, anything more is just a waste of resources and postgres connections.
>> The max number of open connections should be (max_num_wsgi_proc[flup] *
>> pool_size[web2py DAL]) * (max_procs[lighttpd] * num_applications[lighttpd]).
>>
>> About pgbouncer, IMHO you should use it only if you have n client and m
>> max postgresql connections, and you have n > m.  To speedup things you can
>> use memcache/redis and/or a more complex setup with pgpoolII and multiple
>> postgres backends.
>>
>> 2014-12-01 17:46 GMT+01:00 Lisandro Rostagno 
>> :
>>
>>> Sorry about the delay. I recently installed pgbouncer. I let postgresql
>>> max_connection set to 80, and configure pgbouncer with a max_client_conn of
>>> 1000 and a default_pool_size of 20.
>>> Now when I check pg_stat_activity I can see different amounts of idle
>>> connections per app, more accordingly with that app's traffic. What I mean
>>> is that I can see more connections for the apps with higher volumes of
>>> traffic and less connections for the apps with lower volumes of traffic.
>>>
>>> What I still don't understand is the "max_connections" setting of
>>> postgresql  vs the "max_client_conn" of pgbouncer. For what I've read in
>>> [1] and [2] it's ok to set those variables for example in the way I did,
>>> leting postgresql max_connections in an appropiated value (in my case,
>>> using pgtune, 80 max_connections) and using a high value for
>>> "max_client_conn" on pgbouncer configuration.
>>>
>>> What isnt' clear to me is: what will happen when one of the apps has
>>> more than 20 active connections to pgbouncer and requests keep coming in?
>>> The ideal (for me, in this case) would be that next requests just stay
>>> waiting (browser saying "waiting for domain.com").
>>>
>>>
>>> In the other hand, related to Michele comment, right n

Re: [web2py] Form input show decimal fields with 4 decimals? (How to format input field in forms?)

2014-12-02 Thread Richard Vézina
Hello Tom,

The validator don't determine the number of places you want base on your
decimal field definition, you have to specified it in the validator :
IS_DECIMAL_IN_RANGE(0., ., dot=',')

Notice you have only 2 places in your decimal definition field model!!

Richard

On Sat, Nov 29, 2014 at 11:58 AM, Tom Øyvind Hogstad <
tom.oyvind.hogs...@gmail.com> wrote:

> I have the following field declaration
>
> Field('test_BOF', 'decimal(10,2)',
> label='BOF (mg/l)',
> requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(dot=','))
>
> In a SQLFORM this vil output as a number with a for numbered fraction e.g.
> 12,3000
>
>  "text" value="12,3000">
>
> How can i format this value?
>
> Web2Py: 2.9.11
> DB: PostgreSQL 9.3
>
> Tom Ø.
>
>
> (BTW maybe w2p should detect the requested number of decimals from the field 
> type in this case?)
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: update_or_insert error

2014-12-02 Thread Niphlod


On Tuesday, December 2, 2014 6:19:23 PM UTC+1, Nico de Groot wrote:
>
> The function _update_or_insert(... returns the sql that is generated.


@nico: unfortunately there isn't (it's a two-step phase that isn't resolved 
to a single SQL statement) 

however, it made me spot the actual error in the posted code
@TR:
the update_or_insert "pseudo-code" is

db.table.update_or_insert(condition, field1=value1,field2=value2, etc)

where condition is a Query, you're instead passing a Set

to sum up...
db.table.update_or_insert(db.table.field1 == value1, 
field1=value1,field2=value2, etc)
or, with "multiple conditions"
db.table.update_or_insert((db.table.field1 == value1) & (db.table.field2 == 
value2), field1=value1,field2=value2, etc)
you're using instead
db.table.update_or_insert(db((db.table.field1 == value1) & (db.table.field2 
== value2)), field1=value1,field2=value2, etc)

the red part is not allowed

BTW: read that kind of code sucks. Python (and DAL) is coded to be easy to 
read. just refactoring as

tb = db.cms_meas_details

cond = (tb.agt_no==session.agt_no) & 
   (tb.jcod==session.jcod) & 
   (tb.meas_date==session.meas_date) & 
   (tb.shift==session.shift) & 
   (tb.line_no==j)


tb.update_or_insert(cond,
meas_id=m_id,
agt_no=session.agt_no,
jcod=session.jcod,
meas_date=session.meas_date,
shift=session.shift,
loc_of_work=form.vars['txt%s%s' % (i,1)],
m_no=form.vars['txt%s%s' %(i,2)],
m_times=form.vars['txt%s%s' %(i,3)],
m_length=form.vars['txt%s%s' %(i,4)],
m_breadth=form.vars['txt%s%s' %(i,5)],
m_depth=form.vars['txt%s%s' %(i,6)],
mat_code=form.vars['cmbMat%s%s' %(1,7)],
unit_weight=form.vars['txt%s%s' %(i,8)],
m_content=form.vars['txt%s%s' %(i,9)],
remarks=form.vars['txt%s%s' %(i,10)],
update_uid="e34789",
update_dt=request.now,
line_no=j
)


takes just a little bit of time but it'll be much easier to read and to 
spot errors in the future

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Hardcoded Drop Down Menu In Form

2014-12-02 Thread Pablo Cruise
Thanks TR.  That worked great!

On Wed, Nov 26, 2014 at 1:08 AM, T.R.Rajkumar 
wrote:

> Its not INPUT. Its SELECT. See the code below.
> def get_shifts():
> return ["1","2","3","G"]
>
>
> shifts = get_shifts()
>
> form = FORM(TABLE(
>   TR('AgtNo:',SELECT(_name='cmbAgtNo',_id='cmbAgtNo',
> requires=IS_NOT_EMPTY(),*[OPTION(str(x.agt_no) + x.work_desc,_value=x.id)
> for x in agts] )),
>   TR('Jcod:',SELECT(_name='cmbJcod', _id='cmbJcod',
> requires=IS_NOT_EMPTY(), *[OPTION(x.jcod + '|' + x.job_desc, _value=x.jcod
> ) for x in jobs])),
>   TR('MeasDate:',INPUT(_type='text', _name=
> 'txtMeasDate',_id='txtMeasDate', _class='date', requires=IS_NOT_EMPTY()
> )),
>   TR('Shift:',*SELECT*(_name='cmbShift', _id=
> 'cmbShift', requires=IS_NOT_EMPTY(),*[OPTION(x,_value=x) for x in shifts
> ])),
>   TR('',INPUT(_type='submit',_value='CreateMeas'))
>   ))re...
>
>
>
> On Wednesday, November 26, 2014 5:17:13 AM UTC+5:30, Pablo Cruise wrote:
>>
>> I'm a novice Web2py programmer and I've searched the net but can't figure
>> this out.
>>
>> I've got a simple webpage with this form:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *form = FORM(TABLE(TR(TH('BEG PLAN START DATE'),
>> INPUT(_name='begpstrtdt', _class='date', requires=IS_DATE(), _value=t0,
>> _style="width: 100px;")),(TH('END PLAN START DATE'),
>> INPUT(_name='endpstrtdt', _class='date', requires=IS_DATE(), _value=t0,
>> _style="width: 100px;")),TR('Group',INPUT(_name='group',
>> _id='group', , requires=IS_IN_SET(['YES', 'NO']))),
>> TR('Email Results?',INPUT(_name='emailflg', _id='emailflg',
>> _type='checkbox', _value='0')),TR('Show
>> Query?',INPUT(_name='qryflg', _id='qryflg', _type='checkbox', _value='1',
>> _checked="checked",
>> _onclick="if(jQuery('#qryflg').prop('checked')) jQuery('#qryinfo').show();
>> else jQuery('#qryinfo').hide();")),  TR('Show
>> Debug?',INPUT(_name='dbgflg', _id='dbgflg', _type='checkbox', _value='1',
>> _checked="checked",
>> _onclick="if(jQuery('#dbgflg').prop('checked')) jQuery('#dbginfo').show();
>> else jQuery('#dbginfo').hide();")),
>> TR(INPUT(_type='submit',_value='Submit'))))*
>>
>>
>> Everything works except I can't get the Group dropdown, 3rd element, to
>> be a dropdown menu.  It shows up as a text field.
>>
>> 1. Is there an attribute I'm missing in the description?
>> 2. How would I get the selected value?
>>
>> I've seen many example using SQLFORM but I don't have a need for these
>> fields to be saved or retrieved to/from a database.
>>
>> Thanks,
>> Paul
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/4FFlABaDmQ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Hardcoded Drop Down Menu In Form

2014-12-02 Thread Pablo Cruise
Thanks Johann. I need to take some time and fully read and analyze the
Web2py book.  I'll try SQLFORM on a future form.

On Tue, Nov 25, 2014 at 10:26 PM, Johann Spies 
wrote:

> On 26 November 2014 at 01:47, Pablo Cruise  wrote:
>
>> I'm a novice Web2py programmer and I've searched the net but can't figure
>> this out.
>>
>
>
> I've seen many example using SQLFORM but I don't have a need for these
>> fields to be saved or retrieved to/from a database.
>>
>>
> Why don't you use SQLFORM.factory?
>
> A quote from the web2py-book:
>
>
> *There are cases when you want to generate forms as if you had a database
> table but you do not want the database table. You simply want to take
> advantage of the SQLFORM capability to generate a nice looking CSS-friendly
> form and perhaps perform file upload and renaming.*
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/4FFlABaDmQ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Not in touch with web2py community for a while. anything new interesting?

2014-12-02 Thread Derek

>What are the most actively maintainted web2py community projects ? 
(Plug-ins?, CMS ? , Blogs?)


Regarding the 'most actively maintained community projects' I don't really 
see much of that. Most projects that I see are usually a one man project 
that is thrown up on the web when done and not really maintained at all. 
That's probably because there is no need to modify something that is 
working since there is backward compatibility.
 

> We are planning to build a community platform , with some blog features 
> and comment system.
>
> So , is there any plugin for that now? or we need to develop from scratch?
>

Movuca? 
 

>
> Past 2 years I've been building SIngle page , Desktop APPs using web2py + 
> qooxdoo. So my team is missing a bit on normal Web things.
>
> Thanks!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Not in touch with web2py community for a while. anything new interesting?

2014-12-02 Thread Derek
Hmm, what's changed in the last two years? It looks like the community has 
grown a lot, we have CI with travis, more compatibility with pypy and 
ironpython... better sql server support. geolocation integration, 
authentication plugins, modular architecture, lazy tables... what else?

On Tuesday, December 2, 2014 11:07:48 AM UTC-7, Phyo Arkar wrote:
>
> Being busy and i lost touch with w2p community for a while.
>
> What are the new features of web2py?
>
> What are the most actively maintainted web2py community projects ? 
> (Plug-ins?, CMS ? , Blogs?)
>
> We are planning to build a community platform , with some blog features 
> and comment system.
>
> So , is there any plugin for that now? or we need to develop from scratch?
>
> Past 2 years I've been building SIngle page , Desktop APPs using web2py + 
> qooxdoo. So my team is missing a bit on normal Web things.
>
> Thanks!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Java Client for web2py SOAP web service

2014-12-02 Thread Dave S


On Tuesday, December 2, 2014 6:45:04 AM UTC-8, Pengfei Yu wrote:
>
> Cool! Thanks very much for sharing, Dave!
>

My pay-forward.  Glad it helped.

/dps
 

>
> On Tuesday, November 25, 2014 2:26:47 PM UTC-5, Dave S wrote:
>>
>>
>>
>> On Monday, November 24, 2014 12:24:25 PM UTC-8, Pengfei Yu wrote:
>>>
>>> Hi Dave, 
>>>
>>> Thanks very much for your reply! Could you give a more detailed example 
>>> for an implementation for Java client? A block of java codes from your Java 
>>> client talking to web2py service will be perfect. Even with the most simple 
>>> example from the web2py's SOAP service document is good enough.
>>>


>> The usage looks something like this:
>> try {
>> String url = "http://"; + ServerIP + "/" +
>> AppID + "/default/call/soap";
>> // Create SOAP Connection
>> SOAPConnectionFactory soapConnectionFactory = 
>> SOAPConnectionFactory.newInstance();
>> SOAPConnection soapConnection = soapConnectionFactory.
>> createConnection();
>>
>> // Send SOAP Message to SOAP Server
>> SOAPMessage soapResponse = soapConnection.call(
>> createSOAPRequest(tdName, tdiskStatus),
>> url);
>>
>> // Process the SOAP Response
>> printSOAPResponse(soapResponse);
>>
>> soapConnection.close();
>> } catch (SOAPException ex) {
>> System.out.println("main: soap " + ex.getMessage());
>> Logger.getLogger(LogTDSClient.class.getName()).log(Level.SEVERE, 
>> null, ex);
>> } catch (UnsupportedOperationException ex) {   
>> System.out.println("main: uns" + ex.getMessage());
>> Logger.getLogger(LogTDSClient.class.getName()).log(Level.SEVERE, 
>> null, ex);
>> } catch (Exception ex) {
>> System.out.println("main: oops  " + ex.getMessage());
>> Logger.getLogger(LogTDSClient.class.getName()).log(Level.SEVERE, 
>> null, ex);
>> }
>>
>>
>>  and the interesting part:
>>
>> private static SOAPMessage createSOAPRequest(String tName, String 
>> tStatus) throws Exception {
>> MessageFactory messageFactory = MessageFactory.newInstance();
>> SOAPMessage soapMessage = messageFactory.createMessage();
>> SOAPPart soapPart = soapMessage.getSOAPPart();
>>
>> String serverURI = "http://your-url:here";;
>> String authHack = "ZGxv-usual-base64stuff";
>>
>> 
>> // SOAP Envelope
>> SOAPEnvelope envelope = soapPart.getEnvelope();
>>// your-url:here corresponds to serverIP above
>> envelope.addNamespaceDeclaration("ns0", 
>> "http://your-url:here/AppID/default/call/soap";);
>> 
>>
>>
>> // SOAP Body
>> SOAPBody soapBody = envelope.getBody();
>> SOAPElement soapBodyElem = soapBody.addChildElement(
>> "YourSoapFunc", "ns0");
>> SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(
>> "YourSoapParam");
>> soapBodyElem1.addTextNode("YourSoapParamString");
>> 
>> 
>> MimeHeaders headers = soapMessage.getMimeHeaders();
>> headers.addHeader("SOAPACTION", "");
>> headers.addHeader("Authorization", "Basic " + authHack);
>> Iterator outHeaders = headers.getAllHeaders();
>> while (false & outHeaders.hasNext()) {
>> MimeHeader outH = (MimeHeader) outHeaders.next();
>> // System.out.println(outH.getName() + " -- " +outH.getValue());
>> }
>>
>> soapMessage.saveChanges();
>>
>> /* Print the request message */
>> if (Boolean.FALSE) {
>> System.out.print("Request SOAP Message = ");
>> soapMessage.writeTo(System.out);
>> System.out.println();
>> }
>>
>> return soapMessage;
>> }
>>
>>
>> It's pretty simple.  You might need to tweak the return value handling, 
>> because that part wasn't very important to my usage.
>>
>> (Grrr -- the GG message editor gets funky when I put in a code block, at 
>> least in this browser.)
>>
>>
>> Good luck.
>>
>> /dps
>>
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Not in touch with web2py community for a while. anything new interesting?

2014-12-02 Thread Phyo Arkar
Being busy and i lost touch with w2p community for a while.

What are the new features of web2py?

What are the most actively maintainted web2py community projects ?
(Plug-ins?, CMS ? , Blogs?)

We are planning to build a community platform , with some blog features and
comment system.

So , is there any plugin for that now? or we need to develop from scratch?

Past 2 years I've been building SIngle page , Desktop APPs using web2py +
qooxdoo. So my team is missing a bit on normal Web things.

Thanks!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Custom validator - pass record id to validator for update operations

2014-12-02 Thread clara
Hello Andrew,

It does make sense!

I was actually passing one of the record fields to my validator instead of 
the record ID I could just have passed the id and then have access to 
any field in the record.

Thanks a lot !

Clara

El lunes, 1 de diciembre de 2014 12:20:11 UTC-3, Andrew Buchan escribió:
>
> Hi Clara,
>
> I think (someone please correct me if I'm wrong -- and have a look at my 
> other question posted just after this :D) that the validator has no access 
> to the record.
>
> But because you can set the validator on a field at any time, one solution 
> is to chang your validator class so it knows about the record id, and only 
> assign the validator to the table's field just before you need to use it in 
> a form, but after you have obtained the record id.
>
> class MY_VALIDATOR(IS_IN_SET):
> 
> def __init__(self, record_id=None):
> self.record_id = record_id
> #whatever your validator does
>
> def __call__(self, value):
> if value == self.self.record_id:
>  #whatever
>
> def some_controller_url():
> record_id = request.vars.record_id
> #Override the validator set in models (if any) with this validator 
> which does have knowledge of the record
> db.my_table._my_field.requires = MY_VALIDATOR(record=record_id)
> form = SQLFORM( db.my_table, record=record_id)
> ...#Table will be built with a validator which knows about your record 
> :)
>  
>
> Does this make sense?
>
>
> On Monday, December 1, 2014 2:49:45 PM UTC, clara wrote:
>>
>> Hello all,
>>
>> I am developing a web2py application and I am writing the logic to 
>> control stock of certain items. To that end, I wrote a custom validator 
>> which is working fine when creating new "sale" items. Now the problem 
>> arises when updating these sale items, because I would need to know the 
>> actual record being updated to adjust the logic in this cases.
>>  
>> I could get this information through ._before_update method, but how 
>> would I pass it to the validator ?
>>
>> I am not sure if this is the best way to do it. I will appreciate any 
>> help on this matter!
>>
>> Best regards,
>>
>> Clara
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Write Inline query

2014-12-02 Thread vijay . rajbhar

Hi All,

I really need help with a query?

this is my query:


Select * from Table1 where Column1 not in (Select Column2 from Table2);

How to write Query in Web2py DAL Sql From Grid

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Java Client for web2py SOAP web service

2014-12-02 Thread Pengfei Yu
Cool! Thanks very much for sharing, Dave!

On Tuesday, November 25, 2014 2:26:47 PM UTC-5, Dave S wrote:
>
>
>
> On Monday, November 24, 2014 12:24:25 PM UTC-8, Pengfei Yu wrote:
>>
>> Hi Dave, 
>>
>> Thanks very much for your reply! Could you give a more detailed example 
>> for an implementation for Java client? A block of java codes from your Java 
>> client talking to web2py service will be perfect. Even with the most simple 
>> example from the web2py's SOAP service document is good enough.
>>
>>>
>>>
> The usage looks something like this:
> try {
> String url = "http://"; + ServerIP + "/" +
> AppID + "/default/call/soap";
> // Create SOAP Connection
> SOAPConnectionFactory soapConnectionFactory = 
> SOAPConnectionFactory.newInstance();
> SOAPConnection soapConnection = soapConnectionFactory.
> createConnection();
>
> // Send SOAP Message to SOAP Server
> SOAPMessage soapResponse = soapConnection.call(
> createSOAPRequest(tdName, tdiskStatus),
> url);
>
> // Process the SOAP Response
> printSOAPResponse(soapResponse);
>
> soapConnection.close();
> } catch (SOAPException ex) {
> System.out.println("main: soap " + ex.getMessage());
> Logger.getLogger(LogTDSClient.class.getName()).log(Level.SEVERE, 
> null, ex);
> } catch (UnsupportedOperationException ex) {   
> System.out.println("main: uns" + ex.getMessage());
> Logger.getLogger(LogTDSClient.class.getName()).log(Level.SEVERE, 
> null, ex);
> } catch (Exception ex) {
> System.out.println("main: oops  " + ex.getMessage());
> Logger.getLogger(LogTDSClient.class.getName()).log(Level.SEVERE, 
> null, ex);
> }
>
>
>  and the interesting part:
>
> private static SOAPMessage createSOAPRequest(String tName, String 
> tStatus) throws Exception {
> MessageFactory messageFactory = MessageFactory.newInstance();
> SOAPMessage soapMessage = messageFactory.createMessage();
> SOAPPart soapPart = soapMessage.getSOAPPart();
>
> String serverURI = "http://your-url:here";;
> String authHack = "ZGxv-usual-base64stuff";
>
> 
> // SOAP Envelope
> SOAPEnvelope envelope = soapPart.getEnvelope();
>// your-url:here corresponds to serverIP above
> envelope.addNamespaceDeclaration("ns0", 
> "http://your-url:here/AppID/default/call/soap";);
> 
>
>
> // SOAP Body
> SOAPBody soapBody = envelope.getBody();
> SOAPElement soapBodyElem = soapBody.addChildElement("YourSoapFunc"
> , "ns0");
> SOAPElement soapBodyElem1 = soapBodyElem.addChildElement(
> "YourSoapParam");
> soapBodyElem1.addTextNode("YourSoapParamString");
> 
> 
> MimeHeaders headers = soapMessage.getMimeHeaders();
> headers.addHeader("SOAPACTION", "");
> headers.addHeader("Authorization", "Basic " + authHack);
> Iterator outHeaders = headers.getAllHeaders();
> while (false & outHeaders.hasNext()) {
> MimeHeader outH = (MimeHeader) outHeaders.next();
> // System.out.println(outH.getName() + " -- " +outH.getValue());
> }
>
> soapMessage.saveChanges();
>
> /* Print the request message */
> if (Boolean.FALSE) {
> System.out.print("Request SOAP Message = ");
> soapMessage.writeTo(System.out);
> System.out.println();
> }
>
> return soapMessage;
> }
>
>
> It's pretty simple.  You might need to tweak the return value handling, 
> because that part wasn't very important to my usage.
>
> (Grrr -- the GG message editor gets funky when I put in a code block, at 
> least in this browser.)
>
>
> Good luck.
>
> /dps
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: update_or_insert error

2014-12-02 Thread Nico de Groot
The function _update_or_insert(... returns the sql that is generated.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Dynamic Upload Uploadfolder

2014-12-02 Thread James Burke
Thank you Leonel, great idea.

Although I'll need to use oncreate/onupdate since I'm using a smartgrid

Cheers,

-James

On Tuesday, December 2, 2014 10:28:49 PM UTC+13, Leonel Câmara wrote:
>
> There are lots of ways to do this, the easiest is probably to just define 
> the uploadfolder for the field in the controller for workbench 
> creation/update instead of defining your custom store and retrieve. 
> Something like this:
>
>
> def create_workbench():
> """ Form to create a workbench in a given repository """
> rep = db.repository[request.args(0)]
> if rep is None:
> raise HTTP(404)
> db.workbench.workbench.uploadfolder = rep.directory
> form = SQLFORM(db.workbench)
> if form.process().accepted:
> response.flash = 'Yay'
> elif form.errors:
> response.flash = 'Nay'
>
>
> def update_workbench():
> """ Form to update a workbench """
> wb = db.worbench[request.args(0)]
> db.workbench.workbench.uploadfolder = wb.repository.directory
> form = SQLFORM(db.workbench, wb)
> if form.process().accepted:
> response.flash = 'Yay'
> elif form.errors:
> response.flash = 'Nay'
>
> I haven't tried it, but this should work if you remove your custom store 
> and retrieve.
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Like the 1st example in the web2py book, can I customize my session.counter to count all sessions?

2014-12-02 Thread Richard Vézina
Make a counter table with a column count and update the first row of the
table each time there is an unique IP address every day...

Or you can implement other rule...

In your footer you will display the count

db.counter(1).count  # You select row 1 content that is you count

You update your counter somewhere in a model, I would use db.py for that so
it will be execute each request :

db(db.counter.id == 1).update(count=db.counter(1).count+1)
db.commit()  # Don't forget to commit!!

You can surround your update and commit with logic to just count users
access in different situation, as I say new IP address... You may require
to log IP address for this task...

If you want unique visitor log, there is other tool for the task, like
google analytic or if you want to stay with python and open source Piwik (
http://piwik.org/).

Richard

On Mon, Dec 1, 2014 at 12:30 PM, Gideon George 
wrote:

> Please what I can do if I want to display the number of visits to each page 
> of my site without restricting it to just individual sessions?
>
> Unlike the code below where it displays number of visits for a particular 
> session, I want a situation where by I can put something like this at my 
> footer. "Since December 1, this page has been viewed 12499 times". Please 
> help me with the code if you can, I tried everything possible to no avail.
>
> def index():
> if not session.counter:
> session.counter = 1
> else:
> session.counter += 1
> return dict(message="Hello from MyApp", counter=session.counter)
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLForm.grid ondelete callback is not called from update form

2014-12-02 Thread Anthony

>
> it calls ondelete callback in the grid view after pressing the delete 
> button,
>
when using update form (setting delete checkbox to true), while normally 
> calling it after pressing the delete button in the grid view.
>

I don't quite understand the above sentence. Can you explain exactly when 
the callback is and is not getting called, and when you expect it to be 
called. According to the code, it looks like it should be called when you 
click the delete button in the grid view (assuming a successful delete), 
but not when deleting a record via the update form.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: crash - session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL) on 2.9.11

2014-12-02 Thread Remco Boerma
What solved my issue was registering with copy_reg. 
I store an instance  of my own class in the session, which now brakes 
without a registered reduction function. 
Though the class implements __getstate__ and __setstate__ apparently that 
isn't enough anymore. 
For docs 
checkout https://docs.python.org/2/library/pickle.html#module-pickle 
and https://docs.python.org/2/library/copy_reg.html

Hope this helps. 


Op woensdag 19 november 2014 15:54:13 UTC+1 schreef Edwin van de Ven:
>
>
>
> Op maandag 13 oktober 2014 19:22:57 UTC+2 schreef Dmitry Ermolaev:
>>
>> I del al files in /sessions and update to 2.9.11
>>
>> Traceback (most recent call last):
>>   File "C:\web2py-m\gluon\main.py", line 435, in wsgibase
>> session.connect(request, response)
>>   File "C:\web2py-m\gluon\globals.py", line 931, in connect
>> session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
>> TypeError: 'NoneType' object is not callable
>>
>>
> I'm getting the exact same error after upgrading to 2.9.11. My sessions 
> directory is also empty. Does anyone else experience similar behavior? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: python in javascript extension file (*.js)

2014-12-02 Thread Anthony
You can dynamically create and serve a JS file just like an HTML file, but 
you cannot do so by putting the JS in the /static folder (unless using 
routing to rewrite the URL to point to a web2py controller). Static files 
are served directly without going through the full framework request cycle, 
so there is no opportunity to execute a template.

One approach is to serve the file via a controller (and cache it to avoid 
unnecessarily re-creating the file on every request):

@cache.action(time_expire=60*60*24, cache_model=cache.ram)
def serve_js():
response.view = 'js/%s' % request.args(0)
return dict() 

Then put your JS template in /views/js/, and access it via URL('default', 
'serve_js', args='my_js_file.js').

Another option is to define the Javascript variables to be translated 
outside of the JS file (before the file is loaded). For example, in 
layout.html, you could do something like:


  var days_nonSelectedText = "{{=T('Select days')}}";
  var days_selectAllText = "{{=T('Select all')}}";



And then in your JS file:

$('.multiselectDays').multiselect({
  numberDisplayed: 5,
  nonSelectedText: days_nonSelectText,
  includeSelectAllOption: true,
  selectAllText: days_selectAllText
});

Another option would be to handle the translation via Javascript instead of 
the web2py translator.

Anthony

On Tuesday, December 2, 2014 7:00:41 AM UTC-5, Yebach wrote:
>
> Is it possible to include {{=T()}} in my static js file??
>
> Smth like 
> $('.multiselectDays').multiselect({
> numberDisplayed: 5,
> nonSelectedText: 'Izberite dneve', // {{=T('Select days')}}
> includeSelectAllOption: true,
> selectAllText: 'Izberi vse' //{{=T('Select all')}}
> });
>
> I need it for translation of my bootstrap elements
>
>
>
> On Wednesday, March 12, 2014 2:55:31 PM UTC+1, 黄祥 wrote:
>>
>> thank you so much for your detail explaination, massimo. i've figure it 
>> out why and how it works now.
>> e.g.
>> shortcut.add("Ctrl+F12", function() {
>> window.open("/test/default/index", "_self");
>> });
>>
>> thanks and best regards,
>> stifan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: python in javascript extension file (*.js)

2014-12-02 Thread Yebach
Is it possible to include {{=T()}} in my static js file??

Smth like 
$('.multiselectDays').multiselect({
numberDisplayed: 5,
nonSelectedText: 'Izberite dneve', // {{=T('Select days')}}
includeSelectAllOption: true,
selectAllText: 'Izberi vse' //{{=T('Select all')}}
});

I need it for translation of my bootstrap elements



On Wednesday, March 12, 2014 2:55:31 PM UTC+1, 黄祥 wrote:
>
> thank you so much for your detail explaination, massimo. i've figure it 
> out why and how it works now.
> e.g.
> shortcut.add("Ctrl+F12", function() {
> window.open("/test/default/index", "_self");
> });
>
> thanks and best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Subclassing IS_IN_SET - one piece missing.

2014-12-02 Thread Andrew Buchan
That works perfectly, thanks Niphlod!

On Mon, Dec 1, 2014 at 8:54 PM, Niphlod  wrote:

> why reinventing the wheel ? IS_IN_DB takes a Set...
>
> gr = db.auth_group
> me = db.auth_membership
> us = db.auth_user
>
> theset = db(
>(us.id == me.user_id) &
>(gr.id == me.group_id) &
>(gr.role == 'roletest')
> )
>
> 
> Field('a_field', requires=IS_IN_DB(theset, 'auth_user.id',
> '%(first_name)s - %(last_name)s'))
>
>
>
>
>
> On Monday, December 1, 2014 4:04:32 PM UTC+1, Andrew Buchan wrote:
>>
>> Hi,
>>
>> I wanted to create a validator which creates a dropdown of users in a
>> certain auth group.
>> I figured I could shortcut this by inheriting from IS_IN_SET, see class
>> below.
>> This works fine for SQLFORMS in create mode (drop dow with just what I
>> want to see) and for read-only mode (I see the user name, not the id) , but
>> for a SQLFORM in edit mode which is pointing at an existing record, it
>> doesn't pre-select the entry in the options drop-down.
>>
>> Any ideas on how I go about getting this to work, or is there a simpler
>> solution?
>>
>> If you use this validator in the DAL, you can see the result the admin
>> pages, so you have an easy way to test if you want to play around with it.
>>
>> Thanks,
>>
>> class IS_USER_IN_GROUP(IS_IN_SET):
>> """A validator that can be used like "requires = IS_USER_IN_GROUP()"
>> Provides a drop down of users in that group.
>> """
>> def __init__(self, group_name):
>> keys = []
>> labels = []
>> staff_groups = db((db.auth_user.id==db.auth_membership.user_id)
>> & (db.auth_group.id==db.auth_membership.group_id))
>> rows = staff_groups(db.auth_group.role ==
>> group_name).select(db.auth_user.ALL, orderby=db.auth_user.first_
>> name|db.auth_user.last_name)
>> for user in rows:
>> keys.append(user.id)
>> labels.append('%s %s' % (user.first_name, user.last_name))
>> IS_IN_SET.__init__(self, keys, labels)
>>
>> def formatter(self, user_id):
>> hits = db(db.auth_user.id == user_id).select()
>> if len(hits) == 1:
>> user = hits.first()
>> return '%s %s' % (user.first_name, user.last_name)
>> return ''
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/oTzLZILrg9E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rendering null values in SQLFORM.grid

2014-12-02 Thread Niphlod
why not ? the point here is representing something that isn't there as 
"something else (entirely your choice)" instead of "None". 
The solution IF THE APP DOESN'T CARE is to set a default. 
IF THE APP CARES you still have the represent solution, where you can use 
"whatever you want, we've got it" as like as "." or "go look elsewhere".

On Tuesday, December 2, 2014 10:07:31 AM UTC+1, Yebach wrote:
>
> Since I have time and integer fields I cannot set default to ''. What do 
> you suggest for a solution?
>
>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: SQLFORM.grid extra button

2014-12-02 Thread Niphlod
again. check the *links* argument

On Tuesday, December 2, 2014 10:19:46 AM UTC+1, Yebach wrote:
>
> I need to add button to every row. So besides edit, view,delete, etc I can 
> call another function
>
> 2014-12-02 9:56 GMT+01:00 Niphlod >:
>
>>
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid
>>  
>> use links
>>
>>
>> On Tuesday, December 2, 2014 9:02:15 AM UTC+1, Yebach wrote:
>>>
>>> Hello
>>>
>>> I have a SQLFORM.grid and beside the default buttons  (edit,view, 
>>> delete,...) I would like to add a new one to change a status in my database 
>>> table.
>>>
>>> Any suggestions?
>>>
>>> thank you
>>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/tbdNsZTOLQ8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Lep pozdrav 
>
> Vid Ogris
>
>
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Unable to upload TIFF image files.

2014-12-02 Thread Kiran Subbaraman
According to the code comments: "Supported file formats: BMP, GIF, JPEG, 
PNG."
Take a look at the code here: 
https://github.com/web2py/web2py/blob/7c8d91d4c57bd68c2b70f877eaa8da2b6a99b23b/gluon/validators.py#L3140



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Tue, 02-12-2014 2:42 PM, Prasad Muley wrote:

Hi All,

   I am trying to upload images for "company" table as below:

*models/db.py*

db.define_table('company',
 Field('name', 'text', notnull=True),
 Field('abbrev', 'string', length=32),
 Field('logo', 'upload', uploadfield=True,
requires=IS_IMAGE(extensions=('png', ',jpg', 'tiff', 'gif')),
 Field('timezone', 'string',
requires=IS_IN_SET(all_timezones)),
 Field('url', 'string',
  requires=IS_URL()),
 format='%(name)s')

I got an error as *"Invalid image" *Whenever I tried to upload *tiff 
images.*


How can I upload tiff images?

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to web2py+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Dynamic Upload Uploadfolder

2014-12-02 Thread Leonel Câmara
There are lots of ways to do this, the easiest is probably to just define 
the uploadfolder for the field in the controller for workbench 
creation/update instead of defining your custom store and retrieve. 
Something like this:


def create_workbench():
""" Form to create a workbench in a given repository """
rep = db.repository[request.args(0)]
if rep is None:
raise HTTP(404)
db.workbench.workbench.uploadfolder = rep.directory
form = SQLFORM(db.workbench)
if form.process().accepted:
response.flash = 'Yay'
elif form.errors:
response.flash = 'Nay'


def update_workbench():
""" Form to update a workbench """
wb = db.worbench[request.args(0)]
db.workbench.workbench.uploadfolder = wb.repository.directory
form = SQLFORM(db.workbench, wb)
if form.process().accepted:
response.flash = 'Yay'
elif form.errors:
response.flash = 'Nay'

I haven't tried it, but this should work if you remove your custom store 
and retrieve.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: SQLFORM.grid extra button

2014-12-02 Thread Vid Ogris
I need to add button to every row. So besides edit, view,delete, etc I can
call another function

2014-12-02 9:56 GMT+01:00 Niphlod :

>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid
> use links
>
>
> On Tuesday, December 2, 2014 9:02:15 AM UTC+1, Yebach wrote:
>>
>> Hello
>>
>> I have a SQLFORM.grid and beside the default buttons  (edit,view,
>> delete,...) I would like to add a new one to change a status in my database
>> table.
>>
>> Any suggestions?
>>
>> thank you
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/tbdNsZTOLQ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lep pozdrav

Vid Ogris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Unable to upload TIFF image files.

2014-12-02 Thread Prasad Muley
Hi All,

   I am trying to upload images for "company" table as below:

*models/db.py*

db.define_table('company',
 Field('name', 'text', notnull=True),
 Field('abbrev', 'string', length=32),
 Field('logo', 'upload', uploadfield=True,
  requires=IS_IMAGE(extensions=('png', 
',jpg', 'tiff', 'gif')),
 Field('timezone', 'string',
  requires=IS_IN_SET(all_timezones)),
 Field('url', 'string',
  requires=IS_URL()),
 format='%(name)s')

I got an error as *"Invalid image" *Whenever I tried to upload *tiff 
images.*

How can I upload tiff images?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Rendering null values in SQLFORM.grid

2014-12-02 Thread Yebach
Since I have time and integer fields I cannot set default to ''. What do 
you suggest for a solution?


On Monday, June 10, 2013 5:32:33 PM UTC+2, Niphlod wrote:
>
> The second one you said (i.e. altering the default repr for None values). 
> From a "theoretical" standpoint, a null value is not an empty string. If 
> your app doesn't care for the difference, set a default='' on the 
> interested fields.
>
> Il giorno lunedì 10 giugno 2013 15:42:21 UTC+2, Lamps902 ha scritto:
>>
>> If there's a NULL value in my postgresql DB, SQLFORM.grid renders it as 
>> "None". Is it there something that can be done globally for an SQLFORM.grid 
>> that would simply make it display all NULL values as an empty string (i.e. 
>> not display anything in the grid for NULLs), or does that have to be 
>> determined individually for every field by setting the respective field's 
>> *represent 
>> *parameter? Thanks.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM.grid extra button

2014-12-02 Thread Niphlod
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid 
use links

On Tuesday, December 2, 2014 9:02:15 AM UTC+1, Yebach wrote:
>
> Hello
>
> I have a SQLFORM.grid and beside the default buttons  (edit,view, 
> delete,...) I would like to add a new one to change a status in my database 
> table.
>
> Any suggestions?
>
> thank you
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: long running rpc call

2014-12-02 Thread Leonel Câmara
I'm not sure what you're trying to do, what will associating the httpclient 
to the thread current gain you?  If you don't want to use the scheduler you 
can call json rpc on the client using javascript, that may be good enough.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM.grid extra button

2014-12-02 Thread Yebach
Hello

I have a SQLFORM.grid and beside the default buttons  (edit,view, 
delete,...) I would like to add a new one to change a status in my database 
table.

Any suggestions?

thank you

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.