From 43e5ef49b12ccba2c43ea003316a3ff23677fe0f Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 12 May 2008 03:19:20 +0000 Subject: Deprecate the multifile module as per PEP 4. --- Lib/multifile.py | 4 ++++ Lib/test/test_multifile.py | 3 ++- Misc/NEWS | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/multifile.py b/Lib/multifile.py index e82a3fd..35b0200 100644 --- a/Lib/multifile.py +++ b/Lib/multifile.py @@ -26,6 +26,10 @@ it normally attempts in order to make seeks relative to the beginning of the current file part. This may be useful when using MultiFile with a non- seekable stream object. """ +from warnings import warn +warn("the multifile module has been deprecated since Python 2.5", + DeprecationWarning, stacklevel=2) +del warn __all__ = ["MultiFile","Error"] diff --git a/Lib/test/test_multifile.py b/Lib/test/test_multifile.py index 437c394..daf7dde 100644 --- a/Lib/test/test_multifile.py +++ b/Lib/test/test_multifile.py @@ -1,5 +1,6 @@ +from test import test_support import mimetools -import multifile +multifile = test_support.import_module('multifile', deprecated=True) import cStringIO msg = """Mime-Version: 1.0 diff --git a/Misc/NEWS b/Misc/NEWS index a15ebb4..f6a334d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,8 @@ Extension Modules Library ------- +- The multifile module has been deprecated as per PEP 4. + - The SocketServer module has been renamed 'socketserver'. The old name is now deprecated. -- cgit v0.12 Qt s a cross-platform application framework that is used for developing application software that can be run on various software and hardware platforms with little or no change in the underlying codebase, while still being a native application with native capabilities and speed.
summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_script_qscriptcontext.cpp
blob: fd9034e3cd686ddd09992152829cfe2e01267c73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

//! [0]
foo(20.5, "hello", new Object())
//! [0]


//! [1]
QScriptValue Person_prototype_fullName(QScriptContext *context, QScriptEngine *engine)
{
    QScriptValue self = context->thisObject();
    QString result;
    result += self.property("firstName").toString();
    result += QLatin1String(" ");
    result += self.property("lastName").toString();
    return result;
}
//! [1]


//! [2]
QScriptValue myInclude(QScriptContext *ctx, QScriptEngine *eng)
{
    QString fileName = ctx->argument(0).toString();
    QString contents = readTheFile(fileName);
    ctx->setActivationObject(ctx->parentContext()->activationObject());
    ctx->setThisObject(ctx->parentContext()->thisObject());
    return eng->evaluate(contents, fileName);
}
//! [2]