Пример #1
0
 def login(self, url=h.encodeURL('/')):
     """
     Show login form
     """
     c.messageCode = request.GET.get('messageCode')
     c.url = h.decodeURL(url)
     c.publicKey = config['extra']['recaptcha']['public']
     return render('/people/login.mako')
Пример #2
0
 def logout(self, url=h.encodeURL('/')):
     """
     Logout
     """
     # If the person is logged in,
     if h.isPerson():
         del session['offset_in_minutes']
         del session['personID']
         del session['nickname']
         del session['is_super']
         session.save()
     # Redirect
     return redirect_to(h.decodeURL(url))
Пример #3
0
 def add(self):
     'Add a job to define datasets'
     # If the user is not logged in, return
     if not h.isPerson():
         return 'Please log in to perform this action.'
     # Initialize
     parameterByName = {
         'test fraction per region': float(request.POST['testFractionPerRegion']),
     }
     # Extract
     regionMethod = request.POST['regionMethod']
     # If the user wants to specify regions via coverage fraction,
     if regionMethod == 'viaCoverageFraction':
         parameterByName.update({
             'window length in meters': float(request.POST['windowLengthInMeters']),
             'region length in windows': int(request.POST['regionLengthInWindows']),
             'coverage fraction': float(request.POST['coverageFraction']),
             'coverage offset': int(request.POST['coverageOffset']),
         })
     # If the user wants to specify regions via rectangles,
     elif regionMethod == 'viaRectangles':
         parameterByName.update({
             'multispectral region frames': request.POST['multispectralRegionFrames'],
         })
     # If the user wants to specify regions via shapefile,
     elif regionMethod == 'viaShapefile':
         # Save upload into a temporary file
         # !!!! not finished
         # region
         parameterByName.update({'region path': ''})
     # Add job
     job = model.Job(model.job_defineRegions, session['personID'])
     job.setInput(dict(
         regionName=request.POST['regionName'],
         imageID=request.POST['imageID'],
         parameterByName=parameterByName,
     ))
     meta.Session.add(job)
     meta.Session.commit()
     # Redirect
     redirect_to(h.decodeURL(url) or url_for('image_index'))
     pass
Пример #4
0
 def add(self, url=None):
     # If the person is not logged in, return
     if not h.isPerson():
         return
     # Load
     imageName = request.POST.get('imageName')
     imageMultispectral = request.POST.get('imageMultispectral')
     imagePanchromatic = request.POST.get('imagePanchromatic')
     # Verify attributes
     if imageName:
         # Get subfolder name
         image = model.Image(imageName, session['personID'])
         meta.Session.add(image)
         meta.Session.commit()
         # Save images
         imagePath = folder_store.WebStore(config['storage_path']).getImagePath(image.id)
         image.multispectral_path = saveUpload(imagePath, 'multispectral', imageMultispectral)
         image.panchromatic_path = saveUpload(imagePath, 'panchromatic', imagePanchromatic)
         meta.Session.commit()
     # Redirect
     redirect_to(h.decodeURL(url) or url_for('image_index'))
Пример #5
0
 def add(self, url=None):
     """
     Add a job to define windows
     """
     # If the user is not logged in, return
     if not h.isPerson():
         return 'Please log in to perform this action.'
     # Load parameters from request.POST
     parameterByName = {
         'example count per region': int(request.POST['exampleCountPerRegion']),
         'multispectral pixel shift value': int(request.POST['multispectralPixelShiftValue']),
         'shift count': int(request.POST['shiftCount']),
     }
     # Create a job in the database with type job_sampleWindows
     job = model.Job(model.job_sampleWindows, session['personID'])
     job.setInput(dict(
         windowName=request.POST['windowName'],
         regionID=request.POST['regionID'],
         parameterByName=parameterByName,
     ))
     meta.Session.add(job)
     meta.Session.commit()
     # Redirect
     redirect_to(h.decodeURL(url) or url_for('window_index'))