class TestModule1(Module): """this is a test module""" name = "test" defaults = { 'test': 'foo', } routes = [ URL("/", "index", Handler1), URL("/override", "override", Handler2), URL("/config", "config", ConfigHandler), ]
class TestModule2(Module): """this is a test module using a different template folder""" name = "test" defaults = { 'template_folder': 'templates2', 'static_folder': 'static2', 'static_url_path': 'newstatic', 'test': 'foo', } routes = [ URL("/", "index", Handler1), URL("/config", "config", ConfigHandler), ]
class UserbaseTestApp(Application): """base app for testing""" defaults = { 'secret_key': "182827", 'testing': True, 'debug': True, 'secret_key': "f00bar", 'server_name': "127.0.0.1", 'session_cookie_domain': "127.0.0.1", } routes = [URL("/", "root", TestHandler)] modules = [ mail_module(debug=True), username_userbase( url_prefix="/users", login_after_registration=True, double_opt_in=True, enable_registration=True, mongodb_name=DB_NAME, login_success_url_params={'endpoint': 'root'}, logout_success_url_params={'endpoint': 'root'}, ), ]
class API(Application): """a for now simple eschweiler output application""" defaults = { 'mongodb_name' : 'eschweiler', } routes = [ URL("/<city>/meetings", "meetings", meetings.Meetings), # list of the last x meetings by date URL("/<city>/meetings/<mid>", "meeting", meeting.Meeting), # one meetings with all the details URL("/<city>/documents", "documents", documents.Documents), # list of the last x documents by date URL("/<city>/documents/<did>", "document", document.Document), # one document with all the details ] modules = [ mongodb(mongodb_name = "eschweiler"), ]
class ALLRIS(Application): """a for now simple ALLRIS output application""" defaults = { 'mongodb_name': 'ratsinfo', } routes = [ URL("/", "home", handlers.Homepage), URL("/meetings", "meetings", handlers.Meetings), URL("/meetings/<silfdnr>", "meeting", handlers.Meeting), ] modules = [ mongodb(mongodb_name="ratsinfo"), api.api_module(), ]
class MyApplication(Application): """configure our application""" defaults = { 'secret_key' : os.random(20), 'debug' : True, } # links = {} counter = 0 # of course we need some routes routes = [ URL("/", "index", IndexHandler), URL("/shortened", "shorten", ShortenHandler), URL("/<id>", "url", UrlHandler), ]
class ApiModule(Module): """handles everything regarding barcamps""" name = "api" routes = [ #URL("/meetings", "meetings", meetings.Meetings), # list of the last x meetings by date #URL("/meetings/<mid>", "meeting", meeting.Meeting), # one meetings with all the details #URL("/documents", "documents", documents.Documents), # one document with all the details #URL("/documents/<did>", "document", document.Document), # one document with all the details URL("/<city>/meetings", "meetings", meetings.Meetings), # list of the last x meetings by date URL("/<city>/meetings/<mid>", "meeting", meeting.Meeting), # one meetings with all the details URL("/<city>/documents", "documents", documents.Documents), # list of the last x documents by date URL("/<city>/documents/<did>", "document", document.Document), # one document with all the details ]
class TestApplication(Application): """our test application to check configuration""" request_class = TestRequest response_class = TestResponse url_rule_class = URLRuleClass routes = [ URL("/", "index", TestHandler) ] def finalize_response(self, response): """we also test finalize response as well here""" self.test_response = response return response
class TestApplication(Application): error_handlers = { 500: MyErrorHandler, } routes = [ URL("/", "index", TestHandler1), URL("/huhu", "huhu", TestHandler2), URL("/render", "render", RenderHandler), URL("/post/<id>", "post", TestHandler3), URL("/redirect", "redirect", RedirectHandler), URL("/session", "session", SessionHandler), URL("/check_session", "check_session", CheckSessionHandler), URL("/flash", "flash", FlashHandler), URL("/branch/", "branch", FlashHandler), URL("/broken", "broken", BrokenHandler), ] defaults = { 'template_folder' : 'test_templates/', 'debug' : False, 'testing' : True, 'session_cookie_domain' : '', 'server_name' : '', } first_counter = 0 def before_first_request(self, request): self.first_counter = self.first_counter + 1 def finalize_response(self, response): if not isinstance(response, werkzeug.exceptions.HTTPException): response.headers['X-Finalize'] = 1 return response
class ModuleTestApplication1(Application): """app for testing the base module functionality""" routes = [ URL("/", "index", TestHandler1), ] modules = [ test_module(), ] defaults = { 'template_folder' : 'test_templates/', 'debug' : False, 'testing' : True, }
class BlogModule(Module): """handles everything regarding blogposts""" name = "blog" routes = [ URL('/<slug>/blog/admin', 'entries', entries.ListView), URL('/<slug>/blog/new', 'add', add.AddView), URL('/<slug>/blog/<eid>/edit', 'edit', edit.EditView), URL('/<slug>/blog/<eid>/wf', 'wf', workflow.WorkflowView), URL('/<slug>/blog', 'view', view.ListView), URL('/<slug>/blog/<blog_slug>', 'entry', view.ArticleView), ]
class PagesModule(Module): """handles everything regarding pages (for barcamps and global)""" name = "pages" routes = [ # TODO: make global pages work again (really?) #URL('/admin/pages', "admin_pages", handlers.admin.pages.PagesView), #URL('/admin/pages/<slot>/add', 'admin_pages_add', pages.add.AddView), #URL('/s/<page_slug>', 'page', pages.view.View), # pages for barcamps URL('/<slug>/admin/pages', 'barcamp_pages', entries.ListView), URL('/<slug>/page_add/<slot>', 'barcamp_page_add', add.AddView), URL('/<slug>/slug_validate', 'slug_validate', add.SlugValidate, defaults={'page_slug': None}), URL('/<slug>/<page_slug>/slug_validate', 'slug_validate', add.SlugValidate), URL('/<slug>/<page_slug>', 'barcamp_page', view.View), URL('/<slug>/<page_slug>/upload', 'page_image_upload', images.ImageUpload), URL('/<slug>/<page_slug>/layout', 'page_layout', edit.LayoutView), URL('/<slug>/<page_slug>/edit', 'page_edit', edit.EditView), URL('/<slug>/<page_slug>/partial_edit', 'page_edit_partial', edit.PartialEditView), URL('/<slug>/<page_slug>/delete', 'page_image_delete', images.ImageDelete), URL('/<slug>/<page_slug>/image', 'page_image', images.Image), ]
class BarcampModule(Module): """handles everything regarding barcamps""" name = "barcamps" routes = [ URL('/b/setup', 'setup', add.SetupView), URL('/b/add/<paid>', 'add', add.AddView), URL('/b/validate', 'validate', add.ValidateView), URL('/<slug>', 'index_redirect', index.RedirectView), URL('/<slug>/', 'index', index.View), URL('/<slug>/validate', 'validate', add.ValidateView), URL('/<slug>/delete', 'delete', delete.DeleteConfirmView), URL('/<slug>/edit', 'edit', edit.EditView), URL('/<slug>/legaledit', 'legaledit', legaledit.LegalEditView), URL('/<slug>/socialedit', 'socialedit', socialedit.SocialEditView), URL('/<slug>/mails_edit', 'email_template_editor', edit.MailsEditView), URL('/<slug>/newsletter/send', 'newsletter_send', newsletter.NewsletterEditView), URL('/<slug>/newsletter/set_reply', 'nl_set_reply_to', newsletter.NewsletterSetReplyTo), URL('/<slug>/newsletter/verify', 'nl_verify_reply_to', newsletter.NewsletterReplyToConfirm), URL('/<slug>/newsletter/delete', 'nl_delete_reply_to', newsletter.DeleteReplyTo), URL('/<slug>/participants_edit', 'participants_edit', edit.ParticipantsEditView), URL('/<slug>/registration_editor', 'registration_form_editor', customfields.ParticipantsDataEditView), URL('/<slug>/registration.xls', 'registration_data_export', registration.RegistrationDataExport), #URL('/<slug>/sponsors', 'sponsors', index.BarcampSponsors), URL('/<slug>/location', 'location', location.LocationView), URL('/<slug>/planning', 'planning_pad', pads.PlanningPadView), URL('/<slug>/planning/toggle', 'planning_pad_toggle', pads.PadPublicToggleView), URL('/<slug>/docpad', 'documentation_pad', pads.DocumentationPadView), URL('/<slug>/lists', 'userlist', userlist.UserLists), URL('/<slug>/tweetwally', 'tweetwally', tweetwally.TweetWallyView), URL('/<slug>/permissions', 'permissions', permissions.Permissions), URL('/<slug>/permissions/admin', 'admin', permissions.Admin), URL('/<slug>/tos', 'tos', legal.TOSView), URL('/<slug>/cancellation', 'cancellation', legal.CancelView), URL('/<slug>/sessions', 'sessions', sessions.SessionList), URL('/<slug>/sessions.xls', 'session_export', sessions.SessionExport), URL('/<slug>/sessions/<sid>', 'session', sessions.SessionHandler), URL('/<slug>/sessions/<sid>/vote', 'session_vote', sessions.Vote), URL('/<slug>/sessions/<sid>/comments', 'session_comments', sessions.CommentHandler), URL('/<slug>/admin/logo/upload', 'logo_upload', images.LogoUpload), URL('/<slug>/admin/logo/delete', 'logo_delete', images.LogoDelete), URL('/<slug>/logo', 'barcamp_logo', images.Logo), URL('/<slug>/admin/dashboard', 'dashboard', dashboard.DashboardView), URL('/<slug>/admin/sponsors', 'sponsors', sponsors.SponsorsView), URL('/<slug>/admin/sponsors/sort', 'sponsors_sort', sponsors.SponsorsSort), URL('/<slug>/admin/design', 'admin_design', design.DesignView), URL('/<slug>/admin/design/upload', 'admin_design_upload', design.LogoUpload), URL('/<slug>/subscribe', 'subscribe', registration.BarcampSubscribe), URL('/<slug>/register', 'register', registration.BarcampRegister), URL('/<slug>/wizard', 'wizard', registrationwizard.RegistrationWizard), URL('/<slug>/wizard/tologin', 'tologin', registrationwizard.LoginRedirect), URL('/<slug>/validate_email', 'validate_email', registrationwizard.EMailValidation), URL('/<slug>/registration_form', 'registration_form', registration.RegistrationForm), URL('/<slug>/registrationdata', 'registrationdata', registration.RegistrationData), URL('/<slug>/tickets', 'tickets', ticketwizard.TicketWizard), URL('/<slug>/mytickets', 'mytickets', mytickets.MyTickets), URL('/<slug>/mytickets/<ticket_id>/cancel', 'ticketcancel', mytickets.TicketCancel), URL('/<slug>/mytickets/<ticket_id>', 'ticketpdf', mytickets.TicketPDF), URL('/<slug>/admin/galleries', 'admin_galleries', galleries.GalleryList), URL('/<slug>/admin/galleries/<gid>', 'admin_gallery', galleries.GalleryAdminEdit), URL('/<slug>/admin/galleries/<gid>/edit', 'gallery_image_edit', galleries.GalleryImageEdit), URL('/<slug>/admin/galleries/<gid>/title', 'gallery_title_edit', galleries.GalleryTitleEdit), URL('/<slug>/admin/wizard', 'admin_wizard', wizard.BarcampWizard), URL('/<slug>/admin/duplicate', 'admin_duplicate', duplicate.DuplicateBarcamp), URL('/<slug>/admin/tickets', 'admin_ticketeditor', ticketeditor.TicketEditor), URL('/<slug>/admin/tickets/<tc_id>', 'admin_ticketedit', ticketeditor.TicketClassEdit), URL('/<slug>/admin/tickets/config', 'admin_ticketconfig', ticketeditor.TicketingConfig), URL('/<slug>/admin/tickets/users', 'admin_ticketlist', ticketlist.TicketList), URL('/<slug>/admin/tickets/<ticket_id>/cancel', 'admin_ticketcancel', ticketlist.TicketCancel), URL('/<slug>/admin/tickets/<ticket_id>/resend', 'admin_ticketresend', ticketlist.TicketResend), URL('/<slug>/events', 'user_events', user_events.Events), URL('/<slug>/events/<eid>', 'user_event', user_events.Event), URL('/<slug>/events/<eid>/_toggle/<sid>', 'toggle_fav', user_events.ToggleFavSession), URL('/<slug>/events/<eid>/<session_slug>', 'sessionpad', sessionpad.SessionPad), URL('/<slug>/admin/events', 'events', events.EventsView), URL('/<slug>/admin/events/<eid>', 'event', events.EventView), URL('/<slug>/admin/events/<eid>/sessionboard', 'sessionboard', sessionboard.SessionBoard), URL('/<slug>/admin/events/<eid>/sessionboard/data', 'sessionboard_data', sessionboard.SessionBoardData), URL('/<slug>/admin/events/<eid>/sessionboard.pdf', 'sessionboard_print', sessionboard.SessionBoardPrint), URL('/<slug>/admin/events/<eid>/session_per_room.pdf', 'sessions_per_room', sessionboard.PrintSessionsPerRoom), URL('/<slug>/admin/events/<eid>/users', 'event_participants', events.EventParticipants), # TODO: rename this and move this out of events (in base?) URL('/_/admin/getlocation', 'event_location', events.GetLocation ), # not bound to barcamp so it also works in add form ]
class CamperApp(Application): """application""" defaults = { 'hide_from_crawlers': False, 'log_name': "camper", 'script_virtual_host': "http://*****:*****@example.org", 'from_name': "Barcamp-Tool", 'new_bc_notification_addr': None, # which email address to notify about newly created and published barcamps 'sponsor_bc_notification_addr': None, # which email address to notify about sponsorship requests 'ep_api_key': "please fill in from APIKEY.txt", 'ep_endpoint': "http://localhost:9001/api", 'ga': 'none', #GA key 'base_asset_path': '/tmp', # where to store assets 'fb_app_id': 'PLEASE FILL IN', # get this from developers.facebook.com 'log_filename': "/tmp/camper.log", } modules = [ babel_module(locale_selector_func=get_locale, ), userbase.email_userbase( url_prefix="/users", mongodb_name="camper", master_template="master.html", login_after_registration=True, double_opt_in=True, enable_registration=True, enable_usereditor=True, user_class=db.CamperUser, use_remember=True, login_form=login.EMailLoginForm, urls={ 'activation': { 'endpoint': 'activation' }, # we use our own activation handler 'activation_success': { 'endpoint': 'index' }, 'activation_code_sent': { 'endpoint': 'userbase.activate' }, 'login_success': { 'endpoint': 'login_success' }, 'logout_success': { 'endpoint': 'userbase.login' }, 'registration_success': { 'endpoint': 'userbase.login' }, }, messages=AttributeMapper({ 'user_unknown': T('User unknown'), 'email_unknown': T('This email address cannot not be found in our user database' ), 'password_incorrect': T('Your password is not correct'), 'user_not_active': T( 'Your user has not yet been activated.' ), # maybe provide link here? Needs to be constructed in handler 'login_failed': T('Login failed'), 'login_success': T('Welcome, %(fullname)s'), 'logout_success': T('Your are now logged out'), 'double_opt_in_pending': T('To finish the registration process please check your email with instructions on how to activate your account.' ), 'registration_success': T('Your user registration has been successful'), 'activation_success': T('Your account has been activated'), 'activation_failed': T('The activation code is not valid. Please try again or click <a href="%(url)s">here</a> to get a new one.' ), 'activation_code_sent': T('A new activation code has been sent out, please check your email' ), 'already_active': T('The user is already active. Please log in.'), 'pw_code_sent': T('A link to set a new password has been sent to you'), 'pw_changed': T('Your password has been changed'), # for user manager 'user_edited': T('The user has been updated.'), 'user_added': T('The user has been added.'), 'user_deleted': T('The user has been deleted.'), 'user_activated': T('The user has been activated.'), 'user_deactivated': T('The user has been deactivated.'), }), permissions=AttributeMapper({ 'userbase:admin': T("can manage users"), 'admin': T("main administrator"), })), mail_module(debug=True), barcamps.barcamp_module(url_prefix="/"), blog.blog_module(url_prefix="/"), pages.pages_module(url_prefix="/"), ] jinja_filters = { 'nl2br': nl2br, 'currency': do_currency, 'tojson': _tojson_filter, 'md': markdownify, 'textify': textify, } jinja_options = {'autoescape': True} routes = [ URL('/', 'index', handlers.index.IndexView), URL('/past', 'past_barcamps', handlers.index.PastBarcampsView), URL('/own', 'own_barcamps', handlers.index.OwnBarcampsView), URL('/login_success', 'login_success', handlers.index.LoginSuccess), #URL('/robots.txt', 'robots', RobotsTXT), URL('/impressum.html', 'impressum', handlers.index.Impressum), URL('/', 'root', handlers.index.IndexView), URL('/', 'login', handlers.index.IndexView), URL('/assets/', 'asset_upload', handlers.images.AssetUploadView), URL('/assets/<asset_id>', 'asset', handlers.images.AssetView), # sponsoring URL('/sponsoring', 'sponsoring', handlers.sponsor.SponsorContactView), # user stuff URL('/u/<username>', 'profile', handlers.users.profile.ProfileView), URL('/u/image_upload', 'profile_image_upload', handlers.users.ProfileImageAssetUploadView), URL('/u/image_delete', 'profile_image_delete', handlers.users.edit.ProfileImageDeleteView), URL('/u/user_delete', 'user_delete', handlers.users.delete_user.DeleteView), URL('/u/edit', 'profile_edit', handlers.users.edit.ProfileEditView), URL('/u/change_email', 'email_edit', handlers.users.change_email.EMailEditView), URL('/u/confirm_email', 'confirm_email', handlers.users.change_email.ConfirmEMail), URL('/u/activate', 'activation', handlers.users.activation.ActivationHandler), # admin area URL('/admin/', "admin_index", handlers.admin.index.IndexView), ] def finalize_setup(self): """do our own configuration stuff""" self.config.dbs = AttributeMapper() mydb = self.config.dbs.db = pymongo.MongoClient( self.config.mongodb_url)[self.config.mongodb_name] self.config.dbs.barcamps = db.Barcamps(mydb.barcamps, app=self, config=self.config) self.config.dbs.sessions = db.Sessions(mydb.sessions, app=self, config=self.config) self.config.dbs.pages = db.Pages(mydb.pages, app=self, config=self.config) self.config.dbs.blog = db.BlogEntries(mydb.blog, app=self, config=self.config) self.config.dbs.galleries = db.ImageGalleries(mydb.galleries, app=self, config=self.config) self.config.dbs.session_comments = db.Comments(mydb.session_comments, app=self, config=self.config) self.config.dbs.participant_data = db.DataForms(mydb.participant_data, app=self, config=self.config) self.config.dbs.tickets = db.Tickets(mydb.tickets, app=self, config=self.config) self.config.dbs.userfavs = db.UserFavs(mydb.userfavs, app=self, config=self.config) self.module_map.uploader.config.assets = Assets(mydb.assets, app=self, config=self.config) # etherpad connection self.config.etherpad = EtherpadLiteClient( base_params={'apikey': self.config.ep_api_key}, base_url=self.config.ep_endpoint) def finalize_modules(self): """finalize all modules""" fsstore = FilesystemStore(base_path=self.config.base_asset_path) self.modules.append( upload_module( store=fsstore, processors=[ ImageSizeProcessor({ 'thumb': "50x50!", 'small': "100x", 'logo_full': "1140x", 'medium_user': "******", 'userlist': '80x80!', 'fullwidth': "850x", 'gallery': "700x300!", 'facebook': "1200x630", }) ], )) def setup_logger(self): format_string = '[{record.time:%Y-%m-%d %H:%M:%S.%f%z}] {record.level_name} {record.channel} : {record.message} (in {record.filename}:{record.lineno}), args: {record.kwargs})' handler = logbook.FileHandler(self.config.log_filename, format_string=format_string, bubble=True) return logbook.NestedSetup([ handler, ]) def handle_http_exception(self, request, e): """handle http exceptions""" logger = logbook.Logger("error") if e.code != 404: logger.warn("http error", code=e.code, url=request.path) # setup the request properly for handlers to use urls = self.create_url_adapter(request) request.url_adapter = urls # we return a 404 now for every exception which probably is not good handler = NotFound(self, request) resp = handler() resp.status_code = e.code # take code from exception return resp def get_barcamp(self, slug): """return a barcamp by it's slug :param slug: slug of the barcamp to retrieve :returns: barcamp object or """ barcamp = self.config.dbs.barcamps.by_slug(slug) if barcamp is None: raise BarcampNotFound(slug=slug) return barcamp
def finalize(self): """finalize the configuration""" # database setup conn = self.connection = pymongo.MongoClient(self.config.mongodb_url) self.db = conn[self.config.mongodb_name] self.users = self.config.collection_class(self.db[self.config.mongodb_collection]) self.users.SALT = self.config.pw_salt self.users.data_class = self.config.user_class # set the correct (custom) user class for it # URL setup self.add_url_rule(URL("/login", "login", self.config['handler:login'])) self.add_url_rule(URL("/logout", "logout", self.config['handler:logout'])) self.add_url_rule(URL("/pw_forgot", "pw_forgot", self.config['handler:pw_forgot'])) self.add_url_rule(URL("/pw_code_enter", "pw_code_enter", self.config['handler:pw_code_enter'])) self.add_url_rule(URL("/pw_set", "pw_set", self.config['handler:pw_set'])) if self.config.enable_registration: self.add_url_rule(URL("/register", "register", self.config['handler:register'])) if self.config.use_double_opt_in: self.add_url_rule(URL("/activate", "activate", self.config['handler:activate'])) self.add_url_rule(URL("/activation_code", "activation_code", self.config['handler:activation_code'])) if self.config.enable_usereditor: self.add_url_rule(URL("/admin/", "userlist", handlers.UserList)) self.add_url_rule(URL("/admin/new", "useradd", handlers.UserAdd)) self.add_url_rule(URL("/admin/<uid>", "useredit", handlers.UserEdit)) self.add_url_rule(URL("/admin/<uid>/activate", "useractivate", handlers.UserActivate)) # attach the global hooks self.hooks = self.config.hooks(self)
class CamperApp(Application): """application""" defaults = { 'log_name': "camper", 'script_virtual_host': "http://*****:*****@example.org", 'from_name': "Barcamp-Tool", 'ep_api_key': "please fill in from APIKEY.txt", 'ep_endpoint': "http://localhost:9001/api", 'ga': 'none', #GA key 'base_asset_path': '/tmp', # where to store assets 'fb_app_id': 'PLEASE FILL IN', # get this from developers.facebook.com } modules = [ babel_module(locale_selector_func=get_locale, ), userbase.username_userbase( url_prefix="/users", mongodb_name="camper", master_template="master.html", login_after_registration=True, double_opt_in=True, enable_registration=True, enable_usereditor=True, user_class=db.CamperUser, use_remember=True, login_form=login.UsernameLoginForm, urls={ 'activation': { 'endpoint': 'userbase.activate' }, 'activation_success': { 'endpoint': 'index' }, 'activation_code_sent': { 'endpoint': 'userbase.activate' }, 'login_success': { 'endpoint': 'index' }, 'logout_success': { 'endpoint': 'userbase.login' }, 'registration_success': { 'endpoint': 'userbase.login' }, }, messages=AttributeMapper({ 'user_unknown': T('User unknown'), 'email_unknown': T('This email address cannot not be found in our user database' ), 'password_incorrect': T('Your password is not correct'), 'user_not_active': T( 'Your user has not yet been activated.' ), # maybe provide link here? Needs to be constructed in handler 'login_failed': T('Login failed'), 'login_success': T('Welcome, %(fullname)s'), 'logout_success': T('Your are now logged out'), 'double_opt_in_pending': T('To finish the registration process please check your email with instructions on how to activate your account.' ), 'registration_success': T('Your user registration has been successful'), 'activation_success': T('Your account has been activated'), 'activation_failed': T('The activation code is not valid. Please try again or click <a href="%(url)s">here</a> to get a new one.' ), 'activation_code_sent': T('A new activation code has been sent out, please check your email' ), 'already_active': T('The user is already active. Please log in.'), 'pw_code_sent': T('A link to set a new password has been sent to you'), 'pw_changed': T('Your password has been changed'), # for user manager 'user_edited': T('The user has been updated.'), 'user_added': T('The user has been added.'), 'user_deleted': T('The user has been deleted.'), 'user_activated': T('The user has been activated.'), 'user_deactivated': T('The user has been deactivated.'), }), permissions=AttributeMapper({ 'userbase:admin': T("can manage users"), 'admin': T("main administrator"), })), mail_module(debug=True), ] jinja_filters = { 'nl2br': nl2br, 'currency': do_currency, 'tojson': _tojson_filter, 'md': markdownify, } routes = [ URL('/', 'index', handlers.index.IndexView), URL('/impressum.html', 'impressum', handlers.index.Impressum), URL('/', 'root', handlers.index.IndexView), URL('/', 'login', handlers.index.IndexView), URL('/assets/', 'asset_upload', handlers.images.AssetUploadView), URL('/assets/<asset_id>', 'asset', handlers.images.AssetView), # admin area URL('/admin/', "admin_index", handlers.admin.index.IndexView), URL('/admin/pages', "admin_pages", handlers.admin.pages.PagesView), URL('/admin/pages/<slot>/add', 'admin_pages_add', handlers.pages.add.AddView), URL('/s/<page_slug>', 'page', handlers.pages.view.View), # user stuff URL('/u/<username>', 'profile', handlers.users.profile.ProfileView), URL('/u/image_delete', 'profile_image_delete', handlers.users.edit.ProfileImageDeleteView), URL('/u/edit', 'profile_edit', handlers.users.edit.ProfileEditView), # barcamp stuff URL('/b/add', 'barcamp_add', handlers.barcamp.add.AddView), URL('/b/validate', 'barcamp_validate', handlers.barcamp.add.ValidateView, defaults={'slug': None}), URL('/<slug>', 'barcamp', handlers.barcamp.index.View), URL('/<slug>/validate', 'barcamp_validate', handlers.barcamp.add.ValidateView), URL('/<slug>/delete', 'barcamp_delete', handlers.barcamp.delete.DeleteConfirmView), URL('/<slug>/edit', 'barcamp_edit', handlers.barcamp.edit.EditView), URL('/<slug>/participants_edit', 'barcamp_participants_edit', handlers.barcamp.edit.ParticipantsEditView), URL('/<slug>/sponsors', 'barcamp_sponsors', handlers.barcamp.index.BarcampSponsors), URL('/<slug>/location', 'barcamp_location', handlers.barcamp.location.LocationView), URL('/<slug>/subscribe', 'barcamp_subscribe', handlers.barcamp.registration.BarcampSubscribe), URL('/<slug>/register', 'barcamp_register', handlers.barcamp.registration.BarcampRegister), URL('/<slug>/unregister', 'barcamp_unregister', handlers.barcamp.registration.BarcampUnregister), URL('/<slug>/planning', 'barcamp_planning_pad', handlers.barcamp.pads.PlanningPadView), URL('/<slug>/planning/toggle', 'barcamp_planning_pad_toggle', handlers.barcamp.pads.PadPublicToggleView), URL('/<slug>/docpad', 'barcamp_documentation_pad', handlers.barcamp.pads.DocumentationPadView), URL('/<slug>/lists', 'barcamp_userlist', handlers.barcamp.userlist.UserLists), URL('/<slug>/tweetwally', 'barcamp_tweetwally', handlers.barcamp.tweetwally.TweetWallyView), URL('/<slug>/permissions', 'barcamp_permissions', handlers.barcamp.permissions.Permissions), URL('/<slug>/permissions/admin', 'barcamp_admin', handlers.barcamp.permissions.Admin), URL('/<slug>/sessions', 'barcamp_sessions', handlers.barcamp.sessions.SessionList), URL('/<slug>/sessions.xls', 'barcamp_session_export', handlers.barcamp.sessions.SessionExport), URL('/<slug>/sessions/<sid>', 'barcamp_session', handlers.barcamp.sessions.SessionHandler), URL('/<slug>/sessions/<sid>/vote', 'barcamp_session_vote', handlers.barcamp.sessions.Vote), URL('/<slug>/sessions/<sid>/comments', 'barcamp_session_comments', handlers.barcamp.sessions.CommentHandler), URL('/<slug>/logo/upload', 'barcamp_logo_upload', handlers.barcamp.images.LogoUpload), URL('/<slug>/logo/delete', 'barcamp_logo_delete', handlers.barcamp.images.LogoDelete), URL('/<slug>/logo', 'barcamp_logo', handlers.barcamp.images.Logo), # pages for barcamps URL('/<slug>/page_add/<slot>', 'barcamp_page_add', handlers.pages.add.AddView), URL('/<slug>/<page_slug>', 'barcamp_page', handlers.pages.view.View), URL('/<slug>/<page_slug>/upload', 'page_image_upload', handlers.pages.images.ImageUpload), URL('/<slug>/<page_slug>/layout', 'page_layout', handlers.pages.edit.LayoutView), URL('/<slug>/<page_slug>/edit', 'page_edit', handlers.pages.edit.EditView), URL('/<slug>/<page_slug>/partial_edit', 'page_edit_partial', handlers.pages.edit.PartialEditView), URL('/<slug>/<page_slug>/delete', 'page_image_delete', handlers.pages.images.ImageDelete), URL('/<slug>/<page_slug>/image', 'page_image', handlers.pages.images.Image), ] def finalize_setup(self): """do our own configuration stuff""" self.config.dbs = AttributeMapper() mydb = self.config.dbs.db = pymongo.Connection( self.config.mongodb_host, self.config.mongodb_port)[self.config.mongodb_name] self.config.dbs.barcamps = db.Barcamps(mydb.barcamps, app=self, config=self.config) self.config.dbs.sessions = db.Sessions(mydb.sessions, app=self, config=self.config) self.config.dbs.pages = db.Pages(mydb.pages, app=self, config=self.config) self.config.dbs.session_comments = db.Comments(mydb.session_comments, app=self, config=self.config) self.module_map.uploader.config.assets = Assets(mydb.assets, app=self, config=self.config) # etherpad connection self.config.etherpad = EtherpadLiteClient( base_params={'apikey': self.config.ep_api_key}, base_url=self.config.ep_endpoint) def finalize_modules(self): """finalize all modules""" fsstore = FilesystemStore(base_path=self.config.base_asset_path) self.modules.append( upload_module( store=fsstore, processors=[ ImageSizeProcessor({ 'thumb': "50x50!", 'small': "100x", 'logo_full': "940x", 'medium_user': "******", 'large': "1200x", }) ], ))