Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2c0dead3
Commit
2c0dead3
authored
Nov 20, 2013
by
Jason Bau
Committed by
Sef Kloninger
Dec 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "experiment for unauthenticated access"
This reverts commit
e987b11d
.
parent
7d277708
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
126 deletions
+0
-126
lms/djangoapps/unauth_experiment/__init__.py
+0
-0
lms/djangoapps/unauth_experiment/middleware.py
+0
-35
lms/djangoapps/unauth_experiment/migrations/0001_initial.py
+0
-35
lms/djangoapps/unauth_experiment/migrations/0002_auto__add_field_anonymoususerexpt_created_datetime__add_field_anonymou.py
+0
-42
lms/djangoapps/unauth_experiment/migrations/__init__.py
+0
-0
lms/djangoapps/unauth_experiment/models.py
+0
-8
lms/envs/common.py
+0
-6
No files found.
lms/djangoapps/unauth_experiment/__init__.py
deleted
100644 → 0
View file @
7d277708
lms/djangoapps/unauth_experiment/middleware.py
deleted
100644 → 0
View file @
7d277708
from
django.utils.crypto
import
get_random_string
from
.models
import
AnonymousUserExpt
from
django.db
import
transaction
from
dogapi
import
dog_stats_api
TEST_COOKIE_NAME
=
"anonUserTest"
def
get_random_anon_username
():
candidate
=
get_random_string
(
64
)
while
AnonymousUserExpt
.
objects
.
filter
(
username
=
candidate
)
.
exists
():
candidate
=
get_random_string
(
64
)
return
candidate
class
ExperimentalUserMiddleware
(
object
):
def
process_request
(
self
,
request
):
# Test if our test anonymous cookie is set
if
not
request
.
COOKIES
.
get
(
TEST_COOKIE_NAME
):
with
dog_stats_api
.
timer
(
'unauth_experiment.middleware.add_new_anon_user'
):
with
transaction
.
commit_on_success
():
anon_username
=
get_random_anon_username
()
anon_user
=
AnonymousUserExpt
(
username
=
anon_username
,
user_agent
=
request
.
META
.
get
(
'HTTP_USER_AGENT'
,
''
))
anon_user
.
save
()
# tag request with the username we set, so the response can set the cookie
request
.
_expt_anon_username
=
anon_username
dog_stats_api
.
increment
(
"unauth_experiment.middleware.new_anon_user"
)
return
None
def
process_response
(
self
,
request
,
response
):
name_to_set
=
getattr
(
request
,
'_expt_anon_username'
,
None
)
if
name_to_set
:
# age is 3 months
response
.
set_cookie
(
TEST_COOKIE_NAME
,
name_to_set
,
max_age
=
7776000
)
return
response
lms/djangoapps/unauth_experiment/migrations/0001_initial.py
deleted
100644 → 0
View file @
7d277708
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding model 'AnonymousUserExpt'
db
.
create_table
(
'unauth_experiment_anonymoususerexpt'
,
(
(
'id'
,
self
.
gf
(
'django.db.models.fields.AutoField'
)(
primary_key
=
True
)),
(
'username'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
db_index
=
True
,
max_length
=
64
,
null
=
True
,
blank
=
True
)),
(
'user_agent'
,
self
.
gf
(
'django.db.models.fields.TextField'
)(
null
=
True
,
blank
=
True
)),
))
db
.
send_create_signal
(
'unauth_experiment'
,
[
'AnonymousUserExpt'
])
def
backwards
(
self
,
orm
):
# Deleting model 'AnonymousUserExpt'
db
.
delete_table
(
'unauth_experiment_anonymoususerexpt'
)
models
=
{
'unauth_experiment.anonymoususerexpt'
:
{
'Meta'
:
{
'object_name'
:
'AnonymousUserExpt'
},
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'user_agent'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'64'
,
'null'
:
'True'
,
'blank'
:
'True'
})
}
}
complete_apps
=
[
'unauth_experiment'
]
\ No newline at end of file
lms/djangoapps/unauth_experiment/migrations/0002_auto__add_field_anonymoususerexpt_created_datetime__add_field_anonymou.py
deleted
100644 → 0
View file @
7d277708
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding field 'AnonymousUserExpt.created_datetime'
db
.
add_column
(
'unauth_experiment_anonymoususerexpt'
,
'created_datetime'
,
self
.
gf
(
'django.db.models.fields.DateTimeField'
)(
auto_now_add
=
True
,
null
=
True
,
blank
=
True
),
keep_default
=
False
)
# Adding field 'AnonymousUserExpt.modified_datetime'
db
.
add_column
(
'unauth_experiment_anonymoususerexpt'
,
'modified_datetime'
,
self
.
gf
(
'django.db.models.fields.DateTimeField'
)(
auto_now
=
True
,
null
=
True
,
blank
=
True
),
keep_default
=
False
)
def
backwards
(
self
,
orm
):
# Deleting field 'AnonymousUserExpt.created_datetime'
db
.
delete_column
(
'unauth_experiment_anonymoususerexpt'
,
'created_datetime'
)
# Deleting field 'AnonymousUserExpt.modified_datetime'
db
.
delete_column
(
'unauth_experiment_anonymoususerexpt'
,
'modified_datetime'
)
models
=
{
'unauth_experiment.anonymoususerexpt'
:
{
'Meta'
:
{
'object_name'
:
'AnonymousUserExpt'
},
'created_datetime'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified_datetime'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now'
:
'True'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'user_agent'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'64'
,
'null'
:
'True'
,
'blank'
:
'True'
})
}
}
complete_apps
=
[
'unauth_experiment'
]
\ No newline at end of file
lms/djangoapps/unauth_experiment/migrations/__init__.py
deleted
100644 → 0
View file @
7d277708
lms/djangoapps/unauth_experiment/models.py
deleted
100644 → 0
View file @
7d277708
from
django.db
import
models
# Create your models here.
class
AnonymousUserExpt
(
models
.
Model
):
username
=
models
.
CharField
(
max_length
=
64
,
db_index
=
True
,
null
=
True
,
blank
=
True
)
user_agent
=
models
.
TextField
(
null
=
True
,
blank
=
True
)
created_datetime
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
)
modified_datetime
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
)
lms/envs/common.py
View file @
2c0dead3
...
@@ -639,9 +639,6 @@ MIDDLEWARE_CLASSES = (
...
@@ -639,9 +639,6 @@ MIDDLEWARE_CLASSES = (
# For A/B testing
# For A/B testing
'waffle.middleware.WaffleMiddleware'
,
'waffle.middleware.WaffleMiddleware'
,
# Experimentation with anonymous users,
'unauth_experiment.middleware.ExperimentalUserMiddleware'
,
)
)
############################### Pipeline #######################################
############################### Pipeline #######################################
...
@@ -1006,9 +1003,6 @@ INSTALLED_APPS = (
...
@@ -1006,9 +1003,6 @@ INSTALLED_APPS = (
# CME Registration
# CME Registration
'cme_registration'
,
'cme_registration'
,
# Experimental
'unauth_experiment'
,
)
)
######################### MARKETING SITE ###############################
######################### MARKETING SITE ###############################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment