def test_get_exception_creating_new_config_property_with_existing_name( self): with self.assertRaisesRegexp( Exception, 'Property with name promo_bar_enabled already exists'): config_domain.ConfigProperty('promo_bar_enabled', 'schema', 'description', 'default_value')
def test_config_property_with_new_config_property_model(self): config_model = config_models.ConfigPropertyModel(id='config_model', value='new_value') config_model.commit(feconf.SYSTEM_COMMITTER_ID, []) retrieved_model = config_domain.ConfigProperty( 'config_model', config_domain.BOOL_SCHEMA, 'description', False) self.assertEqual(retrieved_model.value, 'new_value')
def test_get_exception_creating_new_config_property_with_existing_name( self ) -> None: with self.assertRaisesRegex(# type: ignore[no-untyped-call] Exception, 'Property with name promo_bar_enabled already exists'): config_domain.ConfigProperty( 'promo_bar_enabled', config_domain.BOOL_SCHEMA, 'description', False )
# See the License for the specific language governing permissions and # limitations under the License. """Controllers for simple, mostly-static pages (like About, Forum, etc.).""" import urllib import urlparse from core.controllers import base from core.domain import config_domain import feconf MODERATOR_REQUEST_FORUM_URL_DEFAULT_VALUE = ( 'https://moderator/request/forum/url') ABOUT_PAGE_YOUTUBE_VIDEO_ID = config_domain.ConfigProperty( 'about_page_youtube_video_id', {'type': 'unicode'}, 'The (optional) video id for the About page', default_value='') CONTACT_EMAIL_ADDRESS = config_domain.ConfigProperty( 'contact_email_address', {'type': 'unicode'}, 'The contact email address to display on the About pages', default_value='CONTACT_EMAIL_ADDRESS') EMBEDDED_GOOGLE_GROUP_URL = config_domain.ConfigProperty( 'embedded_google_group_url', {'type': 'unicode'}, 'The URL for the embedded Google Group in the Forum page', default_value=('https://groups.google.com/forum/embed/?place=forum/oppia')) SITE_FORUM_URL = config_domain.ConfigProperty( 'site_forum_url', {'type': 'unicode'}, 'The site forum URL (for links; the Forum page is configured separately)', default_value='https://site/forum/url') MODERATOR_REQUEST_FORUM_URL = config_domain.ConfigProperty( 'moderator_request_forum_url', {'type': 'unicode'},
from core.domain import obj_services from core.domain import rights_manager from core.domain import rte_component_registry from core.domain import user_services from core.platform import models import feconf import jinja_utils import utils current_user_services = models.Registry.import_current_user_services() (user_models, ) = models.Registry.import_models([models.NAMES.user]) ONE_DAY_AGO_IN_SECS = -24 * 60 * 60 DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', {'type': 'unicode'}, 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) SITE_NAME = config_domain.ConfigProperty('site_name', {'type': 'unicode'}, 'The site name', 'SITE_NAME') BEFORE_END_HEAD_TAG_HOOK = config_domain.ConfigProperty( 'before_end_head_tag_hook', { 'type': 'unicode', 'ui_config': { 'rows': 7, }, }, 'Code to insert just before the closing </head> tag in all pages.', '') BEFORE_END_BODY_TAG_HOOK = config_domain.ConfigProperty( 'before_end_body_tag_hook', { 'type': 'unicode', 'ui_config': {
# See the License for the specific language governing permissions and # limitations under the License. """Controllers for simple, mostly-static pages (like About, Forum, etc.).""" __author__ = '[email protected] (Sean Lip)' import urllib import urlparse from core.controllers import base from core.controllers import editor from core.domain import config_domain import feconf ADMIN_EMAIL_ADDRESS = config_domain.ConfigProperty( 'admin_email_address', {'type': 'unicode'}, 'The admin email address to display on the About pages', default_value='ADMIN_EMAIL_ADDRESS') SITE_FORUM_URL = config_domain.ConfigProperty( 'site_forum_url', {'type': 'unicode'}, 'The site forum URL (for links; the Forum page is configured separately)', default_value='https://site/forum/url') SITE_NAME = config_domain.ConfigProperty('site_name', {'type': 'unicode'}, 'The site name', default_value='SITE_NAME') # The id of the exploration for the About page. _ABOUT_EXPLORATION_ID = '14' class AboutPage(base.BaseHandler): """Page with information about Oppia."""
"""Controllers for simple, mostly-static pages (like About, Forum, etc.).""" __author__ = '[email protected] (Sean Lip)' import urllib import urlparse from core.controllers import base from core.controllers import editor from core.domain import config_domain import feconf ABOUT_PAGE_YOUTUBE_VIDEO_ID = config_domain.ConfigProperty( 'about_page_youtube_video_id', {'type': 'unicode'}, 'The (optional) video id for the About page', default_value='') CONTACT_EMAIL_ADDRESS = config_domain.ConfigProperty( 'contact_email_address', {'type': 'unicode'}, 'The contact email address to display on the About pages', default_value='CONTACT_EMAIL_ADDRESS') EMBEDDED_GOOGLE_GROUP_URL = config_domain.ConfigProperty( 'embedded_google_group_url', {'type': 'unicode'}, 'The URL for the embedded Google Group in the Forum page', default_value=( 'https://groups.google.com/forum/embed/?place=forum/oppia')) SITE_FORUM_URL = config_domain.ConfigProperty( 'site_forum_url', {'type': 'unicode'}, 'The site forum URL (for links; the Forum page is configured separately)', default_value='https://site/forum/url')
# distributed under the License is distributed on an "AS-IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Controllers for simple pages.""" __author__ = '[email protected] (Sean Lip)' from core.controllers import base from core.domain import config_domain from core.domain import exp_services import feconf ADMIN_EMAIL_ADDRESS = config_domain.ConfigProperty( 'admin_email_address', 'UnicodeString', 'The admin email address to display on the About pages', default_value='ADMIN_EMAIL_ADDRESS') SITE_FORUM_URL = config_domain.ConfigProperty( 'site_forum_url', 'UnicodeString', 'The site forum URL', default_value='https://site/forum/url') SITE_NAME = config_domain.ConfigProperty('site_name', 'UnicodeString', 'The site name', default_value='SITE_NAME') BANNER_ALT_TEXT = config_domain.ConfigProperty( 'banner_alt_text', 'UnicodeString', 'The alt text for the site banner image',
from core.domain import user_services from core.platform import models current_user_services = models.Registry.import_current_user_services() (user_models, ) = models.Registry.import_models([models.NAMES.user]) import feconf import jinja_utils import utils import jinja2 import webapp2 from google.appengine.api import users DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', {'type': 'unicode'}, 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) BEFORE_END_HEAD_TAG_HOOK = config_domain.ConfigProperty( 'before_end_head_tag_hook', { 'type': 'unicode', 'ui_config': { 'rows': 7, }, }, 'Code to insert just before the closing </head> tag in all pages.', '') BEFORE_END_BODY_TAG_HOOK = config_domain.ConfigProperty( 'before_end_body_tag_hook', { 'type': 'unicode', 'ui_config': { 'rows': 7, },
# See the License for the specific language governing permissions and # limitations under the License. """Controllers for the profile page.""" __author__ = '[email protected] (Stephanie Federwisch)' from core.controllers import base from core.domain import config_domain from core.domain import exp_services from core.domain import user_services import feconf import utils EDITOR_PREREQUISITES_AGREEMENT = config_domain.ConfigProperty( 'editor_prerequisites_agreement', 'UnicodeString', 'The agreement that editors are asked to accept before making any ' 'contributions.', default_value=feconf.DEFAULT_EDITOR_PREREQUISITES_AGREEMENT) class ProfilePage(base.BaseHandler): """The profile page.""" PAGE_NAME_FOR_CSRF = 'profile' @base.require_user def get(self): """Handles GET requests.""" self.values.update({ 'nav_mode': feconf.NAV_MODE_PROFILE, })
import feconf import jinja_utils import utils from google.appengine.api import users import jinja2 import webapp2 app_identity_services = models.Registry.import_app_identity_services() current_user_services = models.Registry.import_current_user_services() (user_models, ) = models.Registry.import_models([models.NAMES.user]) ONE_DAY_AGO_IN_SECS = -24 * 60 * 60 DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', {'type': 'unicode'}, 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) BEFORE_END_HEAD_TAG_HOOK = config_domain.ConfigProperty( 'before_end_head_tag_hook', { 'type': 'unicode', 'ui_config': { 'rows': 7, }, }, 'Code to insert just before the closing </head> tag in all pages.', '') def _clear_login_cookies(response_headers): """Clears login cookies from the given response headers.""" # App Engine sets the ACSID cookie for http:// and the SACSID cookie
from core.domain import exp_domain from core.domain import exp_services from core.domain import rights_manager from core.domain import widget_registry from core.platform import models current_user_services = models.Registry.import_current_user_services() import feconf import jinja2 EXPLORATION_ID_KEY = 'explorationId' ALLOW_YAML_FILE_UPLOAD = config_domain.ConfigProperty( 'allow_yaml_file_upload', 'Boolean', 'Whether to allow file uploads via YAML in the gallery page.', default_value=False) CONTRIBUTE_GALLERY_PAGE_ANNOUNCEMENT = config_domain.ConfigProperty( 'contribute_gallery_page_announcement', 'Html', 'An announcement to display on top of the contribute gallery page.', default_value='') class LearnPage(base.BaseHandler): """The exploration gallery page for learners.""" def get(self): """Handles GET requests.""" self.values.update({
from core.domain import collection_services from core.domain import config_domain from core.domain import exp_domain from core.domain import exp_services from core.domain import feedback_services from core.domain import subscription_services from core.domain import user_jobs_continuous from core.domain import user_services import feconf import utils EXPLORATION_ID_KEY = 'explorationId' COLLECTION_ID_KEY = 'collectionId' ALLOW_YAML_FILE_UPLOAD = config_domain.ConfigProperty( 'allow_yaml_file_upload', {'type': 'bool'}, 'Whether to allow exploration uploads via YAML.', default_value=False) class NotificationsDashboardPage(base.BaseHandler): """Page with notifications for the user.""" @base.require_user def get(self): if self.username in config_domain.BANNED_USERNAMES.value: raise self.UnauthorizedUserException( 'You do not have the credentials to access this page.') elif user_services.has_fully_registered(self.user_id): self.values.update({ 'nav_mode': feconf.NAV_MODE_HOME, })
# See the License for the specific language governing permissions and # limitations under the License. """Controllers for the splash page and user dashboard.""" __author__ = '[email protected] (Sean Lip)' from core.controllers import base from core.controllers import pages from core.domain import config_domain from core.domain import exp_services from core.domain import user_services BANNER_ALT_TEXT = config_domain.ConfigProperty( 'banner_alt_text', 'UnicodeString', 'The alt text for the site banner image', default_value='') SPLASH_PAGE_EXPLORATION_ID = config_domain.ConfigProperty( 'splash_page_exploration_id', 'UnicodeString', ('The id for the exploration on the splash page ' '(a blank value indicates that no exploration should be displayed)'), default_value='') SPLASH_PAGE_EXPLORATION_VERSION = config_domain.ConfigProperty( 'splash_page_exploration_version', 'UnicodeString', ('The version number for the exploration on the splash page ' '(a blank value indicates that the latest version should be used)'), default_value='') class HomePage(base.BaseHandler): """Visited when user visits /.
from core.platform import models import feconf import utils current_user_services = models.Registry.import_current_user_services() SSL_CHALLENGE_RESPONSES = config_domain.ConfigProperty( 'ssl_challenge_responses', { 'type': 'list', 'items': { 'type': 'dict', 'properties': [{ 'name': 'challenge', 'schema': { 'type': 'unicode' } }, { 'name': 'response', 'schema': { 'type': 'unicode' } }] }, }, 'Challenge-response pairs for SSL validation.', []) class AdminPage(base.BaseHandler): """Admin page shown in the App Engine admin console.""" @acl_decorators.can_access_admin_page def get(self):
value_generators_js = '' for _, generator_cls in all_value_generators.iteritems(): value_generators_js += generator_cls.get_js_template() return value_generators_js VALUE_GENERATORS_JS = config_domain.ComputedProperty( 'value_generators_js', 'UnicodeString', 'JavaScript code for the value generators', get_value_generators_js) OBJECT_EDITORS_JS = config_domain.ComputedProperty( 'object_editors_js', 'UnicodeString', 'JavaScript code for the object editors', obj_services.get_all_object_editor_js_templates) EDITOR_PAGE_ANNOUNCEMENT = config_domain.ConfigProperty( 'editor_page_announcement', 'Html', 'A persistent announcement to display on top of all editor pages.', default_value='') MODERATOR_REQUEST_FORUM_URL = config_domain.ConfigProperty( 'moderator_request_forum_url', 'UnicodeString', 'A link to the forum for nominating explorations for release.', default_value='https://moderator/request/forum/url') def _require_valid_version(version_from_payload, exploration_version): """Check that the payload version matches the given exploration version.""" if version_from_payload is None: raise base.BaseHandler.InvalidInputException( 'Invalid POST request: a version must be specified.') if version_from_payload != exploration_version: raise base.BaseHandler.InvalidInputException(
# changed to the desired new state name. NEW_STATE_TEMPLATE = { 'content': [{ 'type': 'text', 'value': '' }], 'interaction': exp_domain.State.NULL_INTERACTION_DICT, 'param_changes': [], 'unresolved_answers': {}, } MODERATOR_REQUEST_FORUM_URL_DEFAULT_VALUE = ( 'https://moderator/request/forum/url') MODERATOR_REQUEST_FORUM_URL = config_domain.ConfigProperty( 'moderator_request_forum_url', {'type': 'unicode'}, 'A link to the forum for nominating explorations to be featured ' 'in the gallery', default_value=MODERATOR_REQUEST_FORUM_URL_DEFAULT_VALUE) DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR = config_domain.ConfigProperty( 'default_twitter_share_message_editor', { 'type': 'unicode', }, 'Default text for the Twitter share message for the editor', default_value=( 'Check out this interactive lesson I created on Oppia - a free ' 'platform for teaching and learning!')) def get_value_generators_js(): """Return a string that concatenates the JS for all value generators.""" all_value_generators = (
from core.domain import config_services from core.domain import rights_manager from core.domain import user_services from core.platform import models current_user_services = models.Registry.import_current_user_services() (user_models, ) = models.Registry.import_models([models.NAMES.user]) import feconf import jinja_utils import utils import jinja2 import webapp2 DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', 'UnicodeString', 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) FULL_SITE_URL = config_domain.ConfigProperty( 'full_site_url', 'UnicodeString', 'The full site URL, without a trailing slash', default_value='https://FULL.SITE/URL') BEFORE_END_HEAD_TAG_HOOK = config_domain.ConfigProperty( 'before_end_head_tag_hook', 'UnicodeString', 'Code to insert just before the closing </head> tag in all pages.', '') def require_user(handler): """Decorator that checks if a user is associated to the current session.""" def test_login(self, **kwargs):
from core.platform import models ( base_models, exp_models, ) = models.Registry.import_models( [models.NAMES.base_model, models.NAMES.exploration]) current_user_services = models.Registry.import_current_user_services() import feconf import utils import jinja2 EXPLORATION_ID_KEY = 'explorationId' ALLOW_YAML_FILE_UPLOAD = config_domain.ConfigProperty( 'allow_yaml_file_upload', {'type': 'bool'}, 'Whether to allow file uploads via YAML in the gallery page.', default_value=False) CAROUSEL_SLIDES_CONFIG = config_domain.ConfigProperty( 'carousel_slides_config', { 'type': 'list', 'items': { 'type': 'dict', 'properties': [{ 'name': 'topic', 'description': 'Topic of the exploration', 'schema': { 'type': 'unicode' }, }, {
from core.domain import user_services from core.platform import models current_user_services = models.Registry.import_current_user_services() (user_models, ) = models.Registry.import_models([models.NAMES.user]) import feconf import jinja_utils import utils import jinja2 import webapp2 from google.appengine.api import users DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', {'type': 'unicode'}, 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) BEFORE_END_HEAD_TAG_HOOK = config_domain.ConfigProperty( 'before_end_head_tag_hook', {'type': 'unicode'}, 'Code to insert just before the closing </head> tag in all pages.', '') OBJECT_EDITORS_JS = config_domain.ComputedProperty( 'object_editors_js', {'type': 'unicode'}, 'JavaScript code for the object editors', obj_services.get_all_object_editor_js_templates) SIDEBAR_MENU_ADDITIONAL_LINKS = config_domain.ConfigProperty( 'sidebar_menu_additional_links', { 'type': 'list', 'items': {
EMAIL_CONTENT_SCHEMA = { 'type': 'dict', 'properties': [{ 'name': 'subject', 'schema': { 'type': 'unicode', }, }, { 'name': 'html_body', 'schema': EMAIL_HTML_BODY_SCHEMA, }], } EMAIL_SENDER_NAME = config_domain.ConfigProperty( 'email_sender_name', {'type': 'unicode'}, 'The default sender name for outgoing emails.', 'Site Admin') EMAIL_FOOTER = config_domain.ConfigProperty( 'email_footer', { 'type': 'unicode', 'ui_config': { 'rows': 5 } }, 'The footer to append to all outgoing emails. (This should be written in ' 'HTML and include an unsubscribe link.)', 'You can change your email preferences via the ' '<a href="https://www.example.com">Preferences</a> page.') _PLACEHOLDER_SUBJECT = 'THIS IS A PLACEHOLDER.' _PLACEHOLDER_HTML_BODY = 'THIS IS A <b>PLACEHOLDER</b> AND SHOULD BE REPLACED.'
'schema': { 'type': 'unicode', }, }, { 'name': 'html_body', 'schema': { 'type': 'unicode', 'ui_config': { 'rows': 20, } } }], } EMAIL_SENDER_NAME = config_domain.ConfigProperty( 'email_sender_name', {'type': 'unicode'}, 'The sender name for outgoing emails.', 'Site Admin') EMAIL_FOOTER = config_domain.ConfigProperty( 'email_footer', { 'type': 'unicode', 'ui_config': { 'rows': 5 } }, 'The footer to append to all outgoing emails. (This should be written in ' 'HTML and include an unsubscribe link.)', 'You can unsubscribe from these emails from the ' '<a href="https://www.example.com">Preferences</a> page.') # NOTE TO DEVELOPERS: post-signup emails will not be sent if this placeholder # is left unmodified. If this policy changes, the deployment instructions at # https://code.google.com/p/oppia/wiki/DeployingOppia should be updated.
# changed to the desired new state name. NEW_STATE_TEMPLATE = { 'content': [{ 'type': 'text', 'value': '' }], 'interaction': exp_domain.State.NULL_INTERACTION_DICT, 'param_changes': [], 'unresolved_answers': {}, } MODERATOR_REQUEST_FORUM_URL_DEFAULT_VALUE = ( 'https://moderator/request/forum/url') MODERATOR_REQUEST_FORUM_URL = config_domain.ConfigProperty( 'moderator_request_forum_url', {'type': 'unicode'}, 'A link to the forum for nominating explorations to be featured ' 'in the gallery', default_value=MODERATOR_REQUEST_FORUM_URL_DEFAULT_VALUE) def get_value_generators_js(): """Return a string that concatenates the JS for all value generators.""" all_value_generators = ( value_generators_domain.Registry.get_all_generator_classes()) value_generators_js = '' for _, generator_cls in all_value_generators.iteritems(): value_generators_js += generator_cls.get_js_template() return value_generators_js def _require_valid_version(version_from_payload, exploration_version):
# See the License for the specific language governing permissions and # limitations under the License. """Controllers for simple, mostly-static pages (like About, Contact, etc.).""" __author__ = '[email protected] (Sean Lip)' from core.controllers import base from core.controllers import editor from core.domain import config_domain from core.domain import exp_services from core.domain import user_services import feconf ADMIN_EMAIL_ADDRESS = config_domain.ConfigProperty( 'admin_email_address', 'UnicodeString', 'The admin email address to display on the About pages', default_value='ADMIN_EMAIL_ADDRESS') SITE_FORUM_URL = config_domain.ConfigProperty( 'site_forum_url', 'UnicodeString', 'The site forum URL', default_value='https://site/forum/url') SITE_NAME = config_domain.ConfigProperty('site_name', 'UnicodeString', 'The site name', default_value='SITE_NAME') class AboutPage(base.BaseHandler): """Page with information about Oppia."""
from core.domain import config_services from core.domain import user_services import feconf import python_utils import utils import backports.functools_lru_cache from typing import Any # pylint: disable=unused-import from typing import Dict # pylint: disable=unused-import from typing import Text # pylint: disable=unused-import import webapp2 ONE_DAY_AGO_IN_SECS = -24 * 60 * 60 DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', {'type': 'unicode'}, 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) # NOTE: These handlers manage user sessions and serve auth pages. Thus, we # should never reject or replace them when running in maintenance mode; # otherwise admins will be unable to access the site. AUTH_HANDLER_PATHS = ( '/csrfhandler', '/login', '/session_begin', '/session_end', ) @backports.functools_lru_cache.lru_cache(maxsize=128) def load_template(filename):
from core.domain import config_services from core.domain import rights_manager from core.domain import rte_component_registry from core.domain import user_services from core.platform import models import feconf import jinja_utils import utils current_user_services = models.Registry.import_current_user_services() (user_models, ) = models.Registry.import_models([models.NAMES.user]) ONE_DAY_AGO_IN_SECS = -24 * 60 * 60 DEFAULT_CSRF_SECRET = 'oppia csrf secret' CSRF_SECRET = config_domain.ConfigProperty( 'oppia_csrf_secret', {'type': 'unicode'}, 'Text used to encrypt CSRF tokens.', DEFAULT_CSRF_SECRET) SITE_NAME = config_domain.ConfigProperty('site_name', {'type': 'unicode'}, 'The site name', 'SITE_NAME') BEFORE_END_HEAD_TAG_HOOK = config_domain.ConfigProperty( 'before_end_head_tag_hook', { 'type': 'unicode', 'ui_config': { 'rows': 7, }, }, 'Code to insert just before the closing </head> tag in all pages.', '') SITE_FEEDBACK_FORM_URL = config_domain.ConfigProperty( 'site_feedback_form_url', {'type': 'unicode'}, 'Site feedback form URL (leave blank if there is no such form)', '')
from core.domain import summary_services from core.domain import user_services from core.platform import models import feconf import utils import jinja2 (stats_models, ) = models.Registry.import_models([models.NAMES.statistics]) MAX_SYSTEM_RECOMMENDATIONS = 4 DEFAULT_TWITTER_SHARE_MESSAGE_PLAYER = config_domain.ConfigProperty( 'default_twitter_share_message_player', { 'type': 'unicode', }, 'Default text for the Twitter share message for the learner view', default_value=( 'Check out this interactive lesson from Oppia - a free, open-source ' 'learning platform!')) def _get_exploration_player_data(exploration_id, version, collection_id, can_edit): """Returns a dict of exploration player data. Args: exploration_id: str. The ID of the exploration. version: int or None. The version of the exploration. collection_id: str. ID of the collection. can_edit: bool. Whether the given user can edit this activity.
import jinja2 SHARING_OPTIONS = config_domain.ConfigProperty( 'sharing_options', { 'type': 'dict', 'properties': [{ 'name': 'gplus', 'schema': { 'type': 'bool', } }, { 'name': 'facebook', 'schema': { 'type': 'bool', } }, { 'name': 'twitter', 'schema': { 'type': 'bool', } }] }, 'Sharing options to display in the learner view', default_value={ 'gplus': False, 'facebook': False, 'twitter': False, }) SHARING_OPTIONS_TWITTER_TEXT = config_domain.ConfigProperty( 'sharing_options_twitter_text', {
# state name and the destination of the default rule should first be # changed to the desired new state name. NEW_STATE_TEMPLATE = { 'classifier_model_id': None, 'content': { 'html': '', 'audio_translations': {}, }, 'interaction': exp_domain.State.NULL_INTERACTION_DICT, 'param_changes': [], } DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR = config_domain.ConfigProperty( 'default_twitter_share_message_editor', { 'type': 'unicode', }, 'Default text for the Twitter share message for the editor', default_value=( 'Check out this interactive lesson I created on Oppia - a free ' 'platform for teaching and learning!')) def get_value_generators_js(): """Return a string that concatenates the JS for all value generators.""" all_value_generators = ( value_generators_domain.Registry.get_all_generator_classes()) value_generators_js = '' for _, generator_cls in all_value_generators.iteritems(): value_generators_js += generator_cls.get_js_template() return value_generators_js
value_generators_js += generator_cls.get_js_template() return value_generators_js VALUE_GENERATORS_JS = config_domain.ComputedProperty( 'value_generators_js', 'UnicodeString', 'JavaScript code for the value generators', get_value_generators_js) OBJECT_EDITORS_JS = config_domain.ComputedProperty( 'object_editors_js', 'UnicodeString', 'JavaScript code for the object editors', obj_services.get_all_object_editor_js_templates) EDITOR_PAGE_ANNOUNCEMENT = config_domain.ConfigProperty( 'editor_page_announcement', 'Html', 'A persistent announcement to display on top of all editor pages.', default_value='') def _require_valid_version(version_from_payload, exploration_version): if version_from_payload is None: raise base.BaseHandler.InvalidInputException( 'Invalid POST request: a version must be specified.') if version_from_payload != exploration_version: raise base.BaseHandler.InvalidInputException( 'Trying to update version %s of exploration from version %s, ' 'which is too old. Please reload the page and try again.' % (exploration_version, version_from_payload))