TurboGears Framework Interview Questions

30+ TOP TurboGears Framework Interview Questions

TurboGears Framework Interview Questions
TurboGears Framework Interview Questions

1) What is TurboGears Framework?
TurboGears is a Python Framework. It is used to create rapid web application. It consists of several WSGI (Web Server Gateway Interface) components. It is developed by Kevin Dangoor in 2005.

2) In which language TurboGears was written?
TurboGears was written in Python programming language.

3) What is MVC (Model View Controller) in TurboGears?
MVC model is a software design pattern. It is used to develop web applications. It consists of three parts:

Model: It is a business entity which is used to represent the application data.
View: It is the presentation layer of MVC.
Controller: Request sent by the user always scatters through controller and its responsibility is to redirect to the specific view using View () method.

4) What is the stable version of TurboGears?
The stable version of TurboGears is 2.3.10 and released on 4 December 2016.

5) What are the latest libraries and tools to built TurboGears?
There are various libraries and tools to built TurboGears that are:

SQLAlchemy
Genshi
ToscaWidgets
Gearbox

6) What is SQLAlchemy in TurboGears?
In TurboGears, SQLAlchemy is an open source SQL kit that provides Object relation mapping (ORM) for Python code.

8) What is the default files installed at the time of project set up?
The following default files are installed at the time of project set up:

Beaker
Genshi
zope.sqlalchemy
sqlalchemy
alembic
repoze.who
tw2.forms
tgext.admin = 0.6.1
WebHelpers2
babel

9) What are the default port supported by TurboGears?
TurboGears supported by default port 8080.

11) What is the use of ToscaWidgets2 and its module?
ToscaWidgets2 is used to define the form field into Python script and render them into a HTML Template.

The following modules are:

tw2.core: It provides core functionality.
tw2.forms: It is a basic forms library that contains widgets for fields, field sets and forms.
tw2.dynforms: It contains dynamic forms functionality.
tw2.sqla: It is an interface for SQLAlchemy database.

12) What are the various validator classes in TuroGears?
There are various validator classes in TurboGears:

Types of Validators Descriptions
LengthValidator It is used to check prescribe length.
RangeValidator It is used to check the range of the field.
IntValidator It is used to validate the integer types data.
OneOfValidator It is used to select a value from the available options in the list only.
DateValidator It avoids the user to input an invalid date.
EmailValidator It avoids the user to input an invalid email.
UrlValidator It validates the user input for a valid URL.
MatchValidator It is used to confirm whether the value of field is matched with the other.

13) What is ORM in TurboGears?
In TurboGears, ORM stands for Object Relational Mapping. It is a technique of mapping object parameter to underlying RDBMS table structure.

14) What are the CRUD Operations Methods in TurboGears?
In TurboGears, The CRUD operation methods are:

DBSession.add(model object): It is used to insert a record into mapped table.
DBSession.delete(model object) : It is used to delete the records from the table.
DBSession.query(model).all(): It is used to retrieve all the records from table.

15) What are Paginations in TurboGears?
TurboGears provides a convenient decorator called paginate(). It is used to divide the output in the pages. The number of records per pages is decided by value of items_per_page attribute.

16) Which template engine is used to construct the front-end of TG application?
Genshi template engine is used to construct the front-end of TG application.

17) Which method is used to map the root of our first application?
Index() method is used to map the root of our first application.

18) Which package is used to create of web widgets directly from the database schema?
Sprox package is used to create of web widgets directly from the database schema.

19) Which database supports TurboGears?
TurboGear supports MongoDB and SQL dbms database.

20) What are the PyMongo tools to work with MongoDB?
There are various PyMongo tools to work with MongoDB that are listed below:

Declarative Models

Schema Validation and Conversion
Schema Evolution
Pure InMemory MongoDB Implementation
Unit of Work
Identity Map
One-To-Many, Many-To-One and Many-To-Many Relations

21) What are the ways to plug behavior inside the existing application in TurboGear?
In TurboGear, there are three ways to plug behavior inside the existing application.

Hook
Controller Wrapper
Application Wrapper

22) Which command is used to create a pluggable application?
The following code is used to create a pluggable application.

gearbox quickstart-pluggable plugtest

23) What is a RestController in TurboGear?
In TurboGear, RestController is a mechanism to access the request’s method like GET, POST, PUTand many more.

24) Which method is used to render the page in TurboGear?
In TurboGear, @expose() decorator method is used to render the [age.

25) What is Kajiki in TurboGear?
In TurboGear, Kajiki provides a XML-based template language. It is inspired by Kid and Genshi.

26) How can we create a Text Field object?
We can create a Text Field object by using following constructor.

twf.TextField(size, value = None)

27) What is the default port of TurboGear?
The default port of TurboGear is 8080.

28) What is Scaffolding?
Scaffolding is the process of creating a new component of our web application through a template or preset.

29) How to create an Extension in TurboGear?
The following code is used to create an Extension in TurboGear.

$ gearbox tgext -n myextension -a “My Name” -e “my@email.com”

30) How to store Flash Message?
The following code is used to store Flash Message.

tg.flash(‘Message’, ‘status’)

31) How to create TurboGear admin?
TurboGear admin is created as object of AdminController class.

Example:

from tgext.admin.controller import AdminController
class RootController(BaseController):
admin = AdminController(model, DBSession, config_type = TGAdminConfig)

32) What is Repoze in TurboGear?
In TurboGear, Repoze is used to handle security (identification and authentication). Users can define authorization rules based on predicates attached to controllers.

Real Time TurboGears Framework Interview Questions