CN109471802A - A kind of method and device of abnormality processing in Python webpage - Google Patents
A kind of method and device of abnormality processing in Python webpage Download PDFInfo
- Publication number
- CN109471802A CN109471802A CN201811292016.9A CN201811292016A CN109471802A CN 109471802 A CN109471802 A CN 109471802A CN 201811292016 A CN201811292016 A CN 201811292016A CN 109471802 A CN109471802 A CN 109471802A
- Authority
- CN
- China
- Prior art keywords
- exception
- language
- information
- code
- python
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/366—Software debugging using diagnostics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
- G06F9/454—Multi-language systems; Localisation; Internationalisation
Abstract
The invention discloses a kind of methods of the abnormality processing in Python webpage, comprising: after receiving access request, obtains the language message carried in the access request;After obtaining response message, there is abnormal code field in response message as described in determining, exception information corresponding with the exception code predetermined is then obtained, the exception information is translated as by the exception information under corresponding language environment according to the language message, is stored in response contents.
Description
Technical field
The present invention relates to field of computer technology, the method and device of the abnormality processing in espespecially a kind of Python webpage.
Background technique
Python is a coherent and powerful object oriented program language, is had become at present most by joyous
One of programming language met.After 2004, the utilization rate of Python linearly increases.In January, 2011, its quilt
TIOBE programming language ranking list is chosen as 2010 annual language, and also ever more popular, open source cloud operation are Python webpage development at present
System Openstack all uses Python to develop.
Exception refers to the anomalous event occurred in program operation process, usually by external issues (such as hardware error,
Input error) caused by.It is abnormal usually using the capture of try/except sentence, processing in Python.Try/except sentence
For detecting the mistake in try statement block, information and handled so that except sentence be allowed to catch the exception.Current country Python
Web exploitation is relatively weak, lacks unified abnormality processing mode, or lacks internationalization translation, in newly-increased code module or switching
Larger workload is caused when language contexts.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides the methods and dress of the abnormality processing in a kind of Python webpage
It sets, the exception in webpage development is uniformly processed.
In order to reach the object of the invention, the present invention provides a kind of methods of the abnormality processing in Python webpage, comprising:
After receiving access request, the language message carried in the access request is obtained;
After obtaining response message, there is exception code field as determined in the response message, then obtain it is predetermined and
The exception information is translated as under corresponding language environment by the corresponding exception information of the exception code according to the language message
Exception information is stored in response contents.
Further, the access request includes hypertext transfer protocol requests.
Further, there is abnormal code field in the determination response message, then obtain it is predetermined with it is described
The exception information is translated as corresponding to the exception under language environment according to the language message by the corresponding exception information of exception code
Information, being stored in response contents is realized by try/except code block.
The device of abnormality processing in a kind of Python webpage, comprising: memory and processor;Wherein:
The memory, for saving the program for the abnormality processing being used in Python webpage;
The processor executes the program for the abnormality processing in Python webpage for reading, executes as follows
Operation:
After receiving access request, the language message carried in the access request is obtained;
After obtaining response message, there is exception code field as determined in the response message, then obtain it is predetermined and
The exception information is translated as under corresponding language environment by the corresponding exception information of the exception code according to the language message
Exception information is stored in response contents.
Further, the access request includes hypertext transfer protocol requests.
Further, there is abnormal code field in the determination response message, then obtain it is predetermined with it is described
The exception information is translated as corresponding to the exception under language environment according to the language message by the corresponding exception information of exception code
Information, being stored in response contents is realized by try/except code block.
To sum up, the method for the embodiment of the present invention can be uniformly processed exploitation in exception information, can accomplish exception code with
The mapping of error message, and can handle the internationalization translation of exception information, treatment process is transparent to developer.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification
It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right
Specifically noted structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
Attached drawing is used to provide to further understand technical solution of the present invention, and constitutes part of specification, with this
The embodiment of application technical solution for explaining the present invention together, does not constitute the limitation to technical solution of the present invention.
Fig. 1 is the flow chart of the method for the abnormality processing in a kind of Python webpage of the embodiment of the present invention;
Fig. 2 is the schematic diagram of the exception code definition code of the embodiment of the present invention.
Fig. 3 is the schematic diagram of the device of the abnormality processing in a kind of Python webpage of the embodiment of the present invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention
Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application
Feature can mutual any combination.
Step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions
It executes.Also, although logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable
Sequence executes shown or described step.
Fig. 1 is the flow chart of the method for the abnormality processing in a kind of Python webpage of the embodiment of the present invention, such as Fig. 1 institute
Show, the method for the present embodiment includes:
Step 101 after receiving access request, obtains the language message carried in the access request;
After obtaining response message, there is abnormal code field in step 102, then obtain preparatory as described in determining in response message
The exception information is translated as corresponding language according to the language message by the exception information corresponding with the exception code of definition
Exception information under environment, is stored in response contents.
The exception information in exploitation can be uniformly processed in the method for the embodiment of the present invention, can accomplish that exception code and mistake are believed
The mapping of breath, and can handle the internationalization translation of exception information, treatment process is transparent to developer.
The method of the present embodiment has also complied with the internationalization requirement of software, and exception information also carries out internationalization processing, i.e., different
The language environment that the language of normal information is selected with user is consistent.In treatment process, developer need to only follow specific specifications
, do not need individually to be handled, both standardized development mode, and reduce code error probability.
The method of the embodiment of the present invention may include exception code definition, abnormal filter, abnormality code processing three parts.It is different
Normal code defines the mapping relations of determining exception code and exception information, including the translation under multilingual;Abnormal filter is by exception code
Be converted to the exception information of appointed language;Abnormality code processing writes processing abnormal generation using unified standard when writing code
Code.
In the present embodiment, when Python web is developed, HTTP (Hyper Text Transfer Protocol, hypertext
Transport protocol) it requests that filter (filter), as long as being configured with filter, HTTP can be added among arrival background business logic
Request will pass through the filter before returning to client with response before reaching Business Logic.
General WEB exploitation also has other agreements as webservice etc. all referring to based on HTTP request.
In the present embodiment, exception information is defined using unified exception code in advance, and translated for different language.It is abnormal
Code definition includes: to define the type of supporting language;It defines under every kind of language, the mapping relations of error code and error message, it is abnormal
Code definition code is as shown in Figure 2.
In the present embodiment, when front-end module (UI (user interface) layer) sends HTTP request, added in HTTP request head
Language field, interface identification language environment.Response message can be by filter, in the filter judgement response before returning to the end UI
Information whether there is abnormal code field, if there is abnormal code field, then according to language field, is obtained and is corresponded to by exception code
Exception information, exception information is translated as the exception information under corresponding language environment, and be stored in response contents, before return
UI layers of end.
In the present embodiment, code block uses try/except code block, and exception code is then filled up to response when being abnormal
In object.
Fig. 3 is the schematic diagram of the device of the abnormality processing in a kind of Python webpage of the embodiment of the present invention, such as Fig. 3 institute
Show, the device of the present embodiment may include: memory and processor, wherein
The memory, for saving the program for the abnormality processing being used in Python webpage;
The processor executes the program for the abnormality processing in Python webpage for reading, executes as follows
Operation:
After receiving access request, the language message carried in the access request is obtained;
After obtaining response message, there is exception code field as determined in the response message, then obtain it is predetermined and
The exception information is translated as under corresponding language environment by the corresponding exception information of the exception code according to the language message
Exception information is stored in response contents.
Optionally, the access request includes hypertext transfer protocol requests.
Optionally, there is abnormal code field in the determination response message, then obtain it is predetermined with it is described different
The corresponding exception information of normal code believes the exception that the exception information is translated as under corresponding language environment according to the language message
Breath, being stored in response contents is realized by try/except code block.
The device of the present embodiment may be implemented to be uniformly processed the exception in webpage development.In treatment process, developer is only
Specific specifications need to be followed, does not need individually to be handled, has both standardized development mode, and reduce code error probability.
The embodiment of the invention also provides a kind of computer readable storage mediums, are stored with computer executable instructions,
The computer executable instructions are performed the method for realizing the abnormality processing in the Python webpage.
It will appreciated by the skilled person that whole or certain steps, system, dress in method disclosed hereinabove
Functional module/unit in setting may be implemented as software, firmware, hardware and its combination appropriate.In hardware embodiment,
Division between the functional module/unit referred in the above description not necessarily corresponds to the division of physical assemblies;For example, one
Physical assemblies can have multiple functions or a function or step and can be executed by several physical assemblies cooperations.Certain groups
Part or all components may be implemented as by processor, such as the software that digital signal processor or microprocessor execute, or by
It is embodied as hardware, or is implemented as integrated circuit, such as specific integrated circuit.Such software can be distributed in computer-readable
On medium, computer-readable medium may include computer storage medium (or non-transitory medium) and communication media (or temporarily
Property medium).As known to a person of ordinary skill in the art, term computer storage medium is included in for storing information (such as
Computer readable instructions, data structure, program module or other data) any method or technique in the volatibility implemented and non-
Volatibility, removable and nonremovable medium.Computer storage medium include but is not limited to RAM, ROM, EEPROM, flash memory or its
His memory technology, CD-ROM, digital versatile disc (DVD) or other optical disc storages, magnetic holder, tape, disk storage or other
Magnetic memory apparatus or any other medium that can be used for storing desired information and can be accessed by a computer.This
Outside, known to a person of ordinary skill in the art to be, communication media generally comprises computer readable instructions, data structure, program mould
Other data in the modulated data signal of block or such as carrier wave or other transmission mechanisms etc, and may include any information
Delivery media.
Claims (6)
1. a kind of method of the abnormality processing in Python webpage characterized by comprising
After receiving access request, the language message carried in the access request is obtained;
After obtaining response message, if determined in the response message in the presence of exception code field, then obtain it is predetermined with it is described
The exception information is translated as corresponding to the exception under language environment according to the language message by the corresponding exception information of exception code
Information is stored in response contents.
2. the method according to claim 1, wherein
The access request includes hypertext transfer protocol requests.
3. the method according to claim 1, wherein
There is abnormal code field in the determination response message, then obtains predetermined corresponding with the exception code different
The exception information is translated as the exception information under corresponding language environment according to the language message, is stored in sound by normal information
Answer in content is realized by try/except code block.
4. a kind of device of the abnormality processing in Python webpage, comprising: memory and processor;It is characterized by:
The memory, for saving the program for the abnormality processing being used in Python webpage;
The processor executes the program for the abnormality processing in Python webpage for reading, performs the following operations:
After receiving access request, the language message carried in the access request is obtained;
After obtaining response message, if determined in the response message in the presence of exception code field, then obtain it is predetermined with it is described
The exception information is translated as corresponding to the exception under language environment according to the language message by the corresponding exception information of exception code
Information is stored in response contents.
5. device according to claim 4, which is characterized in that
The access request includes hypertext transfer protocol requests.
6. device according to claim 4, which is characterized in that
There is abnormal code field in the determination response message, then obtains predetermined corresponding with the exception code different
The exception information is translated as the exception information under corresponding language environment according to the language message, is stored in sound by normal information
Answer in content is realized by try/except code block.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811292016.9A CN109471802A (en) | 2018-11-01 | 2018-11-01 | A kind of method and device of abnormality processing in Python webpage |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811292016.9A CN109471802A (en) | 2018-11-01 | 2018-11-01 | A kind of method and device of abnormality processing in Python webpage |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109471802A true CN109471802A (en) | 2019-03-15 |
Family
ID=65666900
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811292016.9A Pending CN109471802A (en) | 2018-11-01 | 2018-11-01 | A kind of method and device of abnormality processing in Python webpage |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109471802A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115220722A (en) * | 2022-08-05 | 2022-10-21 | 上海数策软件股份有限公司 | Method, device, equipment and medium for back-end internationalization |
CN117112368A (en) * | 2023-10-18 | 2023-11-24 | 美云智数科技有限公司 | Abnormality processing method, abnormality processing device, electronic equipment and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2005122005A1 (en) * | 2004-06-07 | 2005-12-22 | Impulse Japan Inc. | Web page translation device and web page translation method |
US20090248396A1 (en) * | 2008-03-28 | 2009-10-01 | International Business Machines Corporation | Method for automating an internationalization test in a multilingual web application |
CN102902619A (en) * | 2011-07-29 | 2013-01-30 | 阿里巴巴集团控股有限公司 | Method and device for regression testing of Web application programs |
CN104915204A (en) * | 2015-06-08 | 2015-09-16 | 小米科技有限责任公司 | Web processing method and device |
CN105045707A (en) * | 2015-07-24 | 2015-11-11 | 浪潮电子信息产业股份有限公司 | Python-based server stability test method |
US20160315952A1 (en) * | 2015-04-27 | 2016-10-27 | Cisco Technology, Inc. | Detecting Network Address Translation Devices In A Network Based On Network Traffic Logs |
CN107426233A (en) * | 2017-08-08 | 2017-12-01 | 深圳先进技术研究院 | Data communication system, method, Web server and monitoring system based on B/S frameworks |
US20180307683A1 (en) * | 2017-04-19 | 2018-10-25 | Salesforce.Com, Inc. | Web application localization |
-
2018
- 2018-11-01 CN CN201811292016.9A patent/CN109471802A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2005122005A1 (en) * | 2004-06-07 | 2005-12-22 | Impulse Japan Inc. | Web page translation device and web page translation method |
US20090248396A1 (en) * | 2008-03-28 | 2009-10-01 | International Business Machines Corporation | Method for automating an internationalization test in a multilingual web application |
CN102902619A (en) * | 2011-07-29 | 2013-01-30 | 阿里巴巴集团控股有限公司 | Method and device for regression testing of Web application programs |
US20160315952A1 (en) * | 2015-04-27 | 2016-10-27 | Cisco Technology, Inc. | Detecting Network Address Translation Devices In A Network Based On Network Traffic Logs |
CN104915204A (en) * | 2015-06-08 | 2015-09-16 | 小米科技有限责任公司 | Web processing method and device |
CN105045707A (en) * | 2015-07-24 | 2015-11-11 | 浪潮电子信息产业股份有限公司 | Python-based server stability test method |
US20180307683A1 (en) * | 2017-04-19 | 2018-10-25 | Salesforce.Com, Inc. | Web application localization |
CN107426233A (en) * | 2017-08-08 | 2017-12-01 | 深圳先进技术研究院 | Data communication system, method, Web server and monitoring system based on B/S frameworks |
Non-Patent Citations (1)
Title |
---|
刘丁发等: "《Oracle数据库应用与开发实战 双色》", 31 December 2017, pages: 236 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115220722A (en) * | 2022-08-05 | 2022-10-21 | 上海数策软件股份有限公司 | Method, device, equipment and medium for back-end internationalization |
CN117112368A (en) * | 2023-10-18 | 2023-11-24 | 美云智数科技有限公司 | Abnormality processing method, abnormality processing device, electronic equipment and storage medium |
CN117112368B (en) * | 2023-10-18 | 2024-03-22 | 美云智数科技有限公司 | Abnormality processing method, abnormality processing device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9141444B2 (en) | Inter-application communication on mobile platforms | |
JP5982586B2 (en) | Resource calls for hybrid applications | |
US10824403B2 (en) | Application builder with automated data objects creation | |
US9292253B2 (en) | Methods and apparatus for voiced-enabling a web application | |
EP3273362A1 (en) | Webpage access method, apparatus, device and non-volatile computer storage medium | |
US9781262B2 (en) | Methods and apparatus for voice-enabling a web application | |
US10157612B2 (en) | Methods and apparatus for voice-enabling a web application | |
US20170272337A1 (en) | Updating virtual machine images | |
KR20180008480A (en) | System and method for extracting and sharing application-related user data | |
WO2017053892A1 (en) | Method and apparatus for transferring data between databases | |
US20140040722A1 (en) | Methods and apparatus for voiced-enabling a web application | |
US9038019B2 (en) | Paige control for enterprise mobile applications | |
US9292252B2 (en) | Methods and apparatus for voiced-enabling a web application | |
EP3062238A1 (en) | Summarization by sentence extraction and translation of summaries containing named entities | |
CN113158101A (en) | Visual page rendering method, device, equipment and storage medium | |
US11729248B2 (en) | Web application component migration to a cloud computing system | |
CN109471802A (en) | A kind of method and device of abnormality processing in Python webpage | |
CN112579307A (en) | Physical lock resource allocation detection method and device and electronic equipment | |
US20140189526A1 (en) | Changing log file content generation | |
GB2521637A (en) | Messaging digest | |
US10956239B1 (en) | Utilizing source context and classification in a copy operation | |
US20150261880A1 (en) | Techniques for translating user interfaces of web-based applications | |
US9436669B1 (en) | Systems and methods for interfacing with dynamic web forms | |
US10831590B2 (en) | Error handling | |
US11675584B1 (en) | Visualizing dependent relationships in computer program analysis trace elements |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190315 |